{"id":1309,"date":"2018-12-16T10:19:54","date_gmt":"2018-12-16T04:49:54","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=1309"},"modified":"2018-12-17T06:14:10","modified_gmt":"2018-12-17T00:44:10","slug":"generating-poetry-using-rita","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/","title":{"rendered":"Generating Poetry Using RiTa"},"content":{"rendered":"<p>A few days ago, I came across a nice library called <a href=\"https:\/\/rednoise.org\/rita\/\" target=\"_blank\" rel=\"noopener\"><em><strong>RiTa<\/strong><\/em><\/a>, which is described as <em><strong>a software toolkit for computational literature<\/strong><\/em>. Its two major features are <em><strong>text analysis<\/strong><\/em> and <em><strong>text generation<\/strong><\/em>.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\r\n<p>The <em><strong>text analysis<\/strong><\/em> module parses given text to extract sentences, tokens, POS, stresses, and phonemes. There is also interesting functionality to conjugate verbs, and to identify word stems. It, however, stops short of deriving the parse tree.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\r\n<p>The <em><strong>text generation<\/strong><\/em> component is the more interesting one (at least for me). It supports two approaches for generating text: One requires us to input a <em><strong>BNF<\/strong><\/em>-like grammar (with<span class=\"Apple-converted-space\">\u00a0 optional\u00a0<\/span>probabilities for the different nodes) and generates text from that grammar. This is somewhat similar to my own <a href=\"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/06\/text-generation-using-ilanggen-framework\/\" target=\"_blank\" rel=\"noopener\"><em><strong>iLangGen<\/strong><\/em><\/a> project, although there are significant differences between the two. The second approach appears more appealing because it can generate text using sample text and nothing else (internally, it uses <em><strong>Markov chains<\/strong><\/em>). I found the latter quite interesting since it requires no complicated training, and decided to give it a spin.<\/p>\r\n<p>A nice overview of text generation using <em><strong>Markov chains<\/strong><\/em> is given in the <a href=\"https:\/\/rednoise.org\/rita\/tutorial\/ngrams.php\" target=\"_blank\" rel=\"noopener\"><em><strong>Tutorials<\/strong><\/em><\/a> section. For a more recent introduction to <em><strong>Markov chains<\/strong><\/em>, see this <a href=\"https:\/\/towardsdatascience.com\/introduction-to-markov-chains-50da3645a50d\" target=\"_blank\" rel=\"noopener\"><em><strong>article<\/strong><\/em><\/a>.<\/p>\r\n<p>Since I have to give sample input for generation, I chose two different examples. For my first example, I chose <em><strong>Robert Frost<\/strong><\/em>\u2019s poem <a href=\"https:\/\/www.poetryfoundation.org\/poems\/44266\/mending-wall\" target=\"_blank\" rel=\"noopener\"><em><strong>Mending Wall<\/strong><\/em><\/a>. I saved this poem in a text file.<\/p>\r\n<p>The second example is based on my favourite <em><strong>Tamil<\/strong><\/em> classic <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tirukku\u1e5ba\u1e37\" target=\"_blank\" rel=\"noopener\"><em><strong>Tirukkural<\/strong><\/em><\/a>. I chose the widely acclaimed <em><strong>English<\/strong><\/em> translation by <a href=\"https:\/\/www.projectmadurai.org\/pm_etexts\/pdf\/pm0153.pdf\" target=\"_blank\" rel=\"noopener\"><em><strong>G.U.Pope<\/strong><\/em><\/a>. I extracted 50 <em><strong>couplets<\/strong><\/em> from the first five chapters of the book (there are 133 chapters in all) and saved them to a text file.<\/p>\r\n<p>I used <a href=\"https:\/\/code.visualstudio.com\" target=\"_blank\" rel=\"noopener\"><em><strong>Visual Studio Code<\/strong><\/em><\/a>\u00a0on my iMac for writing and testing the program. <em><strong>Node.js<\/strong><\/em> should be installed on the system, and then you need to install the <em><strong>RiTa<\/strong> <\/em>package using <em><strong>NPM<\/strong><\/em>. You can run the code from within the <em><strong>IDE<\/strong><\/em>, and also in the <em><strong>Terminal<\/strong><\/em> using <em><strong>node<\/strong><\/em> command. The program itself is quite simple and requires no detailed explanation.<\/p>\r\n<p>Here is the Javascript program:<\/p>\r\n<figure id=\"attachment_1312\" aria-describedby=\"caption-attachment-1312\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"1312\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/thecode\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png\" data-orig-size=\"756,422\" 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=\"The Program\" data-image-description=\"&lt;p&gt;The Program&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;The Program&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png\" class=\"wp-image-1312\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png?resize=650%2C363&#038;ssl=1\" alt=\"The Program\" width=\"650\" height=\"363\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png?w=756&amp;ssl=1 756w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png?resize=300%2C167&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/TheCode.png?resize=352%2C198&amp;ssl=1 352w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-1312\" class=\"wp-caption-text\">The Program<\/figcaption><\/figure>\r\n<p>Here is the first output (10 lines) based on Robert Frost&#8217;s example\u00a0<a href=\"https:\/\/www.poetryfoundation.org\/poems\/44266\/mending-wall\" target=\"_blank\" rel=\"noopener\"><em><strong>Mending Wall<\/strong><\/em><\/a>.<\/p>\r\n<figure id=\"attachment_1313\" aria-describedby=\"caption-attachment-1313\" style=\"width: 352px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1313\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/frost1\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png\" data-orig-size=\"352,189\" 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=\"Frost &amp;#8211; First Output\" data-image-description=\"&lt;p&gt;Frost &amp;#8211; First Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Frost &amp;#8211; First Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png\" class=\"size-full wp-image-1313\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png?resize=352%2C189&#038;ssl=1\" alt=\"Frost - First Output\" width=\"352\" height=\"189\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png?w=352&amp;ssl=1 352w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost1.png?resize=300%2C161&amp;ssl=1 300w\" sizes=\"(max-width: 352px) 100vw, 352px\" \/><\/a><figcaption id=\"caption-attachment-1313\" class=\"wp-caption-text\"><strong>Robert Frost &#8211; First Output<\/strong><\/figcaption><\/figure>\r\n<p>When you run the program again, you get a different output:<\/p>\r\n<figure id=\"attachment_1314\" aria-describedby=\"caption-attachment-1314\" style=\"width: 350px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1314\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/frost2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png\" data-orig-size=\"350,184\" 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=\"Frost &amp;#8211; Second Output\" data-image-description=\"&lt;p&gt;Frost &amp;#8211; Second Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Frost &amp;#8211; Second Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png\" class=\"size-full wp-image-1314\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png?resize=350%2C184&#038;ssl=1\" alt=\"Frost - Second Output\" width=\"350\" height=\"184\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png?w=350&amp;ssl=1 350w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Frost2.png?resize=300%2C158&amp;ssl=1 300w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/a><figcaption id=\"caption-attachment-1314\" class=\"wp-caption-text\"><strong>Robert Frost &#8211; Second Output<\/strong><\/figcaption><\/figure>\r\n<p>The following two outputs are generated based on the first 50 couplets of <em><strong>Tirukkural<\/strong><\/em>.<\/p>\r\n<figure id=\"attachment_1317\" aria-describedby=\"caption-attachment-1317\" style=\"width: 496px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1317\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/kural1\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png\" data-orig-size=\"496,253\" 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=\"Tirukkural &amp;#8211; First Output\" data-image-description=\"&lt;p&gt;Tirukkural &amp;#8211; First Output &lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Tirukkural &amp;#8211; First Output &lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png\" class=\"size-full wp-image-1317\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png?resize=496%2C253&#038;ssl=1\" alt=\"Tirukkural - First Output \" width=\"496\" height=\"253\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png?w=496&amp;ssl=1 496w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural1.png?resize=300%2C153&amp;ssl=1 300w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/a><figcaption id=\"caption-attachment-1317\" class=\"wp-caption-text\"><strong>Tirukkural &#8211; First Output<\/strong><\/figcaption><\/figure>\r\n<p>And here is one more:<\/p>\r\n<figure id=\"attachment_1318\" aria-describedby=\"caption-attachment-1318\" style=\"width: 477px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1318\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/kural2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png\" data-orig-size=\"477,258\" 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=\"Tirukkural &amp;#8211; Second Output\" data-image-description=\"&lt;p&gt;Tirukkural &amp;#8211; Second Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Tirukkural &amp;#8211; Second Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png\" class=\"size-full wp-image-1318\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png?resize=477%2C258&#038;ssl=1\" alt=\"Tirukkural - Second Output\" width=\"477\" height=\"258\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png?w=477&amp;ssl=1 477w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Kural2.png?resize=300%2C162&amp;ssl=1 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/a><figcaption id=\"caption-attachment-1318\" class=\"wp-caption-text\"><strong>Tirukkural &#8211; Second Output<\/strong><\/figcaption><\/figure>\r\n<p>All the outputs look quite realistic, don&#8217;t they? Kudos to <em><strong>RiTa<\/strong><\/em> and its creator <em><strong>Daniel Howe<\/strong><\/em>!<\/p>\r\n<p>By the way, as I mentioned earlier, we can run the program in the <em><strong>Terminal<\/strong><\/em> too. Here is the output (<em><strong>Tirukkural<\/strong><\/em> example) from a terminal session:<\/p>\r\n<figure id=\"attachment_1319\" aria-describedby=\"caption-attachment-1319\" style=\"width: 462px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1319\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/12\/16\/generating-poetry-using-rita\/terminal\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png\" data-orig-size=\"462,247\" 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=\"Terminal Session\" data-image-description=\"&lt;p&gt;Terminal Session&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Terminal Session&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png\" class=\"size-full wp-image-1319\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png?resize=462%2C247&#038;ssl=1\" alt=\"Terminal Session\" width=\"462\" height=\"247\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png?w=462&amp;ssl=1 462w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/12\/Terminal.png?resize=300%2C160&amp;ssl=1 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/a><figcaption id=\"caption-attachment-1319\" class=\"wp-caption-text\"><strong>Terminal Session<\/strong><\/figcaption><\/figure>\r\n<p>I am sure the quality and variety of the output would improve if a larger sample is supplied as input. Anyway, I just wanted to get a feel for this work, and I definitely find it interesting.<\/p>\r\n<p>You can download my program from <a href=\"http:\/\/www.rangakrish.com\/downloads\/RiTa-Generation.js\" target=\"_blank\" rel=\"noopener\"><em><strong>here<\/strong><\/em><\/a>.<\/p>\r\n<p>Enjoy, and have a nice weekend!<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>A few days ago, I came across a nice library called RiTa, which is described as a software toolkit for computational literature. Its two major features are text analysis and text generation.\u00a0 The text analysis module parses given text to extract sentences, tokens, POS, stresses, and phonemes. There is also interesting functionality to conjugate verbs, [&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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[107,17],"tags":[109,175,174,176,173,172],"class_list":["post-1309","post","type-post","status-publish","format-standard","hentry","category-natural-language-processing","category-programming","tag-ilanggen","tag-javascript","tag-natural-language-processing","tag-node-js","tag-poetry-generation","tag-rita"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-l7","jetpack-related-posts":[{"id":1410,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/01\/27\/generating-poetry-using-ilanggen\/","url_meta":{"origin":1309,"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":575,"url":"https:\/\/www.rangakrish.com\/index.php\/2017\/08\/06\/text-generation-using-ilanggen-framework\/","url_meta":{"origin":1309,"position":1},"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":884,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/04\/08\/natural-language-generation\/","url_meta":{"origin":1309,"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":2152,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/09\/28\/template-based-text-generation\/","url_meta":{"origin":1309,"position":3},"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":1659,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/08\/04\/generating-poetry-in-prolog\/","url_meta":{"origin":1309,"position":4},"title":"Generating Poetry in Prolog","author":"admin","date":"August 4, 2019","format":false,"excerpt":"In an earlier article, I showed how we can generate poetry (with limitations, of course!) using my iLangGen framework. That implementation (in Lisp) made use of iLexicon, a large dictionary of English words, which I have been building over the years. I subsequently ported iLexicon to Prolog and it now\u2026","rel":"","context":"In &quot;Natural Language Processing&quot;","block_context":{"text":"Natural Language Processing","link":"https:\/\/www.rangakrish.com\/index.php\/category\/natural-language-processing\/"},"img":{"alt_text":"Generation Logic","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/Code3.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/Code3.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/08\/Code3.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1711,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/09\/01\/poetry-in-prolog-part-2\/","url_meta":{"origin":1309,"position":5},"title":"Poetry in Prolog: Part-2","author":"admin","date":"September 1, 2019","format":false,"excerpt":"In an earlier post, I showed how Prolog can be used to generate poetry, making use of my \"iLexicon\". I want to continue the discussion today by giving another example, this time based on the theme of sounds emitted by various animals and birds. As hinted in my previous articles,\u2026","rel":"","context":"In &quot;Natural Language Processing&quot;","block_context":{"text":"Natural Language Processing","link":"https:\/\/www.rangakrish.com\/index.php\/category\/natural-language-processing\/"},"img":{"alt_text":"The DCG Grammar","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/09\/code.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/09\/code.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/09\/code.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1309","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=1309"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1309\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=1309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=1309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=1309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}