{"id":4171,"date":"2022-06-16T08:00:00","date_gmt":"2022-06-16T06:00:00","guid":{"rendered":"http:\/\/www.se-trends.de\/?p=4171"},"modified":"2025-02-05T15:25:22","modified_gmt":"2025-02-05T14:25:22","slug":"requirements-with-vale-linten","status":"publish","type":"post","link":"https:\/\/www.se-trends.de\/en\/anforderungen-mit-vale-linten\/","title":{"rendered":"Requirements with Vale \"linten\""},"content":{"rendered":"<p class=\"wp-block-paragraph\">Programmers know what \"lintering\" is: to put it bluntly, it is the tidying up and maintenance of software code. More precisely, it is static code analysis: a linter recommends deleting unused variables, for example. Vale is a linter that helps authors of texts to maintain them. And Vale can also be used to line requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My interest in Vale is no coincidence: my goal is to have integrated Vale into Semiant, the quality assistant I developed, by the end of June 2022 and to release the free version. If you want to know more, you can go to the <a href=\"https:\/\/www.semiant.com\/semiant-webinar-spring-2022\/\" target=\"_blank\" rel=\"noreferrer noopener\">Register for the Semiant webinar on June 29 (English) or 30 (German) &gt;&gt;<\/a><\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Linten for software code<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Linten goes to a <a href=\"https:\/\/de.wikipedia.org\/wiki\/Lint_(Programmierwerkzeug)\">Tool with the name \"Lint\"<\/a> which Bell Labs developed for the C programming language back in 1979. It is now so widespread that it is available as a standard feature in almost all software development tools for almost all programming languages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A linter performs a static code analysis. The linter finds certain errors that the compiler would wave through: These include uninitialized or unused variables, resources that have not been released again, etc. Linters often also take care of non-functional issues such as compliance with formatting guidelines.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Linten for natural language<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A natural language linter basically does the same thing: it finds certain errors in style. For example, a linter can find grammatical errors. However, as with the lintering of software code, natural language is usually more about writing style and not correctness. For example, a linter might mark passive constructions as errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lintering for natural language is now widespread. Many writing tools can be provided with a linter, for example via plug-ins. I am currently writing this article in WordPress with Linter (Yoast) installed, as you can see in the screenshot below:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img data-src=\"http:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2.png\" data-srcset=\"https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2.png 617w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-453x306.png 453w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-281x190.png 281w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-18x12.png 18w\" decoding=\"async\" width=\"617\" height=\"417\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"\" class=\"wp-image-4172 lazyload\"  sizes=\"(max-width: 617px) 100vw, 617px\" \/><noscript><img decoding=\"async\" width=\"617\" height=\"417\" src=\"http:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2.png\" alt=\"\" class=\"wp-image-4172\" srcset=\"https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2.png 617w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-453x306.png 453w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-281x190.png 281w, https:\/\/www.se-trends.de\/wp-content\/uploads\/2022\/06\/image-2-18x12.png 18w\" sizes=\"(max-width: 617px) 100vw, 617px\"><\/noscript><figcaption class=\"wp-element-caption\">The Linter <a href=\"https:\/\/yoast.com\/wordpress\/plugins\/seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">Yoast SEO<\/a> (WordPress plugin) at work<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Linten for requirements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Writing requirements is particularly useful for the following two reasons: Firstly, patterns for requirements can be easily recorded in rules. A good example of this is the <a href=\"http:\/\/www.se-trends.de\/en\/text-templates-for-requirements\/\">Sequences of text templates<\/a>.  Ideally, if the linter works directly while writing and suggests improvements in real time, the chance that employees will adhere to the templates increases dramatically. Other \"best practices\" for writing natural language requirements can also be called for quite easily. For example, \"weak words\" can be recognized, such as: \"some\", \"slow\", \"sometimes\", etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Secondly, a linter can ensure a uniform style: requirements are often written by many authors. A consistent style ensures that the specification feels \"of a piece\". This may not make for exciting reading, but it helps readers to understand and recognize problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Vale?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/vale.sh\/\">Homepage<\/a> of Vale shows, among other things, how popular the project is. Its users include companies such as Microsoft, Spotify and many more. It can be found as an open source project on github. Vale is also very performant. <a href=\"https:\/\/github.com\/errata-ai\/vale#functionality\">On the developer side<\/a> Vale has also listed several \"competitors\" and benchmarks. These are all important criteria for utilization in <a href=\"https:\/\/www.semiant.com\/semiant-webinar-spring-2022\/\">Semiant<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Use Vale yourself<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, let's take a look at what Vale can do. The <a href=\"https:\/\/vale.sh\/docs\/vale-cli\/installation\/\" target=\"_blank\" rel=\"noreferrer noopener\">Installation<\/a> is simple on all common operating systems. The next step is to configure Vale. A good starting point is the <a href=\"https:\/\/github.com\/errata-ai\/vale-boilerplate\" target=\"_blank\" rel=\"noreferrer noopener\">Boilerplate repository<\/a>. A Vale configuration is made up of many rules. Here is a simple rule from the repository:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code><strong><span style=\"text-decoration: underline;\">OxfordComma.yml<\/span><\/strong>\nextends: existence\nmessage: \"Use the Oxford comma in '%s'.\"\nlink: https:\/\/docs.microsoft.com\/en-us\/style-guide\/punctuation\/commas\nscope: sentence\nlevel: warning\ntokens:\n  - '(?:[^,]+,){1,}\\s\\w+\\sand'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At the <a href=\"https:\/\/de.wikipedia.org\/wiki\/Serielles_Komma\" target=\"_blank\" rel=\"noreferrer noopener\">Oxford comma<\/a> the comma is placed before the last \"and\" in an enumeration, unlike in German. An example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Remember to check your grammar, spelling, and punctuation.\nOxford-Komma ---------------------------^<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If I now use the above sentence - without the comma - as input, I get the following output from Vale:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>$ vale oxford.md\n\n oxford.md\n 1:1 warning Use the Oxford comma in OxfordComma\n               'Remember to check your\n               grammar, spelling and'.                               \n\n\u2716 0 errors, 1 warning and 0 suggestions in 1 file.\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">So what about AI and NLP?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Anyone who has followed me this far will be wondering whether this is about <a href=\"http:\/\/www.se-trends.de\/en\/automation-with-ki\/\">Natural Language Processing (NLP)<\/a> has been used. After all, the rule above is more reminiscent of <a href=\"https:\/\/de.wikipedia.org\/wiki\/Regul%C3%A4rer_Ausdruck\" target=\"_blank\" rel=\"noreferrer noopener\">Regular Expressions<\/a> (which is true). The NLP aspect comes from the preliminary work, recognizable by \"scope: sentence\" or \"tokens:\". The NLP engine has already broken down the text into these elements to be processed.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The sad truth: Despite all the hype, natural language processing relies heavily on rules rather than AI.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Nevertheless, Vale can also access token metadata, in particular the <a href=\"https:\/\/de.wikipedia.org\/wiki\/Part-of-speech-Tagging\" target=\"_blank\" rel=\"noreferrer noopener\">POS tags<\/a>. A <a href=\"https:\/\/vale.sh\/explorer\/apos_are\/\" target=\"_blank\" rel=\"noreferrer noopener\">Example from the Vale website<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>extends: sequence\nmessage: Did you mean \"%[1]ss\" instead of \"%[1]s's\"?\ntokens:\n  - tag: NN\n  - pattern: \"'s\"\n  - pattern: are<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">NN\" stands for \"noun, singular or mass\", i.e. a noun that is either singular or uncountable. The <a href=\"https:\/\/github.com\/jdkato\/prose#tagging\" target=\"_blank\" rel=\"noreferrer noopener\">Tags come from the library prose<\/a> and currently only work for English. This pattern recognizes the error of using an apostrophe before the \"s\" in the plural of a word.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Vale for Linten from requirements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">My goal is to help <a href=\"https:\/\/www.semiant.com\/semiant-webinar-spring-2022\/\" target=\"_blank\" rel=\"noreferrer noopener\">Webinar on June 29\/30, 2022<\/a> have at least completed a proof of concept. Style rules in particular are very easy to implement, for example the recognition of weak words:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background\">tokens:\n  - much(?:|e|es)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The rule shown finds the German Weak Words \"viel\", \"viele\" and \"vieles\". <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It will be exciting to see whether Vale is powerful enough to check more complex rules. I will present what is possible in the webinar.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What do you need...?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Finally: I am of course very interested in what Lint activities you, my readers, would like to see automated. I cannot guarantee that I will implement your suggestions. But no one is helped by a Linter that applies rules that no one is interested in. So: I look forward to your feedback. Feel free to do so anonymously in the comments below, or also <a href=\"https:\/\/meetings-eu1.hubspot.com\/meetings\/michael-jastram\" target=\"_blank\" rel=\"noreferrer noopener\">in a personal conversation<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Programmers know what \"lintering\" is: to put it bluntly, it is the tidying up and maintenance of software code. More precisely, it is static code analysis: a linter recommends deleting unused variables, for example. Vale is a linter that helps authors of texts to maintain them. And Vale can also be used to line requirements....<\/p>","protected":false},"author":1,"featured_media":4177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[4,136],"tags":[100,18,599,597,492,600],"class_list":["post-4171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-forschung","category-werkzeuge","tag-anforderungen","tag-ki","tag-linter","tag-nlp","tag-semiant","tag-vale"],"_links":{"self":[{"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/posts\/4171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/comments?post=4171"}],"version-history":[{"count":0,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/posts\/4171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/media\/4177"}],"wp:attachment":[{"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/media?parent=4171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/categories?post=4171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.se-trends.de\/en\/wp-json\/wp\/v2\/tags?post=4171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}