+ + +

Description and examples of the diagrams which this module turns sentences into.

+ +

§1. First, an acknowledgement: the sentence diagrams in this section are generated +automatically by linguistics-test. (This means they are always up to date.) +If you are interested in using linguistics in some context other than Inform, +linguistics-test may be a good starting point. +

+ +

§2. Every example sentence in this section was passed in turn to the <sentence> +nonterminal, and the trees displayed below were the result. For example: +

+ +
+linguistics-test: sentence failed to parse
+(1) arfle barfle gloop
+
+SENTENCE_NT'arfle barfle gloop'
+
+(2) beth is not a sailor
+
+SENTENCE_NT'beth is not a sailor'
+    VERB_NT'is not' {verb 'be' 3p s act IS_TENSE -ve} {meaning: is}
+    UNPARSED_NOUN_NT'beth'
+    UNPARSED_NOUN_NT'sailor' {indefinite 'a' n/m/f nom/acc s}
+
+

Sentence (1) here made no sense: there was no verb. It was therefore left as +a single SENTENCE_NT node with no children. In all other cases, as in (2), +there are three children: verb, subject phrase, and object phrase.1 +

+ +

In this tree notation, indentation shows which nodes are children of which +others. The node types, such as SENTENCE_NT, are in capitals and all end +in _NT. The text leading to the creation of the node then appears in quotes. +After that are "annotations", written in braces.2 In sentence (2), we see: +

+ +
  • (a) The VERB_NT node is annotated with its grammatical form — it is "to be", +in third person singular, active mood, present tense, and a negative sense — +and also its semantic meaning — the equality relationship "is". +
  • (b) The second UNPARSED_NOUN_NT node is annotated with the article used to +introduce it — the indefinite article, "a", which could be any of masculine, +feminine or neuter, could be either nominative or accusative, but is +certainly singular. +
+
  • 1 Since "to be" is a copular verb, in sentence (2) we really mean "the +phrase in the object position". +

  • 2 Since the 1850s a variety of tree-diagram schemes for sentence structure +have been proposed: see Wikipedia. +These tend to be quite large, with many optional features — no bad thing when +the aim is to explain. But our aim is to process, not to illustrate, and +whereas a typical dependency tree would have nodes for both "not" and "a", +we use annotations instead. The aim is to have flattish sentence trees +with a simple, predictable shape. +

+

§3. Using <sentence> alone tends to result in a lot of UNPARSED_NOUN_NT nodes. +This is unsatisfying, but useful, because sometimes the meaning of a verb +affects how those nodes should be parsed further. The idea is that the user +will traverse the tree and parse the UNPARSED_NOUN_NT nodes as needed. +Calling the function Nouns::recognise on such a node will test to see +if it's a known common or proper noun, and amend it accordingly. +

+ +

The linguistics-test program does this automatically, so from here on, +all examples shown will have that operation done. For example: +

+ +
+(1) beth is not a sailor
+
+SENTENCE_NT'beth is not a sailor'
+    VERB_NT'is not' {verb 'be' 3p s act IS_TENSE -ve} {meaning: is}
+    PROPER_NOUN_NT'beth' {proper nom/acc f s}
+    COMMON_NOUN_NT'sailor' {common nom/acc m s} {indefinite 'a' n/m/f nom/acc s}
+
+

Here the two UNPARSED_NOUN_NT nodes have been recognised as usages of a +proper noun, Beth, and a common noun, sailor, respectively, and they are +annotated with their grammatical usages — in so far as we can tell. These +two nouns do not inflect with case in English, but they are both singular. +

+ +

§4. Clearly the linguistics module needs to know some vocabulary in order +to do this, and in the test runs displayed in this section, it is using a +very limited stock of nouns, verbs and prepositions as follows: +

+ +
+IS = relationship.
+HAS = relationship.
+CARRIES = relationship.
+KNOWS = relationship.
+
+be = verb meaning IS with priority 2.
+have = verb meaning HAS with priority 1.
+carry = verb meaning CARRIES with priority 3.
+know = verb meaning KNOWS with priority 3.
+
+be + on = preposition meaning CARRIES.
+be + under = preposition meaning CARRIES-reversed.
+
+Anna = feminine proper noun.
+Beth = feminine proper noun.
+Charles = masculine proper noun.
+
+man = masculine common noun.
+woman = feminine common noun.
+person = masculine common noun.
+sailor = masculine common noun.
+table = neuter common noun.
+Ming vase = neuter common noun.
+
+

We only know that Beth is feminine-gendered and sailor masculine-gendered3 +because the vocabulary being used by linguistics-test says so. It's +important to appreciate that although an English reader might twig that +Beth is a common girl's name, we can't do that. +

+ +
  • 3 In the grammatical sense that "she" can refer to Beth and "he" to a +generic identity-unknown sailor. Pronouns in English are a source of real +sensitivity and if linguistics were a module to generate text, rather +than recognise it, we would take much more care over this. Our interest +is in grammatical gender, not the assignment of sexes to people. +

+

§5. So, then, let us start with simple copular sentences — that is, +sentences involving the verb "to be", which equate two subjects rather +than having a subject act upon an object. This is why one "ought to" say +"The traitor is I" instead of "The traitor is me", although nobody does. +

+ +
+(1) anna is a woman
+
+SENTENCE_NT'anna is a woman'
+    VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {meaning: is}
+    PROPER_NOUN_NT'anna' {proper nom/acc f s}
+    COMMON_NOUN_NT'woman' {common nom/acc f s} {indefinite 'a' n/m/f nom/acc s}
+
+(2) anna is not charles
+
+SENTENCE_NT'anna is not charles'
+    VERB_NT'is not' {verb 'be' 3p s act IS_TENSE -ve} {meaning: is}
+    PROPER_NOUN_NT'anna' {proper nom/acc f s}
+    PROPER_NOUN_NT'charles' {proper nom/acc m s}
+
+

§6. Next, regular sentences, that is, those where the verb is not copular +but instead expresses some relationship between a subject and an object +which play different roles. +

+ +
+(1) beth carries the ming vase
+
+SENTENCE_NT'beth carries the ming vase'
+    VERB_NT'carries' {verb 'carry' 3p s act IS_TENSE +ve} {meaning: carries}
+    PROPER_NOUN_NT'beth' {proper nom/acc f s}
+    RELATIONSHIP_NT'carries' {meaning: carries-reversed}
+        COMMON_NOUN_NT'ming vase' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+(2) the sailors carry the table
+
+SENTENCE_NT'the sailors carry the table'
+    VERB_NT'carry' {verb 'carry' 1p/2p s/p act IS_TENSE +ve + 3p p act IS_TENSE +ve} {meaning: carries}
+    COMMON_NOUN_NT'sailors' {common nom/acc m p} {definite 'the' n/m/f s/p nom/acc}
+    RELATIONSHIP_NT'carry' {meaning: carries-reversed}
+        COMMON_NOUN_NT'table' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+(3) the ming vase is carried by beth
+
+SENTENCE_NT'the ming vase is carried by beth'
+    VERB_NT'is carried by' {verb 'be' 3p s act IS_TENSE +ve} {meaning: carries-reversed}
+    COMMON_NOUN_NT'ming vase' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+    RELATIONSHIP_NT'is carried by' {meaning: carries}
+        PROPER_NOUN_NT'beth' {proper nom/acc f s}
+
+(4) a woman is on the table
+
+SENTENCE_NT'a woman is on the table'
+    VERB_NT'is on' {verb 'be' 3p s act IS_TENSE +ve} {meaning: carries}
+    COMMON_NOUN_NT'woman' {common nom/acc f s} {indefinite 'a' n/m/f nom/acc s}
+    RELATIONSHIP_NT'is on' {meaning: carries-reversed}
+        COMMON_NOUN_NT'table' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+

§7. An unusual feature of English is its use of subject-verb inversion: +

+ +
+(1) on the table is the ming vase
+
+SENTENCE_NT'on the table is the ming vase'
+    VERB_NT'is' {verb 'be' 3p s act IS_TENSE +ve} {meaning: is}
+    RELATIONSHIP_NT'on the table' {meaning: carries-reversed}
+        COMMON_NOUN_NT'table' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+    COMMON_NOUN_NT'ming vase' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+(2) on the table is under the ming vase
+
+SENTENCE_NT'on the table is under the ming vase'
+    VERB_NT'is under' {verb 'be' 3p s act IS_TENSE +ve} {meaning: carries-reversed}
+    RELATIONSHIP_NT'on the table' {meaning: carries-reversed}
+        COMMON_NOUN_NT'table' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+    RELATIONSHIP_NT'is under' {meaning: carries}
+        COMMON_NOUN_NT'ming vase' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+

It would be easy to auto-fix the inversion in sentence (1), by simply +swapping the "on the table" and "Ming vase" subtrees over, but we want +to preserve the distinction because Inform will make some use of it. +

+ +

Sentence (2) here is arguably just plain wrong, but we do very occasionally +allow that sort of thing in Inform (for e.g. "east of X is south of Y"). +

+ +

§8. Now we introduce pronouns to the mix. These are detected automatically +by linguistics, and exist in nominative and accusative cases in +English. Note the difference in annotations between "them" and "you", +for example. +

+ +
+(1) he knows her
+
+SENTENCE_NT'he knows her'
+    VERB_NT'knows' {verb 'know' 3p s act IS_TENSE +ve} {meaning: knows}
+    PRONOUN_NT'he' {third person pronoun m 3p s nom}
+    RELATIONSHIP_NT'knows' {meaning: knows-reversed}
+        PRONOUN_NT'her' {third person pronoun f 3p s acc}
+
+(2) she knows him
+
+SENTENCE_NT'she knows him'
+    VERB_NT'knows' {verb 'know' 3p s act IS_TENSE +ve} {meaning: knows}
+    PRONOUN_NT'she' {third person pronoun f 3p s nom}
+    RELATIONSHIP_NT'knows' {meaning: knows-reversed}
+        PRONOUN_NT'him' {third person pronoun m 3p s acc}
+
+(3) i carry the ming vase
+
+SENTENCE_NT'i carry the ming vase'
+    VERB_NT'carry' {verb 'carry' 1p/2p s/p act IS_TENSE +ve + 3p p act IS_TENSE +ve} {meaning: carries}
+    PRONOUN_NT'i' {first person pronoun n/m/f 1p s nom}
+    RELATIONSHIP_NT'carry' {meaning: carries-reversed}
+        COMMON_NOUN_NT'ming vase' {common nom/acc n s} {definite 'the' n/m/f s/p nom/acc}
+
+(4) the sailors know them
+
+SENTENCE_NT'the sailors know them'
+    VERB_NT'know' {verb 'know' 1p/2p s/p act IS_TENSE +ve + 3p p act IS_TENSE +ve} {meaning: knows}
+    COMMON_NOUN_NT'sailors' {common nom/acc m p} {definite 'the' n/m/f s/p nom/acc}
+    RELATIONSHIP_NT'know' {meaning: knows-reversed}
+        PRONOUN_NT'them' {third person pronoun n/m/f 3p p acc}
+
+(5) you know us
+
+SENTENCE_NT'you know us'
+    VERB_NT'know' {verb 'know' 1p/2p s/p act IS_TENSE +ve + 3p p act IS_TENSE +ve} {meaning: knows}
+    PRONOUN_NT'you' {second person pronoun n/m/f s/p nom/acc 2p}
+    RELATIONSHIP_NT'know' {meaning: knows-reversed}
+        PRONOUN_NT'us' {first person pronoun n/m/f 1p p acc}
+
+ + +