{"id":1792,"date":"2019-11-23T14:36:29","date_gmt":"2019-11-23T09:06:29","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=1792"},"modified":"2019-11-23T14:52:11","modified_gmt":"2019-11-23T09:22:11","slug":"using-augmented-transition-networks-atn-for-information-extraction","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/","title":{"rendered":"Using Augmented Transition Networks (ATN) for Information Extraction"},"content":{"rendered":"<p>After Wood\u2019s paper [1],<em><strong> Augmented Transition Networks<\/strong><\/em>\u00a0<em><strong>(ATN)<\/strong><\/em> became popular in the 1970s, for parsing text. An ATN is a generalized transition network with two major enhancements:<\/p>\n<ol>\n<li>Support for recursive transitions, including jumping to other ATNs<\/li>\n<li>Performing arbitrary actions when edges are traversed<\/li>\n<li>Remembering state through the use of <em><strong>registers<\/strong><\/em><\/li>\n<\/ol>\n<p>See the <strong>\u201cFurther Reading\u201d<\/strong> section at the end of this article for some good reading material on ATNs.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>Although the ATN formalism is quite powerful, because of its <em><strong>procedural<\/strong><\/em> nature, it tends to be fairly verbose. For this reason, designing and maintaining any non-trivial ATN grammar requires considerable effort.<\/p>\n<p><em><strong>Definite Clause Grammar<\/strong> <\/em>[5], introduced by Pereira and Warren in 1980, was implemented in <em><strong>Prolog<\/strong><\/em> and was shown to be clearer and more compact than ATN for the same problem. (I have also written an <a href=\"https:\/\/www.rangakrish.com\/index.php\/2017\/05\/22\/definite-clause-grammars-dcg-in-lisp\/\" target=\"_blank\" rel=\"noopener\"><em><strong>article<\/strong><\/em><\/a> on using DCG in Lisp.)<\/p>\n<p>Without getting into any discussion (or debate) on whether ATNs are still relevant for solving general parsing problems, in today\u2019s article I would like to show how we can use ATNs to extract meaningful information from unstructured text.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<h2>A Simple Grammar<\/h2>\n<p>Let me start first with highly simplified English grammar for parsing a sentence made up of a <em><strong>noun phrase<\/strong><\/em> and a <em><strong>verb phrase<\/strong><\/em>:<\/p>\n<figure id=\"attachment_1793\" aria-describedby=\"caption-attachment-1793\" style=\"width: 583px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"1793\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/simple-atn-grammar\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg\" data-orig-size=\"583,301\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574414173&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=\"Simple ATN Grammar\" data-image-description=\"&lt;p&gt;Simple ATN Grammar&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Simple ATN Grammar&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg\" class=\"size-full wp-image-1793\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg?resize=583%2C301&#038;ssl=1\" alt=\"Simple ATN Grammar\" width=\"583\" height=\"301\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg?w=583&amp;ssl=1 583w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Simple-ATN-Grammar.jpg?resize=300%2C155&amp;ssl=1 300w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><\/a><figcaption id=\"caption-attachment-1793\" class=\"wp-caption-text\"><strong>A Simple ATN Grammar<\/strong><\/figcaption><\/figure>\n<p>The above grammar defines 3 ATNs, namely, <em><strong>Sentence<\/strong><\/em>, <em><strong>NP<\/strong><\/em> and <em><strong>VP<\/strong><\/em>. The <em><strong>Sentence<\/strong><\/em> ATN has 3 nodes, whereas the <em><strong>NP<\/strong><\/em> and <em><strong>VP<\/strong><\/em> nodes each have 2 nodes. Control starts at the <em><strong>start<\/strong><\/em> node of <em><strong>Sentence<\/strong><\/em>, and as part of traversing the next two nodes, the ATNs <em><strong>NP<\/strong><\/em> and <em><strong>VP<\/strong><\/em> are respectively visited (in essence, like subroutine calls) and if the process is successful, a data structure representing the parsed information is synthesized. Again, I refer you to the reading material mentioned at the end, for learning more about the ATN formalism. Here is a convenient graphical representation of the above grammar:<\/p>\n<figure id=\"attachment_1794\" aria-describedby=\"caption-attachment-1794\" style=\"width: 632px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1794\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/atn-diagram\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg\" data-orig-size=\"632,384\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574501693&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=\"Visualizing the ATN\" data-image-description=\"&lt;p&gt;Visualizing the ATN&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Visualizing the ATN&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg\" class=\"size-full wp-image-1794\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg?resize=632%2C384&#038;ssl=1\" alt=\"Visualizing the ATN\" width=\"632\" height=\"384\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg?w=632&amp;ssl=1 632w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/ATN-Diagram.jpg?resize=300%2C182&amp;ssl=1 300w\" sizes=\"(max-width: 632px) 100vw, 632px\" \/><\/a><figcaption id=\"caption-attachment-1794\" class=\"wp-caption-text\"><strong>Visualizing the ATN<\/strong><\/figcaption><\/figure>\n<p>Although it might not be obvious, the ATN parser makes use of a lexicon to guide it. For example, the <em><strong>cat<\/strong><\/em> arc checks if the current input word belongs to a lexical category such as <em><strong>verb<\/strong><\/em>, <em><strong>noun<\/strong><\/em> or <em><strong>adverb<\/strong><\/em>. It is the lexicon that provides this information to the parser.<\/p>\n<p>Here are some sample sentences parsed using this grammar:<\/p>\n<figure id=\"attachment_1795\" aria-describedby=\"caption-attachment-1795\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"1795\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/grammar-examples\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg\" data-orig-size=\"686,192\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574415030&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=\"Parsing Examples\" data-image-description=\"&lt;p&gt;Parsing Examples&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Parsing Examples&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg\" class=\"wp-image-1795\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg?resize=650%2C182&#038;ssl=1\" alt=\"Parsing Examples\" width=\"650\" height=\"182\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg?w=686&amp;ssl=1 686w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Grammar-examples.jpg?resize=300%2C84&amp;ssl=1 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-1795\" class=\"wp-caption-text\"><strong>Parsing Examples<\/strong><\/figcaption><\/figure>\n<p>I hope you can see why the last example fails. As per the grammar, we are expecting an <em><strong>adverb<\/strong><\/em> after the word <em><strong>chased<\/strong><\/em>, but the actual input is an <em><strong>article<\/strong><\/em>.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<h2>Chunking<\/h2>\n<p>Now consider this problem: We are given a sentence and we want to identify the <em><strong>verb phrase<\/strong><\/em> alone. We are not interested in anything before or after it. For simplicity, let us assume that the <em><strong>verb phrase<\/strong><\/em> is as defined in the above grammar \u2013 a <em><strong>verb<\/strong><\/em> followed by an <em><strong>adverb<\/strong><\/em>. Will the above ATN grammar work?<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>The above grammar expects a <em><strong>noun phrase<\/strong><\/em> of a fixed pattern before the <em><strong>verb phrase<\/strong><\/em>. In this sense, it is a bit strict in accepting input sentences. What if the input sentence had a more complex noun phrase, for example, <em><strong>\u201cmy cute little dog\u201d,<\/strong><\/em> followed by the verb phrase <em><strong>\u201cran fast\u201d<\/strong><\/em>? Even though the verb phrase matches our pattern, the whole parse will fail because of the incorrect noun phrase. In this case, we are interested in <em><strong>chunking<\/strong><\/em>, instead of a full parse.<\/p>\n<p><em><strong>Chunking<\/strong><\/em>, as it is used in NLP, represents a form of <em><strong>shallow parsing<\/strong><\/em> where the goal is to extract meaningful fragments from given text. In contrast, traditional full parsing attempts to parse the entire text according to some well-defined grammar of the language, resulting in a complete syntactic structure of the text. This might or might not be the preferred approach, depending on the nature of the given text, and what we are looking to extract. <em><strong>Chunking<\/strong><\/em> is of practical significance in extracting information from <em><strong>unstructured<\/strong><\/em> text.<\/p>\n<p>The popular <em><strong>Python<\/strong><\/em> library <a href=\"http:\/\/www.nltk.org\" target=\"_blank\" rel=\"noopener\"><em><strong>NLTK<\/strong><\/em><\/a>\u00a0has support for <a href=\"https:\/\/www.nltk.org\/book\/ch07.html\" target=\"_blank\" rel=\"noopener\"><em><strong>chunking<\/strong><\/em><\/a> based on part-of-speech (POS) tags. Although this will work in many situations, sometimes we might want to chunk based on keywords instead of using POS tags. In some other situations we might want to combine both POS tags and keywords while mining for some information.<\/p>\n<p>Coming back to our ATN, here is a grammar for extracting just the <em><strong>verb phrase<\/strong><\/em> from input sentence:<\/p>\n<figure id=\"attachment_1797\" aria-describedby=\"caption-attachment-1797\" style=\"width: 478px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1797\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/chunking-grammar\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg\" data-orig-size=\"478,125\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574414089&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=\"Chunking Grammar\" data-image-description=\"&lt;p&gt;Chunking Grammar&lt;\/p&gt;\n\" data-image-caption=\"\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg\" class=\"size-full wp-image-1797\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg?resize=478%2C125&#038;ssl=1\" alt=\"Chunking Grammar\" width=\"478\" height=\"125\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg?w=478&amp;ssl=1 478w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-grammar.jpg?resize=300%2C78&amp;ssl=1 300w\" sizes=\"(max-width: 478px) 100vw, 478px\" \/><\/a><figcaption id=\"caption-attachment-1797\" class=\"wp-caption-text\"><strong>Chunking Grammar<\/strong><\/figcaption><\/figure>\n<p>Here is the corresponding graphical representation:<\/p>\n<figure id=\"attachment_1798\" aria-describedby=\"caption-attachment-1798\" style=\"width: 432px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1798\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/chunking-diagram\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg\" data-orig-size=\"432,123\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574501937&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=\"Graphical Representation\" data-image-description=\"&lt;p&gt;Graphical Representation&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Graphical Representation&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg\" class=\"size-full wp-image-1798\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg?resize=432%2C123&#038;ssl=1\" alt=\"Graphical Representation\" width=\"432\" height=\"123\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg?w=432&amp;ssl=1 432w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-Diagram.jpg?resize=300%2C85&amp;ssl=1 300w\" sizes=\"(max-width: 432px) 100vw, 432px\" \/><\/a><figcaption id=\"caption-attachment-1798\" class=\"wp-caption-text\"><strong>Graphical Representation of the Chunking Grammar<\/strong><\/figcaption><\/figure>\n<p>What is different about this grammar is that in the <em><strong>start<\/strong><\/em> node, it looks for a <em><strong>verb<\/strong><\/em> and ignores other categories. When it sees a <em><strong>verb<\/strong><\/em> in the input, it goes to the next node and looks for an <em><strong>adverb<\/strong><\/em>. Any non-verb input is ignored (until end of the sentence is reached).<\/p>\n<p>Here is a sample sentence parsed by this grammar:<\/p>\n<figure id=\"attachment_1800\" aria-describedby=\"caption-attachment-1800\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1800\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/chunking-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg\" data-orig-size=\"698,43\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574277905&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=\"Chunking: Example 1\" data-image-description=\"&lt;p&gt;Chunking: Example 1&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Chunking: Example 1&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg\" class=\"wp-image-1800\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?resize=650%2C40&#038;ssl=1\" alt=\"Chunking: Example 1\" width=\"650\" height=\"40\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?w=698&amp;ssl=1 698w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?resize=300%2C18&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?resize=680%2C43&amp;ssl=1 680w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output.jpg?resize=675%2C43&amp;ssl=1 675w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-1800\" class=\"wp-caption-text\"><strong>Chunking: Example 1<\/strong><\/figcaption><\/figure>\n<p>Here is a more interesting parse:<\/p>\n<figure id=\"attachment_1801\" aria-describedby=\"caption-attachment-1801\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1801\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/chunking-output2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg\" data-orig-size=\"705,43\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574440617&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=\"Chunking: Example 2\" data-image-description=\"&lt;p&gt;Chunking: Example 2&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Chunking: Example 2&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg\" class=\"wp-image-1801\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?resize=650%2C40&#038;ssl=1\" alt=\"Chunking: Example 2\" width=\"650\" height=\"40\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?w=705&amp;ssl=1 705w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?resize=300%2C18&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?resize=680%2C43&amp;ssl=1 680w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Chunking-output2.jpg?resize=675%2C43&amp;ssl=1 675w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-1801\" class=\"wp-caption-text\"><strong>Chunking: Example 2<\/strong><\/figcaption><\/figure>\n<p>Can you spot the difference between this example and the previous one?<\/p>\n<p>You can see that there are two verbs in the second example, namely, <em><strong>shunned<\/strong><\/em> and <em><strong>worked<\/strong><\/em>. When the first verb <em><strong>shunned<\/strong><\/em> is seen, the parser jumps to the <em><strong>adverb<\/strong><\/em> node, but since <em><strong>temptations<\/strong><\/em> is a noun and not an adverb, it fails. The parser then <em><strong>backtracks<\/strong><\/em> and continues to look for the next <em><strong>verb<\/strong><\/em>. It finds <em><strong>worked<\/strong><\/em> this time, and the next word happens to be an <em><strong>adverb<\/strong><\/em>, satisfying the grammar. The extracted verb phrase is <em><strong>&#8220;worked harder\u201d<\/strong><\/em>. That is the power of the ATN \u2013 it can backtrack as needed till it finds (or has to necessarily give up) a proper match in the input. By the way, this can also be a concern from a performance point of view; we want to eliminate (or minimize) backtracking if at all possible because backtracking is costly. Often times, peeking ahead to select a valid option is preferred to blind backtracking, but that is beyond the scope of this article.<\/p>\n<h2>Generalized Information Extraction<\/h2>\n<p>Now that you have understood how to collect fragments from an input text, let us apply this idea to extract important information from a <em><strong>homeopathy case record<\/strong><\/em>. Again, for the sake of illustration, I have deliberately kept the example simple.<\/p>\n<p>Here is the text we want to analyze:<\/p>\n<figure id=\"attachment_1802\" aria-describedby=\"caption-attachment-1802\" style=\"width: 576px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1802\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/case\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg\" data-orig-size=\"576,62\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574260335&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=\"Homeopathy Case Text\" data-image-description=\"&lt;p&gt;Homeopathy Case Text&lt;\/p&gt;\n\" data-image-caption=\"\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg\" class=\"size-full wp-image-1802\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg?resize=576%2C62&#038;ssl=1\" alt=\"Homeopathy Case Text\" width=\"576\" height=\"62\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg?w=576&amp;ssl=1 576w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case.jpg?resize=300%2C32&amp;ssl=1 300w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/a><figcaption id=\"caption-attachment-1802\" class=\"wp-caption-text\"><strong>Homeopathy Case Text<\/strong><\/figcaption><\/figure>\n<p>We would like to extract the following information from this text:<\/p>\n<ol>\n<li><strong>Patient\u2019s age and gender<\/strong><\/li>\n<li><strong>Modalities: when does the complaint become better or worse?<\/strong><\/li>\n<\/ol>\n<p>Here is the ATN to extract <em><strong>gender<\/strong><\/em>:<\/p>\n<figure id=\"attachment_1803\" aria-describedby=\"caption-attachment-1803\" style=\"width: 587px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1803\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/gender\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg\" data-orig-size=\"587,119\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574260030&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=\"ATN for Gender\" data-image-description=\"&lt;p&gt;ATN for Gender&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;ATN for Gender&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg\" class=\"size-full wp-image-1803\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg?resize=587%2C119&#038;ssl=1\" alt=\"ATN for Gender\" width=\"587\" height=\"119\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg?w=587&amp;ssl=1 587w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/gender.jpg?resize=300%2C61&amp;ssl=1 300w\" sizes=\"(max-width: 587px) 100vw, 587px\" \/><\/a><figcaption id=\"caption-attachment-1803\" class=\"wp-caption-text\"><strong>ATN for Gender<\/strong><\/figcaption><\/figure>\n<p>The following 3 ATNs handle the <em><strong>age<\/strong><\/em><\/p>\n<figure id=\"attachment_1804\" aria-describedby=\"caption-attachment-1804\" style=\"width: 547px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1804\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/age\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg\" data-orig-size=\"547,401\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574335758&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=\"ATNs for Parsing Age\" data-image-description=\"&lt;p&gt;ATNs for Parsing Age&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;ATNs for Parsing Age&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg\" class=\"size-full wp-image-1804\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg?resize=547%2C401&#038;ssl=1\" alt=\"ATNs for Parsing Age\" width=\"547\" height=\"401\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg?w=547&amp;ssl=1 547w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/age.jpg?resize=300%2C220&amp;ssl=1 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/a><figcaption id=\"caption-attachment-1804\" class=\"wp-caption-text\"><strong>ATNs for Parsing Age<\/strong><\/figcaption><\/figure>\n<p>The reason why extracting age is slightly more involved is because we need to handle sentence patterns like these:<\/p>\n<p style=\"padding-left: 30px;\"><em><strong>\u2026. 50 years old \u2026.<\/strong><\/em><\/p>\n<p style=\"padding-left: 30px;\"><em><strong>\u2026. 50 years of age \u2026.<\/strong><\/em><\/p>\n<p style=\"padding-left: 30px;\"><em><strong>\u2026. aged 50 years \u2026.<\/strong><\/em><\/p>\n<p>Finally, the <em><strong>modality<\/strong><\/em> is handled by the following ATN:<\/p>\n<figure id=\"attachment_1805\" aria-describedby=\"caption-attachment-1805\" style=\"width: 612px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1805\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/modality\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg\" data-orig-size=\"612,331\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574260002&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=\"ATN for Modality\" data-image-description=\"&lt;p&gt;ATN for Modality&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;ATN for Modality&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg\" class=\"size-full wp-image-1805\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg?resize=612%2C331&#038;ssl=1\" alt=\"ATN for Modality\" width=\"612\" height=\"331\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg?w=612&amp;ssl=1 612w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/modality.jpg?resize=300%2C162&amp;ssl=1 300w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/a><figcaption id=\"caption-attachment-1805\" class=\"wp-caption-text\"><strong>ATN for Modality<\/strong><\/figcaption><\/figure>\n<p>Let us parse the given text using the above ATNs.<\/p>\n<figure id=\"attachment_1806\" aria-describedby=\"caption-attachment-1806\" style=\"width: 588px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1806\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2019\/11\/23\/using-augmented-transition-networks-atn-for-information-extraction\/case-output\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg\" data-orig-size=\"588,110\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1574260299&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=\"Case Output\" data-image-description=\"&lt;p&gt;Case Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Case Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg\" class=\"size-full wp-image-1806\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg?resize=588%2C110&#038;ssl=1\" alt=\"Case Output\" width=\"588\" height=\"110\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg?w=588&amp;ssl=1 588w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/11\/Case-output.jpg?resize=300%2C56&amp;ssl=1 300w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><\/a><figcaption id=\"caption-attachment-1806\" class=\"wp-caption-text\"><strong>Case Output<\/strong><\/figcaption><\/figure>\n<p>The output is as expected. I hope the above examples show the power and expressiveness of ATNs in parsing text. I have implemented the ATN parser in <a href=\"http:\/\/www.lispworks.com\" target=\"_blank\" rel=\"noopener\"><em><strong>Lispworks<\/strong><\/em><\/a> Lisp.<\/p>\n<p>Have a great weekend!<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<h2>Further Reading<\/h2>\n<p>1) Woods, W.A., \u201cAugmented Transition Networks for Natural Language Analysis\u201d, Communications of the ACM, October 1970.<\/p>\n<p>2) Madeline Bates, \u201cThe Theory and Practice of Augmented Transition Network Grammars\u201d in \u201cNatural Language Communication with Computers\u201d, Lecture Notes in Computer Science, Edited by Leonard Bloc, Springer-Verlag, 1978.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>3) Finin, T.W., \u201cThe Planes Interpreter and Compiler for Augmented Transition Network Grammars\u201d, in \u201cThe Design of Interpreters, Compilers, and Editors for Augmented Transition networks\u201d, Edited by Leonard Bloc, Springer-Verlag, 1983.<\/p>\n<p>4) Terry Winograd, Language as a Cognitive process, Volume 1: Syntax, Addison-Wesley, 1983.<\/p>\n<p>5) Pereira F.C.N. and Warren D.H.D., &#8220;Definite Clause Grammars for Language Analysis&#8221;, Artificial Intelligence 13 (1980).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After Wood\u2019s paper [1], Augmented Transition Networks\u00a0(ATN) became popular in the 1970s, for parsing text. An ATN is a generalized transition network with two major enhancements: Support for recursive transitions, including jumping to other ATNs Performing arbitrary actions when edges are traversed Remembering state through the use of registers See the \u201cFurther Reading\u201d section at [&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_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},"jetpack_post_was_ever_published":false},"categories":[18,107,17],"tags":[221,220,181,212],"class_list":["post-1792","post","type-post","status-publish","format-standard","hentry","category-lisp","category-natural-language-processing","category-programming","tag-atn","tag-augmented-transition-network","tag-chunking","tag-information-extraction"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-sU","jetpack-related-posts":[{"id":1817,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/12\/08\/using-definite-clause-grammars-dcg-for-information-extraction\/","url_meta":{"origin":1792,"position":0},"title":"Using Definite Clause Grammars (DCG) for Information Extraction","author":"admin","date":"December 8, 2019","format":false,"excerpt":"In the previous article, I showed how we can use ATNs for extracting key information from natural language text. I also pointed out in that article that Definite Clause Grammars (DCG) are a more compact formalism for doing this. That will be the focus of today's article. For a nice\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":"Processing the Text","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/12\/Processing-file-code.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/12\/Processing-file-code.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/12\/Processing-file-code.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2366,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/03\/28\/implementing-ilexicon-using-litedb\/","url_meta":{"origin":1792,"position":1},"title":"Implementing iLexicon using LiteDB","author":"admin","date":"March 28, 2021","format":false,"excerpt":"iLexicon is an \"intelligent\" dictionary that can be used to build Natural Language applications. I have two implementations, one in Lisp and another in Prolog. Both implementations are memory-based, in order to speed up performance. I have written several articles referencing it, for example see this. \u00a0 LiteDB is a\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":"Sample Commands","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/03\/Session1.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":1792,"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":3283,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/12\/26\/homeopathy-case-analysis-using-retrieval-augmented-generation\/","url_meta":{"origin":1792,"position":3},"title":"Homeopathy Case Analysis Using Retrieval-Augmented Generation","author":"admin","date":"December 26, 2023","format":false,"excerpt":"Homeopaths, after detailed case taking, usually \u2018\u201crepertorize\u201d\u00a0 the case using software such as RadarOpus, MacRepertory, Vithoulkas Compass, etc., and finally consult a Materia Medica to confirm the remedy selection. There are some highly experienced homeopaths who have the gift of identifying the correct remedy without even repertorizing the case, but\u2026","rel":"","context":"In &quot;Homeopathy&quot;","block_context":{"text":"Homeopathy","link":"https:\/\/www.rangakrish.com\/index.php\/category\/homeopathy\/"},"img":{"alt_text":"Example Chat","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/Two-300x95.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/Two-300x95.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/12\/Two-300x95.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1532,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/04\/07\/book-review-grammar-as-science\/","url_meta":{"origin":1792,"position":4},"title":"Book Review: Grammar as Science","author":"admin","date":"April 7, 2019","format":false,"excerpt":"Title: Grammar as Science Author: Richard K. Larson Publisher: The MIT Press Year: 2010 I love studying English Grammar. That is one of the reasons I enjoy working in the area of NLP. Machine Learning techniques apart, I firmly believe that a good understanding of the conventional approaches to modelling\u2026","rel":"","context":"In &quot;Book Review&quot;","block_context":{"text":"Book Review","link":"https:\/\/www.rangakrish.com\/index.php\/category\/book-review\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1410,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/01\/27\/generating-poetry-using-ilanggen\/","url_meta":{"origin":1792,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1792","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=1792"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/1792\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=1792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=1792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=1792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}