{"id":585,"date":"2017-08-18T05:00:17","date_gmt":"2017-08-18T05:00:17","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=585"},"modified":"2017-08-18T05:07:53","modified_gmt":"2017-08-18T05:07:53","slug":"repetition-in-grammar-rules","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/","title":{"rendered":"Repetition in Grammar Rules"},"content":{"rendered":"<p>Many times, we need to repeatedly generate an element, or in general, have a way to control the number times one or more elements get generated. <em><strong>iLangGen<\/strong><\/em> supports all the standard cases:<\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; Zero or once<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; Zero or more times (unbounded)<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; Zero or more times (bounded)<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; One or more times (unbounded)<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; One or more times (bounded)<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>&#8211; A fixed number of times<\/strong><\/p>\n<p>In today&#8217;s post, we shall see how these repetition options are specified in <em><strong>iLangGen<\/strong><\/em> rules.<\/p>\n<p>Let us start with <em><strong>Zero or once<\/strong><\/em>. The following grammar generates a <em><strong>Noun Phrase<\/strong><\/em> followed by a <em><strong>Verb Phrase<\/strong><\/em> and <strong><em>optionally<\/em><\/strong> followed by an <em><strong>Adverb<\/strong><\/em>.<\/p>\n<figure id=\"attachment_586\" aria-describedby=\"caption-attachment-586\" style=\"width: 651px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"586\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/optional\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png\" data-orig-size=\"594,145\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Zero or Once\" data-image-description=\"&lt;p&gt;Zero or Once&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Zero or Once&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png\" class=\"wp-image-586\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png?resize=651%2C159\" alt=\"Zero or Once\" width=\"651\" height=\"159\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png?w=594&amp;ssl=1 594w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png?resize=300%2C73&amp;ssl=1 300w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/a><figcaption id=\"caption-attachment-586\" class=\"wp-caption-text\"><strong>Zero or Once<\/strong><\/figcaption><\/figure>\n<p>We use a convenient print function to print the generated output.<\/p>\n<figure id=\"attachment_593\" aria-describedby=\"caption-attachment-593\" style=\"width: 652px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"593\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/printing-function\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png\" data-orig-size=\"568,101\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Printing function\" data-image-description=\"&lt;p&gt;Printing function&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Printing function&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png\" class=\"wp-image-593\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png?resize=652%2C116\" alt=\"Printing function\" width=\"652\" height=\"116\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png?w=568&amp;ssl=1 568w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Printing-function.png?resize=300%2C53&amp;ssl=1 300w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><\/a><figcaption id=\"caption-attachment-593\" class=\"wp-caption-text\"><strong>Printing function<\/strong><\/figcaption><\/figure>\n<p>The <em><strong>?<\/strong><\/em> operator is used on the RHS of the grammar to denote that the next element is to be generated once or not at all. This is what you get when you run the grammar.<\/p>\n<figure id=\"attachment_587\" aria-describedby=\"caption-attachment-587\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"587\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/optional-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png\" data-orig-size=\"562,217\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Grammar Output\" data-image-description=\"&lt;p&gt;Grammar Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Grammar Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png\" class=\"wp-image-587\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png?resize=650%2C251\" alt=\"Grammar Output\" width=\"650\" height=\"251\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png?w=562&amp;ssl=1 562w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional-output.png?resize=300%2C116&amp;ssl=1 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-587\" class=\"wp-caption-text\"><strong>Grammar Output<\/strong><\/figcaption><\/figure>\n<p>The next operator <em><strong>0-to-n<\/strong><\/em> allows us to specify the upper bound for the repetition; the lower bound is zero. This means, the succeeding element can appear zero or more times, but not more than <strong>N<\/strong>.<\/p>\n<figure id=\"attachment_588\" aria-describedby=\"caption-attachment-588\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"588\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/zero-to-n\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png\" data-orig-size=\"387,116\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Zero or More Times\" data-image-description=\"&lt;p&gt;Zero or More Times&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Zero or More Times&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png\" class=\"wp-image-588\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png?resize=500%2C150\" alt=\"Zero or More Times\" width=\"500\" height=\"150\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png?w=387&amp;ssl=1 387w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n.png?resize=300%2C90&amp;ssl=1 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-588\" class=\"wp-caption-text\"><strong>Zero or More Times<\/strong><\/figcaption><\/figure>\n<p>The above use case shows a pattern that is useful while generating test cases for programming language processors. Here, we generate the signature of a C function that takes zero to two\u00a0arguments.<\/p>\n<p>The following is the output generated by this grammar.<\/p>\n<figure id=\"attachment_589\" aria-describedby=\"caption-attachment-589\" style=\"width: 649px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"589\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/zero-to-n-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png\" data-orig-size=\"587,113\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Zero or More Times Output\" data-image-description=\"&lt;p&gt;Zero or More Times Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Zero or More Times Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png\" class=\"wp-image-589\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png?resize=649%2C125\" alt=\"Zero or More Times Output\" width=\"649\" height=\"125\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png?w=587&amp;ssl=1 587w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/zero-to-n-output.png?resize=300%2C58&amp;ssl=1 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/a><figcaption id=\"caption-attachment-589\" class=\"wp-caption-text\"><strong>Zero or More Times Output<\/strong><\/figcaption><\/figure>\n<p>The operator <em><strong>1-to-n<\/strong><\/em> is almost identical except for the lower bound; the succeeding element will be emitted at least one, but no more than <strong>N<\/strong> times.<\/p>\n<p>The operator <em><strong>0+<\/strong><\/em> repeats the next element zero or more times, without uppper bound. Likewise <em><strong>1+<\/strong><\/em> repeats the element one or more times, no upper bound. In these cases, we usually bind special handlers to the generator to take over termination. Later in this series, I will show how we can do this.<\/p>\n<p>Another useful operator is <em><strong>rpt<\/strong><\/em>. This causes the following element to be repeated a fixed number of times, say <strong>N<\/strong>.<\/p>\n<p>Here is a grammar that uses this operator:<\/p>\n<figure id=\"attachment_590\" aria-describedby=\"caption-attachment-590\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"590\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/fixed-n\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png\" data-orig-size=\"398,117\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Fixed Repetition\" data-image-description=\"&lt;p&gt;Fixed Repetition&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Fixed Repetition&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png\" class=\"wp-image-590\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png?resize=500%2C147\" alt=\"Fixed Repetition\" width=\"500\" height=\"147\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png?w=398&amp;ssl=1 398w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N.png?resize=300%2C88&amp;ssl=1 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-590\" class=\"wp-caption-text\"><strong>Fixed Repetition<\/strong><\/figcaption><\/figure>\n<p>This is a minor variant of the C function example. In this case, we generate a fixed number of arguments (2 to be precise) to the function.<\/p>\n<p>Here is the generated ouput:<\/p>\n<figure id=\"attachment_591\" aria-describedby=\"caption-attachment-591\" style=\"width: 647px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"591\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/fixed-n-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png\" data-orig-size=\"597,71\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Fixed N Output\" data-image-description=\"&lt;p&gt;Fixed N Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Fixed N Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png\" class=\"wp-image-591\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png?resize=647%2C77\" alt=\"Fixed N Output\" width=\"647\" height=\"77\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png?w=597&amp;ssl=1 597w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Fixed-N-output.png?resize=300%2C36&amp;ssl=1 300w\" sizes=\"(max-width: 647px) 100vw, 647px\" \/><\/a><figcaption id=\"caption-attachment-591\" class=\"wp-caption-text\"><strong>Fixed N Output<\/strong><\/figcaption><\/figure>\n<p>To summarize, <em><strong>iLangGen<\/strong><\/em> supports different types of repetition through the following operators:<\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">? =&gt; Optional (zero or one)<\/span><\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">0-to-n =&gt; zero to N times, where N is specified<\/span><\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">1-to-n =&gt; one to N times, where N is specified<\/span><\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">rpt =&gt; Repeat N times, where N is specified<\/span><\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">0+ =&gt; Zero or more times (no upper limit specified)<\/span><\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong><span style=\"color: #000000;\">1+ =&gt; One or more times (no upper limit specified)<\/span><\/strong><\/p>\n<p>In the next post, we shall look at some more interesting features of <em><strong>iLangGen<\/strong><\/em>.<\/p>\n<p>Good day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many times, we need to repeatedly generate an element, or in general, have a way to control the number times one or more elements get generated. iLangGen supports all the standard cases: &#8211; Zero or once &#8211; Zero or more times (unbounded) &#8211; Zero or more times (bounded) &#8211; One or more times (unbounded) &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18,107,17],"tags":[109,111,108],"class_list":["post-585","post","type-post","status-publish","format-standard","hentry","category-lisp","category-natural-language-processing","category-programming","tag-ilanggen","tag-test-case-generation","tag-text-generation"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-9r","jetpack-related-posts":[{"id":1410,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/01\/27\/generating-poetry-using-ilanggen\/","url_meta":{"origin":585,"position":0},"title":"Generating Poetry Using iLangGen","author":"admin","date":"January 27, 2019","format":false,"excerpt":"In an earlier article, I wrote about using iLangGen to generate natural language text. iLangGen is a powerful text generation library that I have been working on over the years. Today, I would like to show how we can use that library to generate \"poetry\". Be warned, however, that the\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Sample Output 2","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/01\/Output2.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":653,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/","url_meta":{"origin":585,"position":1},"title":"Using Function Calls in the Grammar","author":"admin","date":"October 14, 2017","format":false,"excerpt":"One of the advanced features of iLangGen is the ability to embed arbitrary function calls on the RHS of grammar rules. Such functions impart interesting dynamic behaviour to the generated data. For convenience and flexibility, iLangGen supports two types of function calls - Direct and Indirect. In the case of\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Direct Function Call in Grammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":575,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/06\/text-generation-using-ilanggen-framework\/","url_meta":{"origin":585,"position":2},"title":"Text Generation Using iLangGen Framework","author":"admin","date":"August 6, 2017","format":false,"excerpt":"The two primary areas in Natural Language processing are Natural Language Understanding and Natural Language Generation. The former is concerned with processing and making sense of natural language text, whereas the latter is concerned with synthesizing text, possibly from some deep representation. Both are fascinating and at the same time,\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"iLangGen Grammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Blog1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Blog1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Blog1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":617,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/09\/13\/reuse-of-grammars-through-inheritance\/","url_meta":{"origin":585,"position":3},"title":"Reuse of Grammars Through Inheritance","author":"admin","date":"September 13, 2017","format":false,"excerpt":"We are familiar with the advantages of class inheritance in object-oriented languages such as C++, C#, Java, and Python. The ability to reuse functionality via inheritance allows us to express our software design optimally, without having to write redundant code. iLangGen encourages the reuse of grammars by supporting Grammar Inheritance,\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Simple Grammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/09\/image1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/09\/image1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/09\/image1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":884,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/04\/08\/natural-language-generation\/","url_meta":{"origin":585,"position":4},"title":"Natural Language Generation","author":"admin","date":"April 8, 2018","format":false,"excerpt":"I had written a series of posts on my iLangGen framework last year. It aims to provide a flexible and expressive approach for building natural language generation systems. In today's post, I would like to describe a concrete example of how iLangGen can be used for generating natural language text\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Overall Approach","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/04\/overall-1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":637,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/09\/27\/composition-of-grammars\/","url_meta":{"origin":585,"position":5},"title":"Composition of Grammars","author":"admin","date":"September 27, 2017","format":false,"excerpt":"In the last post, we saw how iLangGen text generation framework supports reuse of grammars through inheritance, akin to object-oriented languages. The good news is that we can achieve reuse through composition as well. The following is a simple grammar, nothing fancy to elaborate. Here is the output when you\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Simple Grammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/09\/G1.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=585"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/585\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}