{"id":653,"date":"2017-10-14T12:37:46","date_gmt":"2017-10-14T12:37:46","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=653"},"modified":"2017-10-14T12:39:57","modified_gmt":"2017-10-14T12:39:57","slug":"using-function-calls-in-the-grammar","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/","title":{"rendered":"Using Function Calls in the Grammar"},"content":{"rendered":"<p>One of the advanced features of <em><strong>iLangGen<\/strong><\/em> is the ability to embed arbitrary function calls on the RHS of grammar rules. Such functions impart interesting dynamic behaviour to the generated data.<\/p>\n<p>For convenience and flexibility, <em><strong>iLangGen<\/strong><\/em> supports two types of function calls &#8211; <em><strong>Direct<\/strong><\/em> and <em><strong>Indirect<\/strong><\/em>. In the case of the <em><strong>Direct<\/strong><\/em> function call, the function will be called as it is and its return value will be used in the generated data. In the case of <em><strong>Indirect<\/strong><\/em> function call, there is a level of indirection. The given function will be called once and it is expected to return another function. It is the returned function that will be used everytime a node in the traversal graph is visited. Let us see both cases.<\/p>\n<p>The following figure shows a simple grammar where the non-terminal <em><strong>Random<\/strong><\/em> has a call to function <em><strong>get-random-number<\/strong><\/em> on the RHS. You can see that this function is called 5 times to generate 5 data elements. This is the case of <em><strong>Direct call<\/strong><\/em>.<\/p>\n<figure id=\"attachment_654\" aria-describedby=\"caption-attachment-654\" style=\"width: 403px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"654\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image1-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png\" data-orig-size=\"403,73\" 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=\"Direct Function Call in Grammar\" data-image-description=\"&lt;p&gt;Direct Function Call in Grammar&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Direct Function Call in Grammar&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png\" class=\"size-full wp-image-654\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png?resize=403%2C73\" alt=\"Direct Function Call in Grammar\" width=\"403\" height=\"73\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png?w=403&amp;ssl=1 403w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png?resize=300%2C54&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image1.png?resize=400%2C73&amp;ssl=1 400w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/a><figcaption id=\"caption-attachment-654\" class=\"wp-caption-text\"><strong>Direct Function Call in Grammar<\/strong><\/figcaption><\/figure>\n<p>The actual function definition appears below. This function is passed 3 arguments when it is called: the node being visited, the output stream and the grammar object. The function can make use of the passed arguments if needed, but in this case, we will keep things simple, where the function merely returns a random number below <em><strong>1000<\/strong><\/em>.<\/p>\n<figure id=\"attachment_655\" aria-describedby=\"caption-attachment-655\" style=\"width: 527px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"655\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image2-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png\" data-orig-size=\"527,122\" 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=\"Direct Function Definition\" data-image-description=\"&lt;p&gt;Direct Function Definition&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Direct Function Definition&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png\" class=\"size-full wp-image-655\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png?resize=527%2C122\" alt=\"Direct Function Definition\" width=\"527\" height=\"122\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png?w=527&amp;ssl=1 527w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image2.png?resize=300%2C69&amp;ssl=1 300w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/a><figcaption id=\"caption-attachment-655\" class=\"wp-caption-text\"><strong>Direct Function Definition<\/strong><\/figcaption><\/figure>\n<p>The output generated by this grammar is this:<\/p>\n<figure id=\"attachment_656\" aria-describedby=\"caption-attachment-656\" style=\"width: 699px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image5.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"656\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image5-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image5.png\" data-orig-size=\"699,63\" 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\/10\/Image5.png\" class=\"size-full wp-image-656\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image5.png?resize=699%2C63\" alt=\"Grammar Output\" width=\"699\" height=\"63\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image5.png?w=699&amp;ssl=1 699w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image5.png?resize=300%2C27&amp;ssl=1 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a><figcaption id=\"caption-attachment-656\" class=\"wp-caption-text\"><strong>Grammar Output<\/strong><\/figcaption><\/figure>\n<p>Here is an example of a grammar where we use <em><strong>Indirect call<\/strong><\/em>. The grammar has the same structure as the previous one, but the called function is now passed an argument of <em><strong>100<\/strong><\/em>.<\/p>\n<figure id=\"attachment_659\" aria-describedby=\"caption-attachment-659\" style=\"width: 483px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"659\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image4-3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png\" data-orig-size=\"483,75\" 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=\"Indirect Function Call Grammar\" data-image-description=\"&lt;p&gt;Indirect Function Call Grammar&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Indirect Function Call Grammar&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png\" class=\"size-full wp-image-659\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png?resize=483%2C75\" alt=\"Indirect Function Call Grammar\" width=\"483\" height=\"75\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png?w=483&amp;ssl=1 483w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image4-1.png?resize=300%2C47&amp;ssl=1 300w\" sizes=\"(max-width: 483px) 100vw, 483px\" \/><\/a><figcaption id=\"caption-attachment-659\" class=\"wp-caption-text\"><strong>Indirect Function Call Grammar<\/strong><\/figcaption><\/figure>\n<p>The function definition, shown below, takes the passed argument and returns another function that takes three arguments (as in the <em><strong>Direct call<\/strong><\/em> case). The passed argument is bound to the lambda.<\/p>\n<figure id=\"attachment_660\" aria-describedby=\"caption-attachment-660\" style=\"width: 358px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"660\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image3-3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png\" data-orig-size=\"358,90\" 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=\"Indirect Function\" data-image-description=\"&lt;p&gt;Indirect Function&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Indirect Function&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png\" class=\"size-full wp-image-660\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png?resize=358%2C90\" alt=\"Indirect Function\" width=\"358\" height=\"90\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png?w=358&amp;ssl=1 358w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image3-1.png?resize=300%2C75&amp;ssl=1 300w\" sizes=\"(max-width: 358px) 100vw, 358px\" \/><\/a><figcaption id=\"caption-attachment-660\" class=\"wp-caption-text\"><strong>Indirect Function Definition<\/strong><\/figcaption><\/figure>\n<p>Here is the output from this grammar:<\/p>\n<figure id=\"attachment_661\" aria-describedby=\"caption-attachment-661\" style=\"width: 712px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image6.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"661\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2017\/10\/14\/using-function-calls-in-the-grammar\/image6-2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image6.png\" data-orig-size=\"712,58\" 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\/10\/Image6.png\" class=\"size-full wp-image-661\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image6.png?resize=712%2C58\" alt=\"Grammar Output\" width=\"712\" height=\"58\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image6.png?w=712&amp;ssl=1 712w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/10\/Image6.png?resize=300%2C24&amp;ssl=1 300w\" sizes=\"(max-width: 712px) 100vw, 712px\" \/><\/a><figcaption id=\"caption-attachment-661\" class=\"wp-caption-text\"><strong>Grammar Output<\/strong><\/figcaption><\/figure>\n<p>As you can see, both types of calls have their uses, the <em><strong>Indirect call<\/strong><\/em> providing extra freedom to synthesize the actual behaviour dynamically.<\/p>\n<p>Today&#8217;s examples do not use the three arguments passed by the traversal algorithm. In a future post, I will spend some time on what those are and how they can be used to advantage.<\/p>\n<p>That is it for today. Have a great day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211; Direct and Indirect. In the case of the Direct function call, the [&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,108],"class_list":["post-653","post","type-post","status-publish","format-standard","hentry","category-lisp","category-natural-language-processing","category-programming","tag-ilanggen","tag-text-generation"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-ax","jetpack-related-posts":[{"id":575,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/06\/text-generation-using-ilanggen-framework\/","url_meta":{"origin":653,"position":0},"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":585,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/18\/repetition-in-grammar-rules\/","url_meta":{"origin":653,"position":1},"title":"Repetition in Grammar Rules","author":"admin","date":"August 18, 2017","format":false,"excerpt":"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: - Zero or once - Zero or more times (unbounded) - Zero or more times (bounded) - One\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Zero or Once","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2017\/08\/Optional.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":653,"position":2},"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":1410,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/01\/27\/generating-poetry-using-ilanggen\/","url_meta":{"origin":653,"position":3},"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":2152,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/09\/28\/template-based-text-generation\/","url_meta":{"origin":653,"position":4},"title":"Template-Based Text Generation","author":"admin","date":"September 28, 2020","format":false,"excerpt":"I had written earlier about natural language generation\u00a0using my iLangGen framework. I used a \"template\" text file which was instantiated dynamically based on predefined \"grammars\" and external data. The sample application I show-cased demonstrated its utility and versatility. Today I would like to touch upon a few other \"pattern\" elements\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Template File","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/09\/Template-300x195.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/09\/Template-300x195.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/09\/Template-300x195.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2162,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/10\/11\/template-based-text-generation-part-2\/","url_meta":{"origin":653,"position":5},"title":"Template-based Text Generation &#8211; Part 2","author":"admin","date":"October 11, 2020","format":false,"excerpt":"In my previous article, I showed how \u201ciLangGen\u201d framework facilitates text generation using templates. I talked about the various \u201cpatterns\u201d that can be used in a template. However, in that article, I did not go into the details of the \u201cEmbedded Template\u201d pattern. That is the focus of today\u2019s article.\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"Main Template","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/10\/main-template-300x137.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/653","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=653"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/653\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}