<pclass="purpose">To determine which subjects are referred to by noun phrases such as "the table" or "a paper cup" found in assertion sentences.</p>
<ulclass="toc"><li><ahref="4-rpt.html#SP1">§1. How individual nouns are represented after refinement</a></li><li><ahref="4-rpt.html#SP4">§4. The player is not yourself</a></li><li><ahref="4-rpt.html#SP5">§5. Representation of single adjectives</a></li><li><ahref="4-rpt.html#SP7">§7. Simple descriptions</a></li><li><ahref="4-rpt.html#SP8">§8. Refining couplings</a></li><li><ahref="4-rpt.html#SP9">§9. The refinery itself</a></li><li><ahref="4-rpt.html#SP12">§12. About surgeries</a></li><li><ahref="4-rpt.html#SP14">§14. Un-WITH</a></li></ul><hrclass="tocbar">
<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. How individual nouns are represented after refinement. </b></p>
<ulclass="items"><li>(a) In general, noun phrases in the parse tree divide into "proper" and "common".
Before refinement they generally have node type <spanclass="extract"><spanclass="extract-syntax">UNPARSED_NOUN_NT</span></span>: afterwards,
either <spanclass="extract"><spanclass="extract-syntax">PROPER_NOUN_NT</span></span> or <spanclass="extract"><spanclass="extract-syntax">COMMON_NOUN_NT</span></span>.
</li><li>(b) A noun phrase node has a "subject" annotation, identifying what if anything
it refers to. For example, "a door" refers to the kind "door".
</li><li>(c) It also has an "evaluation" annotation. For example, "35" evaluates to
the number 33, but has no subject.
</li><li>(d) If the noun phrase gives a number of items, the <spanclass="extract"><spanclass="extract-syntax">multiplicity</span></span> annotation
records how many; thus, for "six lorries" it would be 6.
</li><li>(e) If the noun phrase describes some properties or relations which must be
true — "an open door", say, or "a woman in London" — these are recorded
in a <spanclass="extract"><spanclass="extract-syntax">creation_proposition</span></span> annotation.
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP1_1"class="named-paragraph-link"><spanclass="named-paragraph">Make a common or proper noun as appropriate</span><spanclass="named-paragraph-number">1.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP1_1"class="named-paragraph-link"><spanclass="named-paragraph">Make a common or proper noun as appropriate</span><spanclass="named-paragraph-number">1.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP1_1"class="paragraph-anchor"></a><b>§1.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Make a common or proper noun as appropriate</span><spanclass="named-paragraph-number">1.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP1">§1</a> (twice).</li></ul>
<pclass="commentary firstcommentary"><aid="SP2"class="paragraph-anchor"></a><b>§2. </b>This can be performed either on noun or <spanclass="extract"><spanclass="extract-syntax">ADJECTIVE_NT</span></span> nodes. It transfers
<pclass="commentary firstcommentary"><aid="SP3"class="paragraph-anchor"></a><b>§3. </b>It's useful to have a safe way of transferring the complete noun details
from one node to another, without breaking the above invariant. (The
<spanclass="extract"><spanclass="extract-syntax">nowhere</span></span> annotation is used by the spatial model plugin, if active, and
it probably never needs to be copied, but we do so for safety's sake.)
<pclass="commentary firstcommentary"><aid="SP4"class="paragraph-anchor"></a><b>§4. The player is not yourself. </b>The following function handles a feature added to Inform to handle just one
peculiarity of syntax: that the source text will often talk about "the
player" to mean the instance which represents the player at the start of
play (properly called "yourself"), not the variable whose value is the
instance currently representing the player.
</p>
<pclass="commentary">But no explicit mention of this case appears here; in theory any global
variable can be set to shadow a spcific instance in this way.
<pclass="commentary firstcommentary"><aid="SP5"class="paragraph-anchor"></a><b>§5. Representation of single adjectives. </b>Individual adjective nodes are made as follows. Note that we append noun
details to the nodes so that sentences like this one...
</p>
<blockquote>
<p>Scenery is usually fixed in place.</p>
</blockquote>
<pclass="commentary">...can work; here "scenery", though an adjective, is effectively a common
noun in disguise. (It's a deficiency of English that a surprising number of
common objects, which ought to have count nouns, in fact have mass nouns —
compare "clothing" and "clothes", which has no adequate singular.)
<pclass="commentary firstcommentary"><aid="SP6"class="paragraph-anchor"></a><b>§6. </b>A different reason why adjective and nouns overlap is due to words like
"green", which describe a state and also suggest that something possesses it.
Context sometimes causes us to consider an adjective as a noun instead,
though only if it has a positive sense and has a nominal meaning.
<pclass="commentary firstcommentary"><aid="SP7"class="paragraph-anchor"></a><b>§7. Simple descriptions. </b>For a precise definition see <ahref="../values-module/2-dsc.html"class="internal">Descriptions (in values)</a>, but roughly speaking
a "simple" description is one with only adjectives and perhaps a head noun:
thus "closed" and "a closed lockable door" are simple, but "four women in a
lighted room" is complex.
</p>
<pclass="commentary">The following function should be called only on a simple description.
It turns the node <spanclass="extract"><spanclass="extract-syntax">p</span></span> into a subtree representing the content of
that simple description in <spanclass="extract"><spanclass="extract-syntax">desc</span></span>.
</p>
<pclass="commentary">Depending on the circumstances, we get a subtree in which the headword if any
is represented by an <spanclass="extract"><spanclass="extract-syntax">COMMON_NOUN_NT</span></span> node (where the headword is a kind of
object) or a <spanclass="extract"><spanclass="extract-syntax">PROPER_NOUN_NT</span></span> (where the headword is a specific object), and
where the adjectives each become <spanclass="extract"><spanclass="extract-syntax">ADJECTIVE_NT</span></span> nodes.
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP7_1"class="named-paragraph-link"><spanclass="named-paragraph">Set the attachment node to the headword, if there is one</span><spanclass="named-paragraph-number">7.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">if</span><spanclass="plain-syntax"> (</span><spanclass="identifier-syntax">head</span><spanclass="plain-syntax">) </span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP7_2"class="named-paragraph-link"><spanclass="named-paragraph">Insert a WITH node joining adjective tree to headword</span><spanclass="named-paragraph-number">7.2</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP7_3"class="named-paragraph-link"><spanclass="named-paragraph">Place a subtree of adjectives at the attachment node</span><spanclass="named-paragraph-number">7.3</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"> }</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP7_1"class="paragraph-anchor"></a><b>§7.1. </b>Crucially, the headword node gets one extra annotation: its "full phrase
evaluation", which retains the original description information — in
particular, quantification data such as that in "four doors", which
would be lost if we simply applied <spanclass="extract"><spanclass="extract-syntax">Refiner::give_subject_to_noun</span></span> to the inference
subject for "door".
</p>
<pclass="commentary">If <spanclass="extract"><spanclass="extract-syntax">head</span></span> is not set, it doesn't matter what we do, because there'll be
no headword node — this is why we don't bother to find any subject to
set for it.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Set the attachment node to the headword, if there is one</span><spanclass="named-paragraph-number">7.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP7">§7</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP7_2"class="paragraph-anchor"></a><b>§7.2. </b>We put a WITH node in the attachment position, displacing the headword
content to its first child, and making its second child the new attachment
position — so that that is where the adjectives subtree will go.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Insert a WITH node joining adjective tree to headword</span><spanclass="named-paragraph-number">7.2</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP7">§7</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP7_3"class="paragraph-anchor"></a><b>§7.3. </b>When there are two or more adjectives, they must occur as leaves of a
binary tree whose non-leaf nodes are <spanclass="extract"><spanclass="extract-syntax">AND_NT</span></span>. We do this pretty inefficiently,
making no effort to balance the tree, since it has negligible effect on speed
or memory.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Place a subtree of adjectives at the attachment node</span><spanclass="named-paragraph-number">7.3</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP7">§7</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP8"class="paragraph-anchor"></a><b>§8. Refining couplings. </b>When an assertion couples <spanclass="extract"><spanclass="extract-syntax">px</span></span> and <spanclass="extract"><spanclass="extract-syntax">py</span></span>, the following is called first to
<pclass="commentary firstcommentary"><aid="SP9"class="paragraph-anchor"></a><b>§9. The refinery itself. </b>Time to get started, then. Each subtree can be refined only once.
</p>
<pclass="commentary">The <spanclass="extract"><spanclass="extract-syntax">creation_rule</span></span> can have three values:
</p>
<preclass="definitions code-font"><spanclass="definition-keyword">define</span><spanclass="constant-syntax">FORBID_CREATION</span><spanclass="plain-syntax"></span><spanclass="constant-syntax">0</span><spanclass="plain-syntax"></span><spanclass="comment-syntax"> never create an object with this name</span>
<spanclass="definition-keyword">define</span><spanclass="constant-syntax">ALLOW_CREATION</span><spanclass="plain-syntax"></span><spanclass="constant-syntax">1</span><spanclass="plain-syntax"></span><spanclass="comment-syntax"> create an object with this name if that looks sensible</span>
<spanclass="definition-keyword">define</span><spanclass="constant-syntax">MANDATE_CREATION</span><spanclass="plain-syntax"></span><spanclass="constant-syntax">2</span><spanclass="plain-syntax"></span><spanclass="comment-syntax"> always create an object with this name, except for "it"</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">if</span><spanclass="plain-syntax"> (</span><spanclass="identifier-syntax">p</span><spanclass="plain-syntax"> == </span><spanclass="identifier-syntax">NULL</span><spanclass="plain-syntax">) </span><spanclass="identifier-syntax">internal_error</span><spanclass="plain-syntax">(</span><spanclass="string-syntax">"Refine parse tree on null pn"</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">X_OF_Y_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_1"class="named-paragraph-link"><spanclass="named-paragraph">Refine an X-of-Y subtree</span><spanclass="named-paragraph-number">11.1</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">WITH_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_2"class="named-paragraph-link"><spanclass="named-paragraph">Refine an X-with-Y subtree</span><spanclass="named-paragraph-number">11.2</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">AND_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_3"class="named-paragraph-link"><spanclass="named-paragraph">Refine an X-and-Y subtree</span><spanclass="named-paragraph-number">11.3</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">RELATIONSHIP_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_5"class="named-paragraph-link"><spanclass="named-paragraph">Refine a relationship subtree</span><spanclass="named-paragraph-number">11.5</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">CALLED_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_4"class="named-paragraph-link"><spanclass="named-paragraph">Refine a calling subtree</span><spanclass="named-paragraph-number">11.4</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">KIND_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_6"class="named-paragraph-link"><spanclass="named-paragraph">Refine a kind subtree</span><spanclass="named-paragraph-number">11.6</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">PRONOUN_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_7"class="named-paragraph-link"><spanclass="named-paragraph">Refine a pronoun</span><spanclass="named-paragraph-number">11.7</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">case</span><spanclass="plain-syntax"></span><spanclass="identifier-syntax">UNPARSED_NOUN_NT:</span><spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8"class="named-paragraph-link"><spanclass="named-paragraph">Refine what seems to be a noun phrase</span><spanclass="named-paragraph-number">11.8</span></a></span><spanclass="plain-syntax">; </span><spanclass="reserved-syntax">return</span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"> }</span>
<spanclass="plain-syntax">}</span>
</pre>
<pclass="commentary firstcommentary"><aid="SP11_1"class="paragraph-anchor"></a><b>§11.1. </b>Recall that an <spanclass="extract"><spanclass="extract-syntax">X_OF_Y_NT</span></span> subtree has the form owner followed by
property name, so we forbid creation of a new object from the property name
subtree.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine an X-of-Y subtree</span><spanclass="named-paragraph-number">11.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_2"class="paragraph-anchor"></a><b>§11.2. </b><spanclass="extract"><spanclass="extract-syntax">WITH_NT</span></span> is used to create something with a list of properties. This
leads to some awkward cases — for instance, where a "with" in an action
pattern like "doing something with the bucket" has been misinterpreted.
We fix those cases by hand, by reconstructing the text before it was
divided, then parsing it as an action pattern; if that works, that reading
is allowed to stand.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine an X-with-Y subtree</span><spanclass="named-paragraph-number">11.2</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_3"class="paragraph-anchor"></a><b>§11.3. </b><spanclass="extract"><spanclass="extract-syntax">AND_NT</span></span> is easy, except for "and surgery", of which more below.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine an X-and-Y subtree</span><spanclass="named-paragraph-number">11.3</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_4"class="paragraph-anchor"></a><b>§11.4. </b>A <spanclass="extract"><spanclass="extract-syntax">CALLED_NT</span></span> node has two children: in the phrase "an X called Y", they
will represent X and Y respectively. Y must be created afresh whatever its
name, since the whole point of "called" is that it enables the designer
to use names which would otherwise be interpreted as meaning something
significant: it is a sort of literal escape, like the backslash character
in C strings. X is never something new: it is expected to be a kind.
We convert the whole node into a simple <spanclass="extract"><spanclass="extract-syntax">PROPER_NOUN_NT</span></span> with the name
of Y and the kind of X. In this way, all <spanclass="extract"><spanclass="extract-syntax">CALLED_NT</span></span> nodes are removed
from the tree.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine a calling subtree</span><spanclass="named-paragraph-number">11.4</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"I can only make a single 'called' thing at a time"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"or rather, the 'called' is only allowed to apply to one thing "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"at a time. For instance, 'A thing called a vodka and tonic is "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"on the table.' is allowed, but 'Two things called vodka and tonic' "</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_5"class="paragraph-anchor"></a><b>§11.5. </b>A <spanclass="extract"><spanclass="extract-syntax">RELATIONSHIP_NT</span></span> node may have no children, representing "here"; or
it may have one child, a room or door which lies in some map direction. But
in general it has two children: for instance "a green marble in a blue box"
has the marble and the box as its children, the relationship being containment.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine a relationship subtree</span><spanclass="named-paragraph-number">11.5</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">if</span><spanclass="plain-syntax"> (</span><spanclass="identifier-syntax">dir</span><spanclass="plain-syntax">) </span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_5_1"class="named-paragraph-link"><spanclass="named-paragraph">Make the relation one which refers to a map direction</span><spanclass="named-paragraph-number">11.5.1</span></a></span><spanclass="plain-syntax">;</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_5_1"class="paragraph-anchor"></a><b>§11.5.1. </b>This handles the case of a one-child node representing a map direction,
but fills in a second child as the direction object in question. Thus if
the relation is mapped-north-of, then the second child will become the
direction object for "north".
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Make the relation one which refers to a map direction</span><spanclass="named-paragraph-number">11.5.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="identifier-syntax">LOGIF</span><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">NOUN_RESOLUTION</span><spanclass="plain-syntax">, </span><spanclass="string-syntax">"Directional predicate with BP from $O\n"</span><spanclass="plain-syntax">, </span><spanclass="identifier-syntax">dir</span><spanclass="plain-syntax">);</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_5">§11.5</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_6"class="paragraph-anchor"></a><b>§11.6. </b>A <spanclass="extract"><spanclass="extract-syntax">KIND_NT</span></span> node may have no children, and if so it represents the bare
word "kind": the reference must be to the kind "kind" itself.
Otherwise it has one child — the name of an existing kind of value or
object. After refinement, it will be annotated with a valid non-null
inference subject representing the domain to which any new kind would belong.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine a kind subtree</span><spanclass="named-paragraph-number">11.6</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_6_1"class="named-paragraph-link"><spanclass="named-paragraph">Issue a problem message for a kind of instance</span><spanclass="named-paragraph-number">11.6.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_6_2"class="named-paragraph-link"><spanclass="named-paragraph">Issue a problem message for a disallowed subkind</span><spanclass="named-paragraph-number">11.6.2</span></a></span><spanclass="plain-syntax">;</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_6_1"class="paragraph-anchor"></a><b>§11.6.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem message for a kind of instance</span><spanclass="named-paragraph-number">11.6.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"I don't recognise that as a kind"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"such as 'room' or 'door': it would need to be straightforwardly the name "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"of a kind, and not be qualified with adjectives like 'open'."</span><spanclass="plain-syntax">);</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_6">§11.6</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_6_2"class="paragraph-anchor"></a><b>§11.6.2. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem message for a disallowed subkind</span><spanclass="named-paragraph-number">11.6.2</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_6">§11.6</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_7"class="paragraph-anchor"></a><b>§11.7. </b>The following could clearly be improved.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine a pronoun</span><spanclass="named-paragraph-number">11.7</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"I'm unable to handle 'they' here"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"since it looks as if it needs to refer to more than one "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"object here, and that's something I can't manage."</span><spanclass="plain-syntax">);</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8"class="paragraph-anchor"></a><b>§11.8. </b>The simple description of what happens to a <spanclass="extract"><spanclass="extract-syntax">PROPER_NOUN_NT</span></span> node is that
if it's an existing object or value, then it should be annotated with a
reference to that object or value; and if not, then a new object should be
created with that name. (We don't actually create here, though: we just mark
such a noun phrase by changing its node type to <spanclass="extract"><spanclass="extract-syntax">CREATED_NT</span></span>.) The more
complicated description is as follows:
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Refine what seems to be a noun phrase</span><spanclass="named-paragraph-number">11.8</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_1"class="named-paragraph-link"><spanclass="named-paragraph">Act on any special noun phrases significant to plugins</span><spanclass="named-paragraph-number">11.8.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2"class="named-paragraph-link"><spanclass="named-paragraph">Interpret this as an existing noun if possible</span><spanclass="named-paragraph-number">11.8.2</span></a></span><spanclass="plain-syntax">;</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11">§11</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_1"class="paragraph-anchor"></a><b>§11.8.1. </b>For example, "above" and "below" become significant if the mapping plugin
is active, and "nowhere" if the spatial one is.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Act on any special noun phrases significant to plugins</span><spanclass="named-paragraph-number">11.8.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8">§11.8</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2"class="paragraph-anchor"></a><b>§11.8.2. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Interpret this as an existing noun if possible</span><spanclass="named-paragraph-number">11.8.2</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_1"class="named-paragraph-link"><spanclass="named-paragraph">Parse the noun phrase as a value property name</span><spanclass="named-paragraph-number">11.8.2.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="reserved-syntax">if</span><spanclass="plain-syntax"> (</span><spanclass="identifier-syntax">spec</span><spanclass="plain-syntax"> == </span><spanclass="identifier-syntax">NULL</span><spanclass="plain-syntax">) </span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_3"class="named-paragraph-link"><spanclass="named-paragraph">Parse the noun phrase as a value</span><spanclass="named-paragraph-number">11.8.2.3</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_5"class="named-paragraph-link"><spanclass="named-paragraph">Act on a description used as a noun phrase</span><spanclass="named-paragraph-number">11.8.2.5</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_4"class="named-paragraph-link"><spanclass="named-paragraph">Act on an action pattern used as a noun phrase</span><spanclass="named-paragraph-number">11.8.2.4</span></a></span><spanclass="plain-syntax">;</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8">§11.8</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_1"class="paragraph-anchor"></a><b>§11.8.2.1. </b>Perhaps it is the name of a valued property? If so, it is used as a noun,
without obvious reference to any owner: we convert it to a noun node.
</p>
<pclass="commentary">(This is the next priority so that "description" will be read as its
property name meaning, not as the name of a kind of value.)
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Parse the noun phrase as a value property name</span><spanclass="named-paragraph-number">11.8.2.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2_2">§11.8.2.2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_2"class="paragraph-anchor"></a><b>§11.8.2.2. </b>When a noun phrase in an assertion represents a value, it's normally a
constant ("13") or else something like a description of values ("a number").
It wouldn't make sense to refer to a temporary value like a local variable,
but a global ("player" or "time of day") is possible.
</p>
<pclass="commentary">The "action of taking something" syntax is provided as a way of escaping
the usual handling of action patterns; it enables "taking something" to be
a noun instead of a condition testing the current action.
<ulclass="endnotetexts"><li>This is <ahref="../words-module/4-ap.html"class="internal">Preform grammar</a>, not regular C code.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_3"class="paragraph-anchor"></a><b>§11.8.2.3. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Parse the noun phrase as a value</span><spanclass="named-paragraph-number">11.8.2.3</span></span><spanclass="Preform-comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_3_1"class="named-paragraph-link"><spanclass="named-paragraph">Check that this noun phrase is allowed a quantifier</span><spanclass="named-paragraph-number">11.8.2.3.1</span></a></span><spanclass="plain-syntax">;</span>
<spanclass="plain-syntax"></span><spanclass="identifier-syntax">LOGIF</span><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">NOUN_RESOLUTION</span><spanclass="plain-syntax">, </span><spanclass="string-syntax">"Noun phrase %W parsed as value: $P\n"</span><spanclass="plain-syntax">, </span><spanclass="identifier-syntax">Node::get_text</span><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">p</span><spanclass="plain-syntax">), </span><spanclass="identifier-syntax">spec</span><spanclass="plain-syntax">);</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2">§11.8.2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP_1"class="paragraph-anchor"></a><b>§.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Issue a problem for a variable described without a kind</span><spanclass="named-paragraph-number">.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is never used.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_3_1"class="paragraph-anchor"></a><b>§11.8.2.3.1. </b><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Check that this noun phrase is allowed a quantifier</span><spanclass="named-paragraph-number">11.8.2.3.1</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"complicated determiners are not allowed in assertions"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"so for instance 'More than three people are in the Dining Room' "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"or 'None of the containers is open' will be rejected. Only "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"simple numbers will be allowed, as in examples like 'Three "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"people are in the Dining Room.'"</span><spanclass="plain-syntax">);</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"in an assertion 'every' or 'all' can only be used with a kind"</span><spanclass="plain-syntax">,</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"so for instance 'A coin is in every container' is all right, "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"because 'container' is a kind, but not 'A coin is in every "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"open container', because 'open container' is now a kind "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"qualified by a property which may come or go during play. "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"(This problem sometimes happens because a thing has been "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"called something like an 'all in one survival kit' - if you "</span>
<spanclass="plain-syntax"></span><spanclass="string-syntax">"need that sort of name, try using 'called' to set it.)"</span><spanclass="plain-syntax">);</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2_3">§11.8.2.3</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_4"class="paragraph-anchor"></a><b>§11.8.2.4. </b>If the noun phrase is a valid action pattern, such as "taking something",
we change it to a new node type to mark this. We don't keep the pattern:
it will be reparsed much later on.
</p>
<pclass="commentary">We have to be a little cautious, because of the way English allows participles
as nouns to mean the result of some action having taken place on something —
consider "the scoring", for instance, in the sense of a mark scored on a
piece of wood. So we parse action patterns with a lower priority than values
here, given that we know we are looking for a noun.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Act on an action pattern used as a noun phrase</span><spanclass="named-paragraph-number">11.8.2.4</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2">§11.8.2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_5"class="paragraph-anchor"></a><b>§11.8.2.5. </b>This case has been left to last, since it's so much the most difficult.
Descriptions have to be converted into a surprising range of different
subtrees — otherwise it will not be possible to issue a wide range of
to-the-point problem messages for badly constructed sentences.
</p>
<pclass="commentary">Oddly, it's not the complicated descriptions which give trouble...
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Act on a description used as a noun phrase</span><spanclass="named-paragraph-number">11.8.2.5</span></span><spanclass="comment-syntax"> =</span>
<spanclass="plain-syntax"></span><spanclass="named-paragraph-container code-font"><ahref="4-rpt.html#SP11_8_2_5_1"class="named-paragraph-link"><spanclass="named-paragraph">Act on a simple description</span><spanclass="named-paragraph-number">11.8.2.5.1</span></a></span><spanclass="plain-syntax">;</span>
</pre>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2">§11.8.2</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP11_8_2_5_1"class="paragraph-anchor"></a><b>§11.8.2.5.1. </b>...it's the shorter phrases where, perversely, the risk of a
misunderstanding is higher. For one thing, we deliberately ignore a valid
description in two cases:
</p>
<ulclass="items"><li>(a) Adjective(s) followed by the name of a specific object.
</li><li>(b) An indefinite article followed by the name of a specific object.
</li></ul>
<pclass="commentary">For (a), see the example "Goat-Cheese and Sage Chicken". This contains a
kettle which can be in several states, described adjectivally, and one of
those is "heating". This means the S-parser reads "heating kettle" as if it
meant "the kettle when in the heating state". But we don't want this to be
recognised in an assertion, because it's not useful to talk about individual
objects in particular states when setting up the initial state — the kettle
either starts out as heating, or it doesn't. Moreover, we don't want to
misread a line like:
</p>
<blockquote>
<p>Heating Kettle is a scene.</p>
</blockquote>
<pclass="commentary">(also a sentence from "Goat-Cheese and Sage Chicken"). Because of this and
similar ambiguities, we ignore the S-parser's recommendation of reading
adjective(s) plus proper noun as a reference to that noun in a special state.
</p>
<pclass="commentary">Case (b) comes out of a point of difference between proper and common nouns:
use of an indefinite article is fine with common nouns — "a container", for
example — but not with proper nouns: talking about "a silver bar" suggests
that this is not the same silver bar referred to in some previous
sentence.
</p>
<pclass="commentary"><spanclass="named-paragraph-container code-font"><spanclass="named-paragraph-defn">Act on a simple description</span><spanclass="named-paragraph-number">11.8.2.5.1</span></span><spanclass="comment-syntax"> =</span>
<ulclass="endnotetexts"><li>This code is used in <ahref="4-rpt.html#SP11_8_2_5">§11.8.2.5</a>.</li></ul>
<pclass="commentary firstcommentary"><aid="SP12"class="paragraph-anchor"></a><b>§12. About surgeries. </b>The rest of this section is taken up with local surgical operations
performed on the tree in the light of what we can now see.
</p>
<pclass="commentary">"And surgery" is a fiddly operation to correct the parse tree after
resolution of all the nouns in a phrase which involves both "and" and
"with" in a particular way. There's no problem with either of these:
</p>
<blockquote>
<p>In the Pitch are a bat and ball with weight 10.</p>
</blockquote>
<blockquote>
<p>In the Pitch is a sweater with score for finding 5 and description "White wool."</p>
</blockquote>
<pclass="commentary">neither of which is altered by and surgery. The difficulty arises with
</p>
<blockquote>
<p>In the Pitch is an openable and open door with description "The Hut door."</p>
</blockquote>
<pclass="commentary">which, we notice, has exactly the same grammatical structure as the first of
the two sentences above, yet a very different meaning, since "openable" is a
property whereas "bat" was an object. We perform surgery on:
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">Refiner::perform_and_surgery</span><buttonclass="popup"onclick="togglePopup('usagePopup12')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup12">Usage of <spanclass="code-font"><spanclass="function-syntax">Refiner::perform_and_surgery</span></span>:<br/><ahref="4-rpt.html#SP11_3">§11.3</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">parse_node</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">p</span><spanclass="plain-syntax">) {</span>
<pclass="commentary firstcommentary"><aid="SP13"class="paragraph-anchor"></a><b>§13. </b>"With surgery" is a less traumatic operation, motivated by sentences like:
</p>
<blockquote>
<p>In the Pitch is an open container with description "The box of stumps and bails."</p>
</blockquote>
<pclass="commentary">The initial parse tree for such a sentence will have two nested <spanclass="extract"><spanclass="extract-syntax">WITH_NT</span></span>
clauses, which is arguably correct — "a (container with property open)
with description ..." — but which is inconvenient for our implementation
of <spanclass="extract"><spanclass="extract-syntax">WITH_NT</span></span> later on. So we construe the sentence instead with a single
"with", as "a container with properties open and description ..." In
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">Refiner::perform_with_surgery</span><buttonclass="popup"onclick="togglePopup('usagePopup13')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup13">Usage of <spanclass="code-font"><spanclass="function-syntax">Refiner::perform_with_surgery</span></span>:<br/><ahref="4-rpt.html#SP11_2">§11.2</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">parse_node</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">p</span><spanclass="plain-syntax">) {</span>
<pclass="commentary firstcommentary"><aid="SP14"class="paragraph-anchor"></a><b>§14. Un-WITH. </b>We may subsequently learn that what appeared to be a property setting was
actually some other noun phrase containing the word "with" — a particular
issue for sentences like:
</p>
<blockquote>
<p>The agreeing with policy action has an object called the hat.</p>
<spanclass="reserved-syntax">void</span><spanclass="plain-syntax"></span><spanclass="function-syntax">Refiner::un_with</span><buttonclass="popup"onclick="togglePopup('usagePopup14')"><spanclass="comment-syntax">?</span><spanclass="popuptext"id="usagePopup14">Usage of <spanclass="code-font"><spanclass="function-syntax">Refiner::un_with</span></span>:<br/><ahref="4-rpt.html#SP8">§8</a></span></button><spanclass="plain-syntax">(</span><spanclass="identifier-syntax">parse_node</span><spanclass="plain-syntax"> *</span><spanclass="identifier-syntax">p</span><spanclass="plain-syntax">) {</span>