<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0"><channel><title>Nieuwskanaal voor: Garfixia</title><link>http://www.garfixia.nl/</link><description>De laatste nieuws artikelen</description><language>nl-NL</language><lastBuildDate>Sat, 19 May 2012 09:37:54 +0200</lastBuildDate><docs>http://blogs.law.harvard.edu/tech/rss</docs><generator>Procurios RSS2 Feed</generator><item><title>The problem with proper nouns</title><description>&lt;p&gt;Before a sentence is passed to the parser, it is first run through the lexer. The lexer divides the sentence into words or word groups. These are called lexical items and they are the smallest parts of the sentence that have a single part-of-speech. Most lexical items can be looked up in the lexicon. But what about proper nouns?&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Proper nouns (or more exactly: proper names), lexical items like &quot;Sandra&quot;, &quot;Peter R. de Vries&quot; and &quot;Ramachandra&quot; are not part of the lexicon (dictionary). Therefore they will not be recognized simply by doing a lexicon lookup.&lt;br /&gt;&lt;br /&gt;Still, you may be able to recognize some of them by looking them up in a knowledge base.&lt;/p&gt;
&lt;pre&gt;When was Lord Byron born?&lt;/pre&gt;
&lt;p&gt;The name &quot;Lord Byron&quot; may be looked up and form a single lexical item with the part-of-speech &quot;proper noun&quot;.&lt;/p&gt;
&lt;pre&gt;[when, was, Lord Byron, born]&lt;/pre&gt;
&lt;p&gt;But this sentence is different:&lt;/p&gt;
&lt;pre&gt;My name is Jan de Vries.&lt;/pre&gt;
&lt;p&gt;The name of the conversation partner cannot be looked up. And this is only logical, because the purpose of the sentence is introduction. And I mean that in two ways: the person introduces himself. And at the same time a new lexical item, &quot;Jan de Vries&quot;, is introduced in the mental lexicon of the agent.&lt;br /&gt;&lt;br /&gt;How can a lexer recognize a new proper noun when it encounters one? I can think of two ways:&lt;br /&gt;&lt;br /&gt;1. The words in the sentence that are not part of the lexicon form the new proper noun.&lt;br /&gt;2. Proper nouns may be recognized because they follow certain patterns.&lt;br /&gt;&lt;br /&gt;The first method is simple and applies to all names. However, it runs into several problems. &lt;br /&gt;&lt;br /&gt;For example:&lt;/p&gt;
&lt;pre&gt;My name is Jan de Vries.&lt;/pre&gt;
&lt;pre&gt;[my, name, is, Jan, de, Vries]&lt;/pre&gt;
&lt;p&gt;Since &quot;de&quot; is a word in the lexicon, are &quot;Jan&quot; and &quot;Vries&quot; to be separated into two separate proper nouns? No, because we want to end up with single lexical item. So we may want to take all words in between the unknown words as well. However, which words should we include and which words should we not?&lt;/p&gt;
&lt;pre&gt;My name is Jan and I like Sandra.&lt;/pre&gt;
&lt;pre&gt;[my, name, is, Jan and I like Sandra]&lt;/pre&gt;
&lt;p&gt;Why can &quot;Jan and I like Sandra&quot; not be a proper noun? Because it is too long? What about&lt;/p&gt;
&lt;pre&gt;My Name is Johannes Hubertus van der Laak.&lt;/pre&gt;
&lt;p&gt;It contains just as many words.&lt;br /&gt;&lt;br /&gt;That brings us to the second option: patterns.&lt;br /&gt;&lt;br /&gt;The pattern for &quot;Jan de Vries&quot; is&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&quot;Ul+ de Ul+&quot; (Ul+ = upper case letter followed by one or more lower case letters)&lt;/pre&gt;
&lt;p&gt;and the pattern for &quot;Johannes Hubertus van der Laak&quot; is&lt;/p&gt;
&lt;pre&gt;&quot;Ul+ Ul+ van der Ul+&quot;&lt;/pre&gt;
&lt;p&gt;Why require the capitals? People often leave them out, don't they? Yes they do. However, if the restriction on capital letters is dropped, the following sentence&lt;/p&gt;
&lt;pre&gt;john mills the grain.&lt;/pre&gt;
&lt;p&gt;would be lexed as&lt;/p&gt;
&lt;pre&gt;[john mills, the, grain]&lt;/pre&gt;
&lt;p&gt;and this cannot be parsed.&lt;br /&gt;&lt;br /&gt;Remember, the lexer has no knowledge of the syntactic structure of the sentence. If the lexer was integrated in the parser, it might be more flexible and offer different possible interpretations. However, this makes the parsing process more complicated and computationally expensive.&lt;br /&gt;&lt;br /&gt;References&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Proper_noun&quot;&gt;Wikipedia: proper noun&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1429/15</link><pubDate>Sat, 19 May 2012 09:37:54 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1429/15</guid></item><item><title>Answering questions by means of Natural Language Processing</title><description>&lt;p&gt;In the past year I have been working on a framework to allow users to interact with a knowledge base through written natural language. The goal is to provide a simple library that allows you to ask a question in plain english (or some other language) and receive a complete sentence for an answer. I do this in the sparse hours of free time that I have, so the project is a long way from being finished. However, I have now reached the point where the program can make a full round-trip from question to answer for a single question. This is a good moment to write about the choices I made and to explain the process.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:1df67850-a02e-43c1-8a1a-f3caa77dec33/Byron-solo.gif?width=174&amp;amp;height=189&amp;amp;ext=.gif' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;174&quot; height=&quot;189&quot; class=&quot;right-aligned&quot; style=&quot;float:right;margin-left:25px;&quot; /&gt;There are many ways to process a sentence. I am going to describe the one I chose. I am still in the middle of all this, so don't expect a finished product. I wrote it to explain the big picture.&lt;/p&gt;
&lt;p&gt;In this article I will take the following question as an example.&lt;/p&gt;
&lt;pre&gt;How many children had Lord Byron?&lt;/pre&gt;
&lt;p&gt;Follow the article to find out the answer :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2&gt;Understanding&lt;/h2&gt;
&lt;h3&gt;Extract words&lt;/h3&gt;
&lt;p&gt;In the first step the words of the sentence are extracted. I have not found any use for punctuation marks at present so we can discard them. Whether a sentence is a question or a statement will be deduced from the structure of the sentence.&lt;/p&gt;
&lt;p&gt;The product of this step is this:&lt;/p&gt;
&lt;pre&gt;[How, many, children, had, Lord, Byron]&lt;/pre&gt;
&lt;h3&gt;Group lexical items&lt;/h3&gt;
&lt;p&gt;In the next step words that go together are aggregated into &lt;a href=&quot;http://en.wikipedia.org/wiki/Lexical_item&quot;&gt;lexical items&lt;/a&gt;. The goal of this step is to find the smallest possible groups of words that still have a single part-of-speech (noun, verb, determiner, preposition, etc.). This way, &lt;a href=&quot;http://en.wikipedia.org/wiki/Compound_%28linguistics%29&quot;&gt;compounds&lt;/a&gt; like &quot;barbed wire&quot; are now considered to be a single item. I also use this step to find proper nouns (i.e. the names of people, like &quot;Lord Byron&quot;). The words that are found in the lexicon are lowercased, the words that are suspected to be proper nouns are left unchanged (since there is no use to lowercase them, and I would need to uppercase them again in the production phase). This step produces this array of words:&lt;/p&gt;
&lt;pre&gt;[how, many, children, had, Lord Byron]&lt;/pre&gt;
&lt;h3&gt;Parse the words to form a phrase specification&lt;/h3&gt;
&lt;p&gt;This is a big step. It is based on section 11.5 of the book &quot;Speech and language processing&quot; (Jurafsky &amp;amp; Martin) which describes parsing with unification constraints. In this step a syntax tree is created based on the array of words we just found, and a set of production rules like these:&lt;/p&gt;
&lt;pre&gt;S =&amp;gt; WhNP VP NP             (how many children had Lord Byron)&lt;br /&gt;WhNP =&amp;gt; whwordNP NP         (how many children)&lt;br /&gt;NP =&amp;gt; determiner noun       (many children)&lt;br /&gt;VP =&amp;gt; verb                  (had)&lt;br /&gt;NP =&amp;gt; propernoun            (Lord Byron)&lt;/pre&gt;
&lt;p&gt;The parsing grammar has more rules, but these are the ones needed to parse our sentence.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Four choices&lt;/em&gt; were made at this point. I decided to go for &lt;a href=&quot;http://en.wikipedia.org/wiki/Phrase_structure_grammar&quot;&gt;Phrase Structure Grammar&lt;/a&gt;, not &lt;a href=&quot;http://en.wikipedia.org/wiki/Dependency_grammar&quot;&gt;some other grammar&lt;/a&gt;, mainly because the books I happened to read treated this type of grammar much more extensively. Other grammars may work equally well, or even better, though. I chose the &lt;a href=&quot;http://en.wikipedia.org/wiki/Earley_parser&quot;&gt;Earley parser&lt;/a&gt;, because it was said to have the best time efficiency. I have not compared it to other parsers, and those might be better in some instances.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:ebc9cf60-e2f4-4c14-a650-d343f02da075/syntax_tree+how+many+children+had+Lord+Byron.png?width=296&amp;amp;height=172&amp;amp;ext=.png' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;296&quot; height=&quot;172&quot; style=&quot;display:block;margin-left:auto;margin-right:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This tree represents the syntactic aspect of the parse. It &lt;em&gt;does not&lt;/em&gt; show the features that are attached to each of the syntax tree nodes. These features provide both extra syntactic and semantic information. At the &lt;em&gt;same time&lt;/em&gt; the sentence is parsed into a parse tree, the feature structures that are bound to each of the words in the sentence are propagated up the tree via unification with the feature structures of the production rules.&lt;/p&gt;
&lt;p&gt;The third choice I made was to integrate semantic parsing with syntactic parsing. I did this because I figured that producing multiple resulting parse trees was not really very useful. It is a neat feat, but it is not important for my project. One would still need to chose one tree over the other in order to answer the question in the best possible way. So why not try to find the best tree immediately, and leave it at that? Adding semantic constraints to the parse process helps eliminate ambiguous trees, and I needed semantics anyway. So my strategy is to add as many constraints to the parse as I can, and consequently pick the first parse tree that comes out.&lt;/p&gt;
&lt;p&gt;I would like to explain to you the incredible power of feature structures in a single paragraph, but I'm afraid that's impossible. See chapter 11 of Jurafsky &amp;amp; Martin for an extensive explanation. I added feature structures to each of the production rules, like this one:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color:#000000;&quot;&gt;array(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;S&lt;/span&gt;', &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'features' =&amp;gt; array('head-1' =&amp;gt; array('sentenceType' =&amp;gt; 'wh-non-subject-question', 'voice' =&amp;gt; 'active'))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;WhNP&lt;/span&gt;', &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'features' =&amp;gt; array('head' =&amp;gt; array('sem-1' =&amp;gt; null))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;color:#00ffff;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;/span&gt;VP&lt;span style=&quot;color:#000000;&quot;&gt;'&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'features' =&amp;gt; array('head-1' =&amp;gt; array('agreement-1' =&amp;gt; null, 'sem-1' =&amp;gt; array('arg1{sem-2}' =&amp;gt; null)))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;span style=&quot;color:#00ffff;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp; &amp;nbsp; array('cat' =&amp;gt; '&lt;/span&gt;NP&lt;span style=&quot;color:#000000;&quot;&gt;', &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'features' =&amp;gt; array('head' =&amp;gt; array('agreement-1' =&amp;gt; null, 'sem-2' =&amp;gt; null))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;),&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;You will recognize the production rule (S =&amp;gt; WhNP VP NP) when you look at the 'cat' attributes. The array above can be represented like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:122f62d1-60db-4734-b911-f1901885fb17/example+feature+structure.png?width=378&amp;amp;height=158&amp;amp;ext=.png' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;378&quot; height=&quot;158&quot; style=&quot;display:block;margin-left:auto;margin-right:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It really &lt;em&gt;is&lt;/em&gt; as complicated as it looks. Feature structures are not simple. They form a different programming paradigm and require some time to learn. In the feature structure above, &lt;em&gt;S&lt;/em&gt; shares all features of &lt;em&gt;VP&lt;/em&gt;, via the &lt;em&gt;head&lt;/em&gt; node. This means that the &lt;em&gt;VP&lt;/em&gt; is the base node of the structure and the &lt;em&gt;S&lt;/em&gt; inherits all of it, including its &lt;em&gt;sem&lt;/em&gt; (semantics). You can also see that &lt;em&gt;NP&lt;/em&gt; and &lt;em&gt;VP&lt;/em&gt; (via &lt;em&gt;S&lt;/em&gt;&lt;em&gt;) &lt;/em&gt;share &lt;em&gt;agreement.&lt;/em&gt; That is, &lt;em&gt;NP&lt;/em&gt; and &lt;em&gt;VP&lt;/em&gt; should have the same person and number. This makes it impossible that the sentence &quot;How many children has we?&quot; will pass. Finally, you can see that &lt;em&gt;NP&lt;/em&gt; forms the first argument (&lt;em&gt;arg1&lt;/em&gt;) of the predicate expressed by &lt;em&gt;VP&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Now the feature structrures of the constituents &lt;em&gt;WhNP&lt;/em&gt;, &lt;em&gt;VP&lt;/em&gt;, and &lt;em&gt;NP&lt;/em&gt;, are unified with the feature structure of the top level production rule above, and at the same time the sentence's semantics bubbles up from bottom to top.&lt;/p&gt;
&lt;p&gt;Semantics starts at the lowest level, where each word in the language has a feature structure attached to it. Here's an example for the verb 'had' that is used in our example sentence:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;'had' =&amp;gt; array(&lt;br /&gt;    'verb' =&amp;gt; array(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;    'features' =&amp;gt; array(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;    'head' =&amp;gt; array(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;    'tense' =&amp;gt; 'past',&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'sem' =&amp;gt; array('predicate' =&amp;gt; '*have'),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;),&lt;br /&gt;)&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Parsing the sentence creates the following unified feature structure which we will call a &lt;em&gt;phrase specification&lt;/em&gt;.&lt;/p&gt;
&lt;pre&gt;Array&lt;br /&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [head] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [sem] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [predicate] =&amp;gt; *have&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [arg1] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [name] =&amp;gt; Lord Byron&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [arg2] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [category] =&amp;gt; *child&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [determiner] =&amp;gt; *many&lt;br /&gt;                            [question] =&amp;gt; *extent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [tense] =&amp;gt; past&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [sentenceType] =&amp;gt; wh-non-subject-question&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [voice] =&amp;gt; active&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [agreement] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [number] =&amp;gt; s&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [person] =&amp;gt; 3&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;In this specification you see the &lt;em&gt;sem&lt;/em&gt; (semantics) part that describes the predicate and its arguments. All three of them are &lt;em&gt;objects&lt;/em&gt; that have attributes. The arg2 object contains an unknown, a variable, that is the root of the fact that this sentence is, in fact, a question. Next to these semantic aspects there are syntactic aspects, like &lt;em&gt;tense&lt;/em&gt; and &lt;em&gt;voice&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This allows me to explain the fourth choice I made: I don't create a &lt;em&gt;logical representation&lt;/em&gt; of the sentence, but a &lt;em&gt;syntactic-semantic&lt;/em&gt; representation, which is called a &lt;em&gt;phrase specification&lt;/em&gt;. And this type of structure is used moreoften in language &lt;em&gt;generation&lt;/em&gt; than in language understanding. I found the best descriptions of it in the book &quot;Building natural language generation systems&quot; (Reiter &amp;amp; Dale). This structure, which is a combination of syntactic and semantic features, keeps intact the structure of the sentence(!) and saves information about tense, voice, etc. This is all done to make it easier to create the answer, as we will see later on. But first we need to find the actual answer.&lt;/p&gt;
&lt;h2&gt;Finding the answer&lt;/h2&gt;
&lt;h3&gt;Turn the phrase specification into a knowledge base representation&lt;/h3&gt;
&lt;p&gt;Now that we have the question, we need to find the answer. Luckily, these days you can find many Open Data knowledge bases on the internet that have publicly, and even free, accessible interfaces! I used one of them which I will not disclose at this point. It has a &lt;a href=&quot;http://en.wikipedia.org/wiki/Sparql&quot;&gt;SPARQL&lt;/a&gt; interface. So I wrote a function that turns the phrase specification above into a SPARQL query:&lt;/p&gt;
&lt;pre&gt;SELECT &lt;strong&gt;COUNT&lt;/strong&gt;(&lt;em&gt;?id151&lt;/em&gt;) WHERE {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;?id193 &amp;lt;http://some_enormous_database.net/object/&lt;strong&gt;child&lt;/strong&gt;&amp;gt; &lt;em&gt;?id151&lt;/em&gt; .&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;?id193 rdfs:label '&lt;strong&gt;Lord Byron&lt;/strong&gt;'@en&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;This knowledge base returns a data structure that tells me that the answer is:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:left;&quot;&gt;&lt;span style=&quot;font-size:large;&quot;&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:left;&quot;&gt;&lt;span style=&quot;font-size:small;&quot;&gt;The children were called Ada and Allegra &lt;a href=&quot;http://en.wikipedia.org/wiki/Lord_byron&quot;&gt;[1]&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:left;&quot;&gt;&lt;img title=&quot;Ada Byron (later: Ada Lovelace)&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:3beb50eb-d9de-456e-a8f7-9c0db4617939/ada.jpg?width=226&amp;amp;height=227&amp;amp;ext=.jpg' alt=&quot;Ada Byron (later: Ada Lovelace)&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;226&quot; height=&quot;227&quot; /&gt;&lt;img title=&quot;Allegra Byron&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:aea5dec3-e14f-4e8f-8449-7082109177f0/allegra+byron.jpg?width=180&amp;amp;height=226&amp;amp;ext=.jpg' alt=&quot;Allegra Byron&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;180&quot; height=&quot;226&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:left;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Would it have been easier to turn our question into a SPARQL query if the representation had been a set of logical propositions? Probably not. You see, there are many ways to represent semantic information. For a simple example, the relation&amp;nbsp;&lt;em&gt;child(x, y)&lt;/em&gt; could&amp;nbsp; have been represented as &lt;em&gt;father(y, x)&lt;/em&gt;. Other representations are even more different. So there will always be a conversion step between &lt;em&gt;our&lt;/em&gt; way of representing relations and the way the knowledge base represents relations, except in the case that you write your parser uniquely for this specific knowledge base. I wanted to write a more generic framework that allowed the use different knowledge bases.&lt;/p&gt;
&lt;h2&gt;Generation&lt;/h2&gt;
&lt;h3&gt;Integrate the answer into the phrase specification of the question&lt;/h3&gt;
&lt;p&gt;I would like to have the language processor give me the answer in a full sentence. We start by filling in the the answer that the knowledge base gave us into the phrase specification:&lt;/p&gt;
&lt;pre&gt;Array&lt;br /&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [head] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [sem] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [predicate] =&amp;gt; *have&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [arg1] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [name] =&amp;gt; Lord Byron&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [arg2] =&amp;gt; Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [category] =&amp;gt; *child&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [determiner] =&amp;gt; &lt;strong&gt;2&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [tense] =&amp;gt; past&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [sentenceType] =&amp;gt; &lt;strong&gt;declarative&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [voice] =&amp;gt; active&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;)&lt;/pre&gt;
&lt;p&gt;We modify the existing phrase specification, and fill the variable. Then we change the sentenceType from &lt;em&gt;question&lt;/em&gt; to &lt;em&gt;declarative&lt;/em&gt; and we're done. This is important. We don't need to think of a sentence structure to express the knowledge we have. It's already there. It's like performing &lt;a href=&quot;http://en.wikipedia.org/wiki/Jujutsu&quot;&gt;Jiu jitsu&lt;/a&gt; on the question: use its own strength against it.&lt;/p&gt;
&lt;h3&gt;Generate a sequence of lexical items from this phrase specification&lt;/h3&gt;
&lt;p&gt;Now we need to go the opposite way. We need to create a string of words from a tree structure. That seems easy. Just use the same production rules in the reverse order. Unfortunately it is not that simple. The production rules can be used, but the feature structures need to change. I found two reasons for this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Generation is not a search process. If you don't specify which rules to use for generation, the processor will &lt;em&gt;try&lt;/em&gt; many possible paths that will fail. This is a big waste of time!&lt;/li&gt;
&lt;li&gt;Many feature structures used for understanding just pass meaning up to the node above. If this process is reversed the meaning stays the same, and this will cause an infinite loop for recursive rules like NP =&amp;gt; NP PP.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The essential difference between &lt;em&gt;understanding&lt;/em&gt; and &lt;em&gt;generation&lt;/em&gt; is:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Understanding is about &lt;em&gt;hypotheses management&lt;/em&gt;, while generation is about &lt;em&gt;choice&lt;/em&gt;.&quot;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;(free, after Speech and Language processing, p. 766)&lt;/p&gt;
&lt;p&gt;Generation is a process of hierarchical choices: each choice is based on a part of the phrase specification. Let's start at the top. I will show you the top-level production rule I use to generate the answer to the question:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color:#000000;&quot;&gt;array(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'condition' =&amp;gt; array('head' =&amp;gt; array('sentenceType' =&amp;gt; 'declarative', 'voice' =&amp;gt; 'active')),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'rule' =&amp;gt; array(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;S&lt;/span&gt;', 'features' =&amp;gt; array('head' =&amp;gt; array('tense-1' =&amp;gt; null, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sem' =&amp;gt; array('predicate-1' =&amp;gt; null, 'arg1-1' =&amp;gt; null, 'arg2-1' =&amp;gt; null)))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;NP&lt;/span&gt;', 'features' =&amp;gt; array('head' =&amp;gt; array('agreement-2' =&amp;gt; null, 'tense-1' =&amp;gt; null, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sem{arg1-1}' =&amp;gt; null))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;VP&lt;/span&gt;', 'features' =&amp;gt; array('head' =&amp;gt; array('agreement-2' =&amp;gt; null, 'tense-1' =&amp;gt; null, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'sem' =&amp;gt; array('predicate-1' =&amp;gt; null)))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array('cat' =&amp;gt; '&lt;span style=&quot;color:#00ffff;&quot;&gt;NP&lt;/span&gt;', 'features' =&amp;gt; array('head' =&amp;gt; array('sem{arg2-1}' =&amp;gt; null))),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;),&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The structure has two parts: a &lt;em&gt;condition&lt;/em&gt;, and a &lt;em&gt;rule&lt;/em&gt;. Only if the condition matches, when it is unified with the partial phrase specification, the rule is used to generate part of the syntax tree. The feature structure is different from the rule we saw earlier: it makes sure that meaning is &lt;em&gt;distributed&lt;/em&gt; over the consequents. Generation is a recursive process, like understanding. First the S node is matched to the rule I just mentioned and the top-level phrase specification is unified with the feature structure of the rule. Then the process is repeated for the NP, VP and NP. And so on, until the lexical items are found.&lt;/p&gt;
&lt;p&gt;While the &lt;em&gt;understanding&lt;/em&gt; rules are ordered by frequency of occurrance, &lt;em&gt;generation&lt;/em&gt; rules are ordered by decreasing specificity. The top ones have more conditions.&lt;/p&gt;
&lt;p&gt;The result of this process is an array of lexical items:&lt;/p&gt;
&lt;pre&gt;[Lord Byron, had, 2, children]&lt;/pre&gt;
&lt;h3&gt;Punctuation and capitalization&lt;/h3&gt;
&lt;p&gt;To form a proper sentence, it should start with a capital letter (which it already had in our example) and end with a period:&lt;/p&gt;
&lt;pre&gt;Lord Byron had 2 children.&lt;/pre&gt;
&lt;p&gt;That's what we wanted to hear :)&lt;/p&gt;
&lt;h3&gt;Books&lt;/h3&gt;
&lt;p&gt;The material above I found in these books. The books allow many alternative routes to follow, none of which are worked out to a great extent. After you read them, you will have some idea where to go, however.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Speech and language processing, Daniel Jurafsky &amp;amp; James H. Martin (2000)&lt;/li&gt;
&lt;li&gt;Building natural language generation systems, Ehud Reiter and Robert Dale (2000)&lt;/li&gt;
&lt;/ul&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1428/15</link><pubDate>Mon, 30 Apr 2012 10:07:06 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1428/15</guid></item><item><title>Change syntax rules to facilitate semantics?</title><description>&lt;p&gt;It may be useful to change the way phrase structure rules are built when dealing with semantics analysis and production.&lt;/p&gt;&lt;p&gt;The sentence&lt;/p&gt;
&lt;pre&gt;Lord Byron was influenced by the author of Paradise Lost&lt;/pre&gt;
&lt;p&gt;is usually parsed like this:&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:41f860c4-e425-4c90-8763-d8c5973e1dec/deep+tree.png?width=500&amp;amp;height=184&amp;amp;ext=.png' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;500&quot; height=&quot;184&quot; style=&quot;display:block;margin-left:auto;margin-right:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;(thanks to &lt;a href=&quot;http://ironcreek.net/phpsyntaxtree/&quot;&gt;phpSyntaxTree&lt;/a&gt; for the image)&lt;/p&gt;
&lt;p&gt;But when analyzing the semantics of the sentence, it is somewhat awkward.&lt;/p&gt;
&lt;pre&gt;&lt;strong&gt;predicate&lt;/strong&gt;: influenced&lt;br /&gt;&lt;strong&gt;first argument&lt;/strong&gt;: the author of Paradise Lost&lt;br /&gt;&lt;strong&gt;second argument&lt;/strong&gt;: Lord Byron&lt;/pre&gt;
&lt;p&gt;(It is a passive sentence, subject and object are reversed.) The related semantic parts are distributed over the sentence.&lt;/p&gt;
&lt;p&gt;When generating the sentence from the semantic specification, this becomes even more complicated.&lt;/p&gt;
&lt;p&gt;Things can be made easier by just changing the phrase structure rules:&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:1527001d-768c-48f0-bf63-d3c4ef0dc4d3/flat+tree.png?width=475&amp;amp;height=151&amp;amp;ext=.png' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;475&quot; height=&quot;151&quot; style=&quot;display:block;margin-left:auto;margin-right:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This may make Chomsky frown, but it works perfectly well for both parsing and generating. The predicate and its two arguments can be rewritten using the same rule. In passive sentences, the word &quot;by&quot; is not &lt;em&gt;just another preposition&lt;/em&gt;, it is a structural part of the passivization of the sentence. All passive sentences (that name the agent of the action) have it.&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1427/15</link><pubDate>Sat, 31 Mar 2012 23:20:30 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1427/15</guid></item><item><title>Auxiliaries</title><description>&lt;p&gt;When I add production rules I only create the ones I really need for the moment. However, I want to create them in such a way that future extensions will be easy to make. So I decided to make a little study of the structure of auxiliaries. The table below is the result of that.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;A typical natural language production rule looks like this:&lt;/p&gt;
&lt;pre&gt;S =&amp;gt; NP VP&lt;/pre&gt;
&lt;p&gt;for a declarative language, or&lt;/p&gt;
&lt;pre&gt;S =&amp;gt; aux NP VP&lt;/pre&gt;
&lt;p&gt;for a question.&lt;/p&gt;
&lt;p&gt;S = sentence, NP = noun phrase, VP = verb phrase, aux = auxiliary.&lt;/p&gt;
&lt;p&gt;In this case aux is rewritten by a single word: did, can, or will. When I tried to parse more complicated sentences I stumbled over the fact that the aux part was not a simple part-of-speech, but rather a phrase on its own; it can consist of multiple words.&lt;/p&gt;
&lt;p&gt;Be careful when using this table: I am not a language specialist. Just a programmer. Although I tried very hard not to make mistakes, some combinations of grammatical categories seemed far fetched (i.e. &quot;John used to be being bitten by a dog&quot;) and I had to use &lt;a href='http://www.google.com/search?q=&quot;used+to+be+being+bitten&quot;&amp;amp;oq=&quot;used+to+be+being+bitten&quot;'&gt;Google&lt;/a&gt; to find out if such a combination is being used at all. And even though I didn't add sentences I could not find via Google, some of them were very rare and may have been errors by the users of the language.&lt;/p&gt;
&lt;table border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot;&gt;&lt;caption&gt;Auxiliaries&lt;/caption&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Mood&lt;/td&gt;
&lt;td&gt;Voice&lt;/td&gt;
&lt;td&gt;Aspect&lt;/td&gt;
&lt;td&gt;Nonmodal&lt;/td&gt;
&lt;td&gt;Modal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td rowspan=&quot;2&quot;&gt;declarative&lt;/td&gt;
&lt;td&gt;active&lt;/td&gt;
&lt;td&gt;simple&lt;br /&gt;simple, progressive&lt;br /&gt;perfect&lt;br /&gt;perfect, progressive&lt;br /&gt;habitual&lt;br /&gt;habitual, progressive&lt;br /&gt;prospective&lt;br /&gt;prospective, progressive&lt;/td&gt;
&lt;td&gt;&lt;em&gt;A dog &lt;span style=&quot;color:#00ffff;&quot;&gt;bites&lt;/span&gt;&lt;/em&gt; John.&lt;br /&gt;&lt;em&gt; A dog&lt;/em&gt; &lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;is&lt;/span&gt;&lt;/em&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;has&lt;/span&gt;&lt;/em&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;has&lt;/em&gt; been&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;is&lt;/em&gt; going to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;is&lt;/em&gt; going to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;/td&gt;
&lt;td&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt;&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt;&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt;&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have been&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have used to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt; &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have used to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt;&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John.&lt;br /&gt;&lt;em&gt;A dog&lt;/em&gt;&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to be&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;passive&lt;/td&gt;
&lt;td&gt;simple&lt;br /&gt;simple, progressive&lt;br /&gt;perfect&lt;br /&gt;perfect, progressive&lt;br /&gt;habitual&lt;br /&gt;habitual, progressive&lt;br /&gt;prospective&lt;br /&gt;prospective, progressive&lt;/td&gt;
&lt;td&gt;John &lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;is&lt;/span&gt;&lt;/em&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;is&lt;/em&gt; being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;has&lt;/em&gt; been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;has&lt;/em&gt; been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;is&lt;/em&gt; going to have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;is&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;&lt;/em&gt; going to have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;/td&gt;
&lt;td&gt;John&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John&amp;nbsp;&lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;br /&gt;John &lt;span style=&quot;color:#ff99cc;&quot;&gt;may&lt;/span&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt; going to have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td rowspan=&quot;2&quot;&gt;interrogative&lt;/td&gt;
&lt;td&gt;active&lt;/td&gt;
&lt;td&gt;simple&lt;br /&gt;simple, progressive&lt;br /&gt;perfect&lt;br /&gt;perfect, progressive&lt;br /&gt;habitual&lt;br /&gt;habitual, progressive&lt;br /&gt;prospective&lt;br /&gt;prospective, progressive&lt;/td&gt;
&lt;td&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Does&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Has&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Has&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;been&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Did&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Did&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;going to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;going to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have been&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have used to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;have used to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to&lt;/span&gt; &lt;span style=&quot;color:#ff00ff;&quot;&gt;bite&lt;/span&gt; John?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; &lt;em&gt;a dog&lt;/em&gt; &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to be&lt;/span&gt; &lt;span style=&quot;color:#00ff00;&quot;&gt;biting&lt;/span&gt; John?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;passive&lt;/td&gt;
&lt;td&gt;simple&lt;br /&gt;simple, progressive&lt;br /&gt;perfect&lt;br /&gt;perfect, progressive&lt;br /&gt;habitual&lt;br /&gt;habitual, progressive&lt;br /&gt;prospective&lt;br /&gt;prospective, progressive&lt;/td&gt;
&lt;td&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Has&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Has&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Did&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Did&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;used to be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;going to have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;em&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;Is&lt;/span&gt;&lt;/em&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;em&gt;&lt;/em&gt; going to have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;/td&gt;
&lt;td&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John&amp;nbsp;&lt;span style=&quot;color:#ff0000;&quot;&gt;have used to be&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;have used to be being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;be going to have been&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;Can&lt;/span&gt; John &lt;span style=&quot;color:#ff0000;&quot;&gt;be&lt;/span&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt; going to have been being&lt;/span&gt; &lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; by &lt;em&gt;a dog&lt;/em&gt;?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Legend&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;For each color used, I give an example and the meaning of the word group.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color:#00ff00;&quot;&gt;&lt;span style=&quot;color:#00ffff;&quot;&gt;bites&lt;/span&gt;&lt;span style=&quot;color:#000000;&quot;&gt; = simple present (verb form)&lt;/span&gt;&lt;br /&gt;biting&lt;/span&gt; = present participle&lt;span style=&quot;color:#00ff00;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt; (verb form)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#3366ff;&quot;&gt;bitten&lt;/span&gt; = past participle&lt;span style=&quot;color:#00ff00;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt; (verb form)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:#ff00ff;&quot;&gt;&lt;br /&gt;bite&lt;/span&gt;&lt;span style=&quot;color:#000000;&quot;&gt; = infinitive&lt;span style=&quot;color:#00ff00;&quot;&gt;&lt;span style=&quot;color:#000000;&quot;&gt; (verb form)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#ff99cc;&quot;&gt;could&lt;/span&gt; = modal auxilliary&lt;br /&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;is going to&lt;/span&gt; = primary auxiliary (&lt;em&gt;italic&lt;/em&gt; = modify for tense, person, number)&lt;/p&gt;
&lt;h3&gt;Verb forms&lt;/h3&gt;
&lt;p&gt;A verb has different forms, and these are important with respect to these sentences.&lt;br /&gt;Possible values: simple present, simple past, present participle, past participle, infinitive&lt;br /&gt;Reference:&lt;a href=&quot;http://www.chompchomp.com/terms/participle.htm&quot;&gt; Participle - Chomp chomp&lt;/a&gt;, &lt;a href=&quot;http://www.englishclub.com/grammar/verbs-verb-forms_main.htm&quot;&gt;Word forms (simple, participle, infinitive) - English Club&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Grammatical categories&lt;/h3&gt;
&lt;p&gt;The auxiliaries in the table have been grouped by grammatical category combination. Some of these categories were new to me too, so it is probably a good idea that I explain them. And while I'm at it, I may as well name the link with their semantic counterparts.&lt;/p&gt;
&lt;h4&gt;Mood&lt;/h4&gt;
&lt;p&gt;The mood of a sentence is the main structure, and is represented by a production rule with S at the left hand. &lt;br /&gt;Typical values: declarative (statement), interrogative (question), imperative (demand)&lt;br /&gt;Meaning: the mood determines the speakers attitude toward that what they are saying.&lt;br /&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Grammatical_mood&quot;&gt;Grammatical mood - Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Voice&lt;/h4&gt;
&lt;p&gt;In which position do we find the agent of the sentence? In the subject position (active) or in the direct object position (passive)&lt;br /&gt;Typical values: passive, active&lt;br /&gt;Meaning: the subject position determines the focus of the sentence&lt;br /&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Grammatical_voice&quot;&gt;Grammatical voice - Wikipedia&lt;/a&gt;, &lt;a href=&quot;http://humanityisfirst.blogspot.com/2011/09/active-and-passive-voice.html&quot;&gt;Examples of active and passive voice - Helping hands&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Tense&lt;/h4&gt;
&lt;p&gt;When did the event or state in the sentence occur? Or: temporally when.&lt;br /&gt;Typical values: past, present and future&lt;br /&gt;Meaning: tense determines the time of the event, relative to the present moment&lt;br /&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Grammatical_tense&quot;&gt;Grammatical tense - Wikipedia&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Perfect_tense&quot;&gt;Perfect tense - Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Aspect&lt;/h4&gt;
&lt;p&gt;The the internal temporal constituency of a situation. Or: temporally how.&lt;br /&gt;Typical values: simple (happens now, &quot;a dog bites john&quot;), progressive (ongoing: &quot;a dog is biting John&quot;), perfect (completed event, &quot;a dog has bitten John&quot;), habitual (customary, &quot;a dog used to bit John&quot;), prospective (future, &quot;a dog is going to bite&quot;)&lt;br /&gt;Meaning: aspect is a specification of the tense aspect, and determines the period of time &lt;em&gt;within&lt;/em&gt; the range specified by tense&lt;br /&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Grammatical_aspect&quot;&gt;Grammatical aspect - Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Modality&lt;/h4&gt;
&lt;p&gt;The proposition the speaker wishes to make with respect to the &lt;br /&gt;Typical values: can, will, must&lt;br /&gt;Meaning: &lt;em&gt;will&lt;/em&gt; specifies that the event takes place in the future,&amp;nbsp;&lt;em&gt;can&lt;/em&gt; specifies that the event is possible, not certain, &lt;em&gt;must&lt;/em&gt; specifies that the event is required.&lt;br /&gt;Reference: &lt;a href=&quot;http://en.wikipedia.org/wiki/Linguistic_modality&quot;&gt;Linguistic modality - Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Conclusive remarks&lt;/h3&gt;
&lt;p&gt;When creating production rules, remember that these sentences may need to be negated as well (&quot;John may &lt;em&gt;not&lt;/em&gt; have been bitten by a dog&quot;). Further, in the examples I have only used the &lt;em&gt;present tense&lt;/em&gt;, using the &lt;em&gt;third person&lt;/em&gt;, in the &lt;em&gt;singular&lt;/em&gt;. An example of a &lt;em&gt;first person, plural &lt;em&gt;(a dog =&amp;gt; we)&lt;/em&gt;, past tense&lt;/em&gt; (bites =&amp;gt; bit) sentence would be:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;We &lt;span style=&quot;color:#00ffff;&quot;&gt;bit&lt;/span&gt;&lt;/em&gt; John&lt;br /&gt;&lt;br /&gt;I formatted all words that need to change to account for these three grammatical categories in &lt;em&gt;italic&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chompchomp.com/terms/auxiliaryverb.htm&quot;&gt;Auxilliary verb - Chomp chomp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Auxiliary_verb&quot;&gt;Auxiliary verb - Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1426/15</link><pubDate>Sat, 31 Mar 2012 23:20:38 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1426/15</guid></item><item><title>Implementation of an Earley parser with unification</title><description>&lt;p&gt;I just completed a PHP implementation of the Earley parser, extended with unification, that is described in the book &amp;quot;Speech and Language Processing&amp;quot; by Jurafsky and Martin. I thought it might be a good idea to share my code since it took me quite some time and effort to create it and, what&amp;#039;s more important, I could not find any other implementation of it on the internet.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The Earley algorithm is a top-down chart parser that parses natural language and does this very efficiently. Given a grammar that contains syntax rules and the words of a language, it parses a sentence into all possible syntax trees. The unification extension adds further restrictions to the syntax rules. An example of such a restriction is that the rule S =&amp;gt; NP VP only applies if the number and person of the NP agrees with that of the VP. When NP is &quot;The children&quot;, then the VP may be &quot;are playing&quot;, but cannot be &quot;is playing&quot; (a restriction on number) or &quot;am playing&quot; (a restriction on person). The grammar should provide extra feature structures for the syntax rules. The unification extension of the Earley parser applies these structures and ensures that a sentence with a feature error will not be parsed.&lt;br /&gt;&lt;br /&gt;I just provide the code to give you some idea and hints on to implement it. The code has not been tested very much since I just finished it. I place it under MIT license.&lt;/p&gt;
&lt;p&gt;&lt;a href='http://www.garfixia.nl/l/library/download/urn:uuid:cb39e072-fae1-4c3a-8191-cb9db0ddba6c/earley+source.zip?format=save_to_disk&amp;amp;ext=.zip'&gt;Earley parser source code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The algorithm may be found in the book &quot;Speech and language Processing&quot; (first edition), chapter 11, page 431. In the second edition of the book the algorithm may be found in chapter 15. The rest of this article presumes you have read it, since I cannot quickly repeat all the information given in chapter 11.&lt;br /&gt;&lt;br /&gt;The book first describes the basic Earley algorithm, which can be found &lt;a href=&quot;http://en.wikipedia.org/wiki/Earley_parser&quot;&gt;on Wikipedia&lt;/a&gt;. Some implementations are available there as well. It is described in chapter 10 of the book but can be hard to really understand it, because of the undescriptive use of variable names like A and B, and that it uses two functions that are not specified, NEXT-CAT and PARTS-OF-SPEECH.&lt;/p&gt;
&lt;h2&gt;Syntax rules and feature structures&lt;/h2&gt;
&lt;p&gt;For the basic algorithm I use syntax rules like the following S =&amp;gt; NP VP&lt;/p&gt;
&lt;pre&gt;array(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'S'),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'NP'),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'VP'),&lt;br /&gt;),&lt;/pre&gt;
&lt;p&gt;The same rule, extended with feature structures looks like this:&lt;/p&gt;
&lt;pre&gt;array(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'S', 'features' =&amp;gt; array('head-1' =&amp;gt; null)),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'NP', 'features' =&amp;gt; array('head' =&amp;gt; array('agreement-2' =&amp;gt; null))),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array('cat' =&amp;gt; 'VP', 'features' =&amp;gt; array('head-1' =&amp;gt; array('agreement-2' =&amp;gt; null))),&lt;br /&gt;),&lt;/pre&gt;
&lt;p&gt;This implements the feature structure that is described on page 428 of the book:&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:ddb69947-5c5f-4cc3-a011-bf5fe9a2240d/feature+structure.jpg?width=279&amp;amp;height=151&amp;amp;ext=.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;279&quot; height=&quot;151&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Features of the implementation&lt;/h2&gt;
&lt;p&gt;The implementation of the algorithm handles unification for syntax rules like this,&lt;/p&gt;
&lt;pre&gt;VP =&amp;gt; NP NP&lt;/pre&gt;
&lt;p&gt;as described on the bottom of page 406. The rule as two identical consequents. If the grammatical categories of the rule are implemented as keys in a hashtable (as they are in my code) then they need to be discerned. I do that by adding the position of the category in the rule.&lt;br /&gt;&lt;br /&gt;The book says: VP =&amp;gt; NP(1) NP(2)&lt;br /&gt;&lt;br /&gt;in the implementation it looks like this: VP@0 =&amp;gt; NP@1 NP@2 (but you don't need to think about this when you write the syntax rules)&lt;br /&gt;&lt;br /&gt;It also deals with rules like this NP =&amp;gt; NP PP where one consequent is identical to the antecedent.&lt;/p&gt;
&lt;h2&gt;Remarks on the algorithm&lt;/h2&gt;
&lt;p&gt;The meaning of the function &quot;FOLLOW-PATH&quot; is not described in the book, but I presume that it means that it returns a subset of its argument. It starts out with the label &quot;cat&quot; and follows it to the end.&lt;br /&gt;&lt;br /&gt;The function &quot;UNIFY-STATES&quot; of the original algorithm performed a &quot;FOLLOW-PATH&quot; of &quot;dag2&quot;. I think this is an error in the algorithm, because it would corrupt the feature set of the charted state. &lt;br /&gt;&lt;br /&gt;My version of unifyStates is also somewhat different since I take into account that a rule may have the same category at different positions (as in the VP =&amp;gt; NP NP example).&lt;/p&gt;
&lt;h2&gt;Labeled DAGs&lt;/h2&gt;
&lt;p&gt;Unifying DAGs is a very elegant to implement unification. I could not follow the explanation of the unification process as described on page 423, unfortunately. That's why I decided to create a different implementation of this function. I introduced a class to separate the logic of the datastructure: LabeledDAG, a labeled directed acyclic graph (or DAG). Which reminds me to thank my employer at &lt;a href=&quot;http://www.procurios.nl/&quot;&gt;Procurios&lt;/a&gt;, Bert Slagter, for inadvertently providing me with a perfect datastructure for this task.&lt;/p&gt;
&lt;h2&gt;Finally&lt;/h2&gt;
&lt;p&gt;I also added the possibility to stop parsing when the first complete sentence is found. For some applications you are only interested in a single interpretation; it might as well be the first one, especially if you succeed to order your syntax rules in such a way that the best interpretation is found first.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1425/15</link><pubDate>Sat, 31 Mar 2012 23:20:46 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1425/15</guid></item><item><title>Geld naar Wikipedia</title><description>&lt;p&gt;Ik heb maar eens wat geld overgemaakt naar Wikipedia. Waarom niet? Het is een briljant concept met een geweldige uitwerking en ik hoop dat het nog lang mag bestaan.&lt;/p&gt;
&lt;p&gt;&lt;a href='http://www.garfixia.nlhttps://wikimediafoundation.org/wiki/Support_Wikipedia/en'&gt;&lt;img src='http://www.garfixia.nl//upload.wikimedia.org/wikipedia/commons/4/4b/Fundraising_2009-square-treasure-en.png' alt=&quot;Support Wikipedia&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1424/15</link><pubDate>Wed, 23 Nov 2011 20:49:36 +0100</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1424/15</guid></item><item><title>Sense and reference in an NLP parser</title><description>&lt;p&gt;Consider this short story.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;George Bush was lazy. When I called him he just ignored me. But when I was sad he always comforted me. Gosh, I loved that cat.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It is tempting to resolve an obvious reference directly. So when the name &quot;George Bush&quot; comes along you look up entity by that name in the knowledge base and directly attach the new statement to it.&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:4f59c46c-10f3-4481-b9fa-ff0d524a779e/bush1.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;409&quot; height=&quot;171&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But when we continue the story, the former president of the US of A will have an even stranger predicate attached:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:0ed194ac-ca50-4f7b-8bd7-dc5c69b68150/bush2.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;625&quot; height=&quot;171&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is obviously a bad idea. So what we need to do is create a temporary object within our context of discourse to which we add the predicates and to which we add the most likely external reference:&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:55c9d791-c38d-46e2-8823-b46130f8fe3f/bush3.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;673&quot; height=&quot;382&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This implementation reminds me of the distinction between &lt;a href=&quot;http://en.wikipedia.org/wiki/Sense_and_reference&quot;&gt;sense and reference&lt;/a&gt;. The &lt;em&gt;reference&lt;/em&gt; of a word is the object it denotes in the world. The &lt;em&gt;sense&lt;/em&gt; of a word is the cognitive representation of the object in an agent. In our case both sense and reference are representations. But one of them, reference, is more absolute. The sense of a word is here an object in &lt;em&gt;working memory&lt;/em&gt; whereas the reference of a word is an object in &lt;em&gt;long term memory&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Now when the last sentence is parsed, we will drop the external reference when we find out we are in error (how we do this is another story). The temporary object can later be added as a new entry to our knowledge base. A second entry with the name George Bush.&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:f967a167-ebfd-4568-bb7f-3660b77f8827/bush4.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;649&quot; height=&quot;169&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Naming a cat after George Bush is not as unlikely as it may seem. George Bush loves cats. And no, we don't call George Bush a cat. We're not hippies.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:34788e48-cb34-46f7-9230-8375cbda3904/george-bush-eats-a-kitten.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;400&quot; height=&quot;344&quot; style=&quot;display:block;margin-left:auto;margin-right:auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am reading &quot;Linguistic Semantics&quot; by William Frawley. A wonderful book full of new ideas.&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1422/15</link><pubDate>Sun, 18 Sep 2011 21:15:12 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1422/15</guid></item><item><title>Semantic analysis: predicates and arguments</title><description>&lt;p&gt;One of the things that is needed for the semantic analysis of a sentence is the extraction of its predicates and their arguments. When I was trying to find out how to do this, I came by several linguistic techniques that are involved in this task. I thought it might be interesting for you to see what&amp;#039;s available in this field. It was certainly interesting to me and it even made me understand some of the stuff that always troubled me in high school :)&lt;/p&gt;&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Let's start with an example. Take this simple sentence:&lt;/p&gt;
&lt;pre&gt;John Milton wrote Paradise Lost.&lt;/pre&gt;
&lt;p&gt;Using &lt;a href=&quot;http://en.wikipedia.org/wiki/First-order_logic&quot;&gt;predicate logic&lt;/a&gt; we can write this sentence as follows:&lt;/p&gt;
&lt;pre&gt;write(john-milton, paradise-lost)&lt;/pre&gt;
&lt;p&gt;This representation of the sentence has the advantage that it can be stored easily in a relational database. Note that the paste tense has been lost in this representation. Also note that the token 'john-milton' is a constant that represents that which is named &quot;John Milton&quot; in the english sentence. And finally notice that 'write' has two arguments (or variables): the first one is assigned to john-milton, the second to paradise-lost. At this point it is not clear why there are two arguments and not three or four. Also it is not clear why john-milton needs to be in the first position and paradise-lost in the second.&lt;br /&gt;&lt;br /&gt;But the actual sentence I want to be able to parse is:&lt;/p&gt;
&lt;pre&gt;John Milton wrote Paradise Lost in the sixteen fifties.&lt;/pre&gt;
&lt;p&gt;The sentence is true. &lt;a href=&quot;http://www4.uwm.edu/libraries/special/exhibits/clastext/clspg117.cfm&quot;&gt;Many scholars guess&lt;/a&gt; the epic poem is written in London around 1650-1660.&lt;br /&gt;&lt;br /&gt;Syntactically, this sentence looks like this:&lt;/p&gt;
&lt;pre&gt;S&lt;br /&gt;+-- NP&lt;br /&gt;|&amp;nbsp;&amp;nbsp; +-- noun: John Milton&lt;br /&gt;|&lt;br /&gt;+-- VP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- verb: wrote&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- NP&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;+-- NP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; +-- noun: Paradise Lost&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- PP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- preposition: in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- NP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- determiner: the&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +-- noun: sixteen fifties&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;This sentence doesn't fit predicate logic well, because we cannot simply add extra first-order sentences to represent the extra information (&quot;in the sixteen fifties&quot;).&lt;br /&gt;&lt;br /&gt;But let's try anyway:&lt;/p&gt;
&lt;pre&gt;write(john-milton, paradise-lost, decade-1650)&lt;/pre&gt;
&lt;p&gt;This looks good, but what would the following sentence look like?&lt;/p&gt;
&lt;pre&gt;John Milton wrote Paradise Lost in London.&lt;/pre&gt;
&lt;pre&gt;write(john-milton, paradise-lost, london)&lt;/pre&gt;
&lt;p&gt;No that can't be right because that is the position where &lt;em&gt;time&lt;/em&gt; used to be.&lt;/p&gt;
&lt;h2&gt;Predicate logic&lt;/h2&gt;
&lt;p&gt;A representation that solves this problem is like this:&lt;/p&gt;
&lt;pre&gt;isa(e, writing)&lt;br /&gt;writer(e, john-milton)&lt;br /&gt;writee(e, paradise-lost)&lt;br /&gt;time(e, decade-1650)&lt;/pre&gt;
&lt;p&gt;As you can see an extra constant 'e' (for event) is introduced to link the different sentences together. But that's not all: along with e comes the constant 'writing', and the predicates 'isa', 'writer', 'writing', and 'time'.&lt;br /&gt;&lt;br /&gt;What happens here is that the single predicate 'write' is split up and the concept of &lt;em&gt;role&lt;/em&gt; is introduced. Each of the arguments of the predicate gets its own role and each of these roles is given a predicate. For example, argument 1 in the original predicate of 'write' now has the role of 'writer' and argument 2 has the role of 'writee'. By naming the roles explicitly rather than implictly it is possible to extend them arbitrarily. We can now add both 'time' and 'place' as extra roles.&lt;br /&gt;&lt;br /&gt;However, calling these roles 'writer' and 'writee' is suboptimal. These roles can only be used in relation to the predicate 'write'. Whereas the role 'time' can be used to compare very different types of events, the role of 'writer' can only be used in the context of writing. Changing this role to 'agent' would generalize it and allows it to be used in a survey of all events in which a given person was the agent, for example. And the fact that the person is a writer can still be deducted from the fact that he or she is the agent in the event of 'writing'.&lt;br /&gt;&lt;br /&gt;If we follow this reasoning, we end up with:&lt;/p&gt;
&lt;pre&gt;isa(e, writing)&lt;br /&gt;agent(e, john-milton)&lt;br /&gt;patient(e, paradise-lost)&lt;br /&gt;time(e, decade-1650)&lt;/pre&gt;
&lt;p&gt;The question arises what this finite set of roles can be.&lt;/p&gt;
&lt;h2&gt;Scholastic semantic analysis&lt;/h2&gt;
&lt;p&gt;In school we are taught that a sentence can be analysed in two ways: syntactically (in Dutch: taalkundige analyse) and semantically (redekundige analyse). Semantic analysis labels the parts of the sentence as &lt;a href=&quot;http://en.wikipedia.org/wiki/Subject_%28grammar%29&quot;&gt;'subject'&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Predicate_%28grammar%29&quot;&gt;'predicate'&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Object_%28grammar%29&quot;&gt;'object'&lt;/a&gt;, 'complement', and &lt;a href=&quot;http://en.wikipedia.org/wiki/Adjunct_%28grammar%29&quot;&gt;'adjunct'&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Our sentence is analysed as:&lt;/p&gt;
&lt;pre&gt;subject: john-milton&lt;br /&gt;predicate: write&lt;br /&gt;object: paradise-lost&lt;br /&gt;adjunct: decade-1650&lt;/pre&gt;
&lt;p&gt;This analysis produces general roles for the arguments in the sentence (subject, predicate, etc.). Several refinements of the roles are discerned, like 'infinitive' and 'indirect object' These roles keep very close to the surface form, however. This is especially true for passive sentences like:&lt;/p&gt;
&lt;pre&gt;Paradise Lost was written by John Milton in the sixteen fifties.&lt;/pre&gt;
&lt;p&gt;That produces paradise-lost as the subject and john-milton as the object.&lt;/p&gt;
&lt;pre&gt;subject: paradise-lost&lt;br /&gt;predicate: write&lt;br /&gt;object: john-milton&lt;br /&gt;adjunct: decade-1650&lt;/pre&gt;
&lt;p&gt;This is not very useful for our purpose. We want the roles to say something about the objects in the sentence, not about their form or their place in the sentence.&lt;/p&gt;
&lt;h2&gt;Grammatical case&lt;/h2&gt;
&lt;p&gt;Using &lt;a href=&quot;http://en.wikipedia.org/wiki/Grammatical_case&quot;&gt;grammatical case&lt;/a&gt; (in Dutch: naamvallen), the roles of arguments are expressed in a sentence through various forms. To express the fact that the book was written in London, we use the preposition 'in'. This is the locative case. The English language also uses word position to mark case. The subject of a sentence is placed first and denotes the nominative case. The direct object is placed second and denotes the accusative case.&lt;/p&gt;
&lt;pre&gt;nominative: john-milton&lt;br /&gt;accusative: paradise-lost&lt;br /&gt;locative: london&lt;/pre&gt;
&lt;p&gt;I wanted to add the right case of 'decade-1650', and what &lt;a href=&quot;http://en.wikipedia.org/wiki/Accusative_case#Indo-European_languages&quot;&gt;I found&lt;/a&gt; was 'accusative of duration of time'. This result is a little meagre if you ask me.&lt;/p&gt;
&lt;h2&gt;Theta roles&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Theta_role&quot;&gt;Theta roles&lt;/a&gt; are syntactic in nature. They describe the number and type of the arguments of a verb. The number of theta roles of a verb is fixed. So this formalism stays quite close to the orginal predicate logic expression, except that it 'names' the arguments. An example will make this clear:&lt;/p&gt;
&lt;pre&gt;write(agent: john-milton, theme: paradise-lost)&lt;/pre&gt;
&lt;p&gt;Only 'required' arguments are used as theta roles. So the adjunct 'in the sixteen fifties' cannot be represented. It is not considered to be part of the argument structure of the verb.&lt;/p&gt;
&lt;h2&gt;Thematic relations&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Thematic_relations&quot;&gt;Thematic relations&lt;/a&gt; are similar to theta roles, but their intention is semantic rather than syntactic. They assign roles to adjuncts ('in the sixteen fifties'). &lt;br /&gt;&lt;br /&gt;A list of the most important thematic relations is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Agent&lt;/li&gt;
&lt;li&gt;Experiencer&lt;/li&gt;
&lt;li&gt;Theme&lt;/li&gt;
&lt;li&gt;Patient&lt;/li&gt;
&lt;li&gt;Instrument&lt;/li&gt;
&lt;li&gt;Force&lt;/li&gt;
&lt;li&gt;Location&lt;/li&gt;
&lt;li&gt;Direction&lt;/li&gt;
&lt;li&gt;Recipient&lt;/li&gt;
&lt;li&gt;Source&lt;/li&gt;
&lt;li&gt;Time&lt;/li&gt;
&lt;li&gt;Beneficiary&lt;/li&gt;
&lt;li&gt;Manner&lt;/li&gt;
&lt;li&gt;Purpose&lt;/li&gt;
&lt;li&gt;Cause&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;In our example this would make:&lt;/p&gt;
&lt;pre&gt;predicate: write&lt;br /&gt;agent: john-milton&lt;br /&gt;patient: paradise-lost&lt;br /&gt;time: decade-1650&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;h2&gt;Summary and conclusion&lt;/h2&gt;
&lt;p&gt;Some things to take away:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple sentence has a single predicate and some arguments&lt;/li&gt;
&lt;li&gt;There are required and optional arguments. The optional ones are not always considered 'real'&lt;/li&gt;
&lt;li&gt;There are restrictions to the contents of an argument in a given role&lt;/li&gt;
&lt;li&gt;The role of the arguments with respect to the predicate&lt;/li&gt;
&lt;li&gt;How do you recognize different roles in a sentence?&lt;/li&gt;
&lt;li&gt;There are different predicates with the same name, i.e., write(a, b), write(a, b, c)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I really like thematic relations. They give me the feeling of being 'right', so I will go with them.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1421/15</link><pubDate>Tue, 06 Sep 2011 21:16:53 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1421/15</guid></item><item><title>Review: Les enfants de la salamandre</title><description>&lt;p&gt;I read these three comic book albums some 20 years ago. They are absolutely fantastic. They contain very passionate and violent images, combined with some scenes of kindness and affection that stand out by comparison. Esotheric and biblical elements are located in the roughness of southwesternern USA.&lt;br /&gt;
&lt;br /&gt;
The story is based very strongly on a poem by Rainer Maria Rilke and gives it a completely new dimension. The same is done with a song of Laurie Anderson. These techniques are woven into the story so naturally that it awakens a strong sense of fascination.&lt;br /&gt;
&lt;br /&gt;
What I will do here is analyze the work as much as my limited mind can handle and add some links to informational places on the internet.&lt;/p&gt;&lt;h2&gt;Editions&lt;/h2&gt;
&lt;p&gt;The series contains three books: &lt;em&gt;Angie&lt;/em&gt;, &lt;em&gt;Arkadin&lt;/em&gt; and &lt;em&gt;Alicia&lt;/em&gt;. The first two albums I read were published as part of the series &quot;Collectie Pilote&quot;, by Dargaud, in 1988 and 1989, in Dutch. The series was called &quot;De kinderen van de salamander&quot;. &quot;Alicia&quot; was never added to this collection and I found a copy of an edition published by Novedi (in 1990). Gl&amp;eacute;nat published the series in French as a single volume in 1997. &lt;a href=&quot;http://www.amazon.fr/enfants-salamandre-lint%C3%A9grale-Renaud-Dufaux/dp/2723424073&quot;&gt;At Amazon&lt;/a&gt;. &lt;a href=&quot;http://www.stripinfo.be/strip.php?reeks=901&quot;&gt;Blitz&lt;/a&gt; published it in Dutch.&lt;/p&gt;
&lt;h2&gt;Story&lt;/h2&gt;
&lt;p&gt;The story is very intense. It describes the lives of three young adults, the &quot;children of the salamander&quot;, that are the living actors in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Eschatology&quot;&gt;eschatology&lt;/a&gt; (ideas about the end of the world) of an obscure book. Their goal is to meet each other. The storyline is highly complex and braids the lives of the main characters both chronologically and in flashbacks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:9b0bb434-88ce-4ab5-81e8-2fd347cceb4d/scene-angie.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;500&quot; height=&quot;671&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Scene from &lt;em&gt;Angie&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Main characters&lt;/h2&gt;
&lt;h3&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;The children of the salamander&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Angie, Arkadin and Alicia are the children of the salamander. When they are aroused too much, they produce some kind of electric current that destroys things and people around them (the &quot;sign of the salamander&quot;). They fear the sound of nails pounding in wood since it &quot;reminds them of the suffering of their lord&quot; (Alicia, p18). They have a special connection with old car wrecks and can see the &quot;lost legends&quot; in the form of a conquistador skeleton riding a horse (&lt;a href=&quot;http://en.wikipedia.org/wiki/Francisco_V%C3%A1squez_de_Coronado&quot;&gt;Francisco V&amp;aacute;squez de Coronado&lt;/a&gt;, conqueror of the indians of the southwestern United States).&lt;/p&gt;
&lt;h3&gt;Angie&lt;/h3&gt;
&lt;p&gt;(The name means angel) Angie enters the world as he breaks out of a stone angel in a room in hotel Angel Heart. He explains the goal of the children of the salamander like this: &quot;We all come from the same community.Everyone was part of the other, dependent on the other... all coming from the same dream and oblivion. We must fight this oblivion. We must rebuild the images of that dream. So that no sacrifice is in vain.&quot; The role of Angie is less explicit. &lt;em&gt;Angie&lt;/em&gt; p3 says &quot;Angie and Arkadin. Two sides of the same medal. Their glance filled with the same eternity, &lt;em&gt;The hope of the one&lt;/em&gt; against the hatred of the other.&quot;&lt;/p&gt;
&lt;h3&gt;Arkadin&lt;/h3&gt;
&lt;p&gt;(A rare name, mostly used as surname, is probably chosen after &lt;a href=&quot;http://www.munig.com/kino/film_mr_arkadin_der_satan_persoenlich.html&quot;&gt;Orson Welles' 1956 movie &quot;Mr. Arkadin&quot;, that has in German the subtitle &quot;Der Satan pers&amp;ouml;nlich&quot;&lt;/a&gt;) He is the evil one of the children of the salamander. He calls Satan his father (Alicia, p27) He is &quot;the beast of the apocalypse, marked by the seal&quot; (Arkadin, p41). He is found by the faceless in hotel SkyRoad. (Alicia p.37) He is able to shift form. He wants Alicia to be destroyed.&amp;nbsp; At the end of &lt;em&gt;Arkadin&lt;/em&gt; he grabs Myrvold (of the sect) and continues to live inside his body.&lt;/p&gt;
&lt;h3&gt;Alicia (Ali)&lt;/h3&gt;
&lt;p&gt;(The name means 'of noble birth') She enters the world as she rises from the flames of a temple (church), according to the Asgarod. She is raised by brother Leon and sister Clara. Alicia escapes in a process that kills her foster parents (Alicia p21) She then lives with Paddy and works as a librarian. In the library she reads from the Asgarod. She knows the contents of every book in the library, even though she has no recollection of when she has read them. After Angie and Alicia have had sex in an old diner their energies combine (Alicia p26) and parts of their mutual memories return. They remember the gateway they must return to: hotel Skyroad (Alicia, p34)&lt;/p&gt;
&lt;h3&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;The community of the salamander&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;This community consists of people that have come into contact with the children of the salamander: the &lt;em&gt;sect&lt;/em&gt;, the&lt;em&gt; &quot;faceless&quot;&lt;/em&gt; and the &lt;em&gt;people in the old factory&lt;/em&gt;. They are &quot;a people that waits for its saviour and until then is robbed of its strengths.&quot; (Alicia, p36)&lt;/p&gt;
&lt;h3&gt;The sect&lt;/h3&gt;
&lt;p&gt;A group of people that live by the Asgorad. They wear dark glasses to avoid polluting their sight with the corruption of the world. (Alicia, p12) They worship in temples and these temples contain a statue of a &quot;guide&quot; who has a white complexion and black hair, combed sideways. These statues are destroyed at the beginning of &lt;em&gt;Arkadin&lt;/em&gt;, probably as a token to introduce the coming of Arkadin. The people of the sect meet with the faceless to find out where they found Arkadin, because this is the place where children of the salamander need to return to (hotel Skyroad). As soon as they find out out, they kill all the faceless (Alicia, p41)&lt;/p&gt;
&lt;h3&gt;The &quot;faceless&quot;&lt;/h3&gt;
&lt;p&gt;This 'special security' team of the &quot;police&quot; always wears motor helmets since their faces are being burned away. It is doubtful wether they are really part of the police force because of their brutal methods. They tortured first Arkadin and later&amp;nbsp;Angie to find out the meaning of their own life (Alicia, p41)&lt;/p&gt;
&lt;h3&gt;People in the old factory&lt;/h3&gt;
&lt;p&gt;These people, who only occur in &lt;em&gt;Arkadin&lt;/em&gt;, live in an old factory. Their health deteriorates. Their role is to help Alicia and Angie to find their way back to where they belong.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:f9eeb364-3308-46a8-a05b-5716c8608ab9/scene-arkadin.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;500&quot; height=&quot;696&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Scene from &lt;em&gt;Arkadin&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Asgarod&lt;/h2&gt;
&lt;p&gt;(The name may be related to the country of the Norse Gods, &lt;a href=&quot;http://en.wikipedia.org/wiki/Asgard&quot;&gt;Asgard&lt;/a&gt;) A key element in the story is the fictive book of Asgarod. It is the &quot;holy book that God left &lt;a href=&quot;http://www.redicecreations.com/specialreports/2005/11nov/lucifer.html&quot;&gt;Lucifer&lt;/a&gt; after his fall&quot; (Alicia, p12). Brother Achab (of the sect) spends his life decyphering (and probably translating) the book and found that it prophesies the coming of the children of the salamander, that they will meet, and that this will cause their mutual destruction. Only after that event, a Messiah will stand up and will save the community of the salamander (Alicia, p.17) The Asgarod is written in a logogrammatic language (in which several people&amp;nbsp;at least have their own character) and it is probably Achab's translation of this work that everyone is reading.&lt;/p&gt;
&lt;p&gt;The Asgarod says that the messiah will be sent after the three angels (the children of the salamander) have met and have been destroyed. Yet after this event has taken place, in hotel Skyroad, no messiah has appeared and so brother Achab resumes his studies. After many years he finds the answer to this enigma in a dream. The messiah is here already. (Alicia, p47)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img title=&quot;&quot; onclick=&quot;&quot; onmouseover=&quot;&quot; onmouseout=&quot;&quot; src='http://www.garfixia.nl/l/library/download/urn:uuid:9202b86c-2f1c-4c9f-928a-696e6a20c50d/scene-alicia.jpg' alt=&quot;&quot; data-lightbox-galleryname=&quot;&quot; width=&quot;500&quot; height=&quot;688&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Scene from &lt;em&gt;Alicia&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Powerful references&lt;/h2&gt;
&lt;p&gt;The books mention several explicit references at the end of &lt;em&gt;Angie&lt;/em&gt; and &lt;em&gt;Alicia&lt;/em&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Gravity's angel - a song by Laurie Anderson (see below)&lt;/li&gt;
&lt;li&gt;&quot;The poem about the children of the salamander is by Rilke&quot; - Actually it is called &quot;N&amp;auml;chtens will ich mit dem Engel reden&quot; (see below)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/Southwest-U-S-Gerd-Kittel/dp/0500541213&quot;&gt;South West USA&lt;/a&gt; (Gerd Kittel, 1986)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/Written-West-Wim-Wenders/dp/B0001PBYX6&quot;&gt;Written in the west&lt;/a&gt; (Wim Wenders, 1987)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.evene.fr/livres/livre/jacques-ferrier-usines-34456.php&quot;&gt;Usines&lt;/a&gt; (Jacques Ferrier, 1987)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Gravity's angel - Laurie Anderson:&lt;/h3&gt;
&lt;p&gt;&lt;iframe src=&quot;http://www.youtube.com/embed/rY7uTO_GuDg?autohide=1&amp;amp;autoplay=0&amp;amp;loop=0&amp;amp;fs=0&amp;amp;showinfo=true&amp;amp;rel=0&quot; title=&quot;YouTube video player&quot; type=&quot;text/html&quot; width=&quot;640&quot; height=&quot;360&quot; frameborder=&quot;0&quot; id=&quot;videorY7uTO_GuDg_GuDg&quot; class=&quot;youtube-player&quot;&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;h3&gt;&lt;br /&gt;N&amp;auml;chtens will ich mit dem Engel reden - Rainer Maria Rilke (&lt;a href=&quot;http://rainer-maria-rilke.de/100163naechtenswillich.html&quot;&gt;source&lt;/a&gt;) &lt;em&gt;(I hope you will read it, &lt;a href=&quot;http://home.claranet.nl/users/astrid/angel.htm&quot;&gt;Astrid&lt;/a&gt; :)&lt;/em&gt;&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;N&amp;auml;chtens will ich mit dem Engel reden,&lt;br /&gt;ob er meine Augen anerkennt.&lt;br /&gt;Wenn er pl&amp;ouml;tzlich fragte: Schaust du Eden?&lt;br /&gt;Und ich m&amp;uuml;sste sagen: Eden brennt&lt;br /&gt;&lt;br /&gt;Meinen Mund will ich zu ihm erheben,&lt;br /&gt;hart wie einer, welcher nicht begehrt.&lt;br /&gt;Und der Engel spr&amp;auml;che: Ahnst du Leben?&lt;br /&gt;Und ich m&amp;uuml;sste sagen: Leben zehrt&lt;br /&gt;&lt;br /&gt;Wenn er jene Freude in mir f&amp;auml;nde,&lt;br /&gt;die in seinem Geiste ewig wird, -&lt;br /&gt;und er h&amp;uuml;be sie in seine H&amp;auml;nde,&lt;br /&gt;und ich m&amp;uuml;sste sagen: Freude irrt&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1418/15</link><pubDate>Sat, 20 Aug 2011 20:22:14 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1418/15</guid></item><item><title>Parsing &quot;Was Ada Lovelace a daughter of Lord Byron?&quot;</title><description>&lt;p&gt;For the parser I am trying to write I need a fresh sentence to parse every week or so. This week the sentence is&lt;/p&gt;
&lt;p&gt;&quot;Was Ada Lovelace a daughter of Lord Byron?&quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (I'm using Byron related sentences)&lt;/p&gt;
&lt;p&gt;This is a so-called &quot;Yes-No question&quot; and its phrase structure is something like this:&lt;/p&gt;
&lt;p&gt;S&lt;br /&gt;+--- aux (was)&lt;br /&gt;+--- NP (proper noun: Ada Lovelace)&lt;br /&gt;+--- NP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- NP (determiner: a, noun: daughter)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- PP (preposition: of, proper noun: Lord Byron)&lt;/p&gt;
&lt;p&gt;Simple, but there is a problem: the books I read on the subjects tell me that a yes-no-question has the structure:&lt;/p&gt;
&lt;p&gt;S&lt;br /&gt;+--- aux&lt;br /&gt;+--- NP&lt;br /&gt;+--- VP&lt;/p&gt;
&lt;p&gt;So I thought i'd get me an authorative reference on the subject. There is one. It's called &lt;a href=&quot;http://www.amazon.com/Comprehensive-Grammar-English-Language/dp/0582517346/&quot;&gt;&quot;A Comprehensive Grammar of the English Language&quot;&lt;/a&gt;. But it's expensive ($110.-) So I thought I'd see if I could find a second-hand copy. There weren't any cheap ones. But then I did find a xeroxed version of the book &lt;a href=&quot;http://www.4shared.com/get/jk6DwV70/A_Comprehensive_Grammar_of_the.html&quot;&gt;here&lt;/a&gt;. Great, now I could lookup if&amp;nbsp;&lt;em&gt;S -&amp;gt; aux NP NP&lt;/em&gt; was also allowed.&lt;/p&gt;
&lt;p&gt;The reference doesn't say. But it does say that &quot;Again as with negation, main verb BE functions as operator&quot;. Where &lt;em&gt;operator&lt;/em&gt; equals &lt;em&gt;aux(iliary&lt;/em&gt;). But if the word &lt;em&gt;was&lt;/em&gt; is the auxilliary then there has to be a main verb as well. Except there isn't! So I guess that the main verb is implicit, and I though what word it could be. First I landed on &lt;em&gt;identified&lt;/em&gt; which is close, but does make the sentence flow a little bit awkwardly.&lt;/p&gt;
&lt;p&gt;And then it came to me, and that's why I wrote this piece, that the word is &lt;em&gt;being&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&quot;Was Ada Lovelace &lt;em&gt;being&lt;/em&gt; a daughter of Lord Byron?&quot;&lt;/p&gt;
&lt;p&gt;Which yields:&lt;/p&gt;
&lt;p&gt;S&lt;br /&gt;+--- aux (was)&lt;br /&gt;+--- NP (proper noun: Ada Lovelace)&lt;br /&gt;+--- VP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- verb (being)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- NP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- NP (determiner: a, noun: daughter)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; +--- PP (preposition: of, proper noun: Lord Byron)&lt;/p&gt;
&lt;p&gt;This is all swell, but my parser doesn't read &lt;em&gt;implicit&lt;/em&gt; words. So I will allow the &lt;em&gt;S -&amp;gt; aux NP NP&lt;/em&gt; in my parser, and I will let it generate the verb &lt;em&gt;being&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;PS: If you are reading this and you know it is nonsense, please let me know (kindly), but you will have to provide a better alternative!&lt;/p&gt;</description><link>http://www.garfixia.nl/k/n133/news/view/1402/15</link><pubDate>Fri, 22 Jul 2011 22:30:55 +0200</pubDate><guid isPermaLink='true'>http://www.garfixia.nl/k/n133/news/view/1402/15</guid></item></channel></rss>
