2019-02-05 02:44:07 +02:00
|
|
|
[Diagrams::] Diagrams.
|
|
|
|
|
|
|
|
To construct standard verb-phrase nodes in the parse tree.
|
|
|
|
|
|
|
|
@h Node types.
|
|
|
|
|
2020-07-04 16:17:00 +03:00
|
|
|
@e VERB_NT /* "is" */
|
|
|
|
@e COMMON_NOUN_NT /* "a container" */
|
2019-02-05 02:44:07 +02:00
|
|
|
@e PROPER_NOUN_NT /* "the red handkerchief" */
|
|
|
|
|
|
|
|
@e RELATIONSHIP_NT /* "on" */
|
|
|
|
@e CALLED_NT /* "On the table is a container called the box" */
|
|
|
|
@e WITH_NT /* "The footstool is a supporter with capacity 2" */
|
|
|
|
@e AND_NT /* "whisky and soda" */
|
|
|
|
@e KIND_NT /* "A woman is a kind of person" */
|
|
|
|
@e PROPERTY_LIST_NT /* "capacity 2" */
|
|
|
|
|
|
|
|
@d ASSERT_NFLAG 0x00000008 /* allow this on either side of an assertion? */
|
|
|
|
|
2020-05-30 16:33:19 +03:00
|
|
|
@e TwoLikelihoods_LINERROR from 1
|
2019-02-05 02:44:07 +02:00
|
|
|
|
2020-05-11 17:21:29 +03:00
|
|
|
@d EVEN_MORE_NODE_METADATA_SETUP_SYNTAX_CALLBACK Diagrams::setup
|
|
|
|
@d EVEN_MORE_ANNOTATION_PERMISSIONS_SYNTAX_CALLBACK Diagrams::permissions
|
|
|
|
|
2019-02-05 02:44:07 +02:00
|
|
|
=
|
|
|
|
void Diagrams::setup(void) {
|
2020-07-07 20:24:23 +03:00
|
|
|
NodeType::new(VERB_NT, I"VERB_NT", 0, 0, L3_NCAT, 0);
|
|
|
|
NodeType::new(RELATIONSHIP_NT, I"RELATIONSHIP_NT", 0, 2, L3_NCAT, ASSERT_NFLAG);
|
|
|
|
NodeType::new(CALLED_NT, I"CALLED_NT", 2, 2, L3_NCAT, 0);
|
|
|
|
NodeType::new(WITH_NT, I"WITH_NT", 2, 2, L3_NCAT, ASSERT_NFLAG);
|
|
|
|
NodeType::new(AND_NT, I"AND_NT", 2, 2, L3_NCAT, ASSERT_NFLAG);
|
2020-05-11 17:21:29 +03:00
|
|
|
NodeType::new(KIND_NT, I"KIND_NT", 0, 1, L3_NCAT, ASSERT_NFLAG);
|
2020-07-07 20:24:23 +03:00
|
|
|
NodeType::new(PROPER_NOUN_NT, I"PROPER_NOUN_NT", 0, 0, L3_NCAT, ASSERT_NFLAG);
|
|
|
|
NodeType::new(COMMON_NOUN_NT, I"COMMON_NOUN_NT", 0, INFTY, L3_NCAT, ASSERT_NFLAG);
|
2020-05-11 17:21:29 +03:00
|
|
|
NodeType::new(PROPERTY_LIST_NT, I"PROPERTY_LIST_NT", 0, INFTY, L3_NCAT, ASSERT_NFLAG);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Diagrams::permissions(void) {
|
2020-05-19 18:36:50 +03:00
|
|
|
Annotations::allow(VERB_NT, verbal_certainty_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, sentence_is_existential_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, possessive_verb_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, inverted_verb_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, verb_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, preposition_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, second_preposition_ANNOT);
|
|
|
|
Annotations::allow(VERB_NT, verb_meaning_ANNOT);
|
2020-07-04 16:17:00 +03:00
|
|
|
Annotations::allow(PROPER_NOUN_NT, noun_ANNOT);
|
|
|
|
Annotations::allow(PROPER_NOUN_NT, pronoun_ANNOT);
|
|
|
|
Annotations::allow(COMMON_NOUN_NT, noun_ANNOT);
|
2020-05-11 17:21:29 +03:00
|
|
|
Annotations::allow(RELATIONSHIP_NT, preposition_ANNOT);
|
|
|
|
Annotations::allow(RELATIONSHIP_NT, relationship_node_type_ANNOT);
|
|
|
|
Annotations::allow_for_category(L3_NCAT, linguistic_error_here_ANNOT);
|
|
|
|
Annotations::allow_for_category(L3_NCAT, gender_reference_ANNOT);
|
|
|
|
Annotations::allow_for_category(L3_NCAT, nounphrase_article_ANNOT);
|
|
|
|
Annotations::allow_for_category(L3_NCAT, plural_reference_ANNOT);
|
|
|
|
Annotations::allow(PROPER_NOUN_NT, implicitly_refers_to_ANNOT);
|
2019-02-05 02:44:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@ =
|
|
|
|
void Diagrams::log_node(OUTPUT_STREAM, parse_node *pn) {
|
2020-05-11 17:21:29 +03:00
|
|
|
switch (Annotations::read_int(pn, linguistic_error_here_ANNOT)) {
|
2019-02-05 02:44:07 +02:00
|
|
|
case TwoLikelihoods_LINERROR: WRITE(" (*** TwoLikelihoods_LINERROR ***)"); break;
|
|
|
|
}
|
|
|
|
switch(pn->node_type) {
|
2020-05-19 18:36:50 +03:00
|
|
|
case VERB_NT:
|
2020-07-07 14:07:15 +03:00
|
|
|
if (Node::get_verb(pn))
|
|
|
|
VerbUsages::write_usage(OUT, Node::get_verb(pn));
|
2020-05-11 17:21:29 +03:00
|
|
|
if (Annotations::read_int(pn, sentence_is_existential_ANNOT))
|
2019-02-05 02:44:07 +02:00
|
|
|
WRITE(" (existential)");
|
2020-05-11 17:21:29 +03:00
|
|
|
if (Annotations::read_int(pn, possessive_verb_ANNOT))
|
2019-02-05 02:44:07 +02:00
|
|
|
WRITE(" (possessive)");
|
2020-05-11 17:21:29 +03:00
|
|
|
if (Annotations::read_int(pn, inverted_verb_ANNOT))
|
2019-02-05 02:44:07 +02:00
|
|
|
WRITE(" (inverted)");
|
2020-07-07 14:07:15 +03:00
|
|
|
if (Node::get_verb_meaning(pn))
|
2020-05-11 17:21:29 +03:00
|
|
|
WRITE(" $y", Node::get_verb_meaning(pn));
|
2019-02-05 02:44:07 +02:00
|
|
|
break;
|
2020-07-04 16:17:00 +03:00
|
|
|
case COMMON_NOUN_NT:
|
2019-02-05 02:44:07 +02:00
|
|
|
case PROPER_NOUN_NT:
|
2020-07-07 14:07:15 +03:00
|
|
|
if (Node::get_noun(pn))
|
|
|
|
Nouns::write_usage(OUT, Node::get_noun(pn));
|
|
|
|
if (Node::get_pronoun(pn))
|
|
|
|
Pronouns::write_usage(OUT, Node::get_pronoun(pn));
|
2020-07-01 02:58:55 +03:00
|
|
|
if (Annotations::read_int(pn, nounphrase_article_ANNOT) != 0)
|
|
|
|
Articles::write_lcon(OUT, Annotations::read_int(pn, nounphrase_article_ANNOT));
|
2019-02-05 02:44:07 +02:00
|
|
|
break;
|
|
|
|
case RELATIONSHIP_NT:
|
2020-05-11 17:21:29 +03:00
|
|
|
switch (Annotations::read_int(pn, relationship_node_type_ANNOT)) {
|
2019-02-05 02:44:07 +02:00
|
|
|
case STANDARD_RELN:
|
|
|
|
#ifdef CORE_MODULE
|
2020-05-11 17:21:29 +03:00
|
|
|
if (Node::get_relationship(pn))
|
|
|
|
LOG(" (%S)", Node::get_relationship(pn)->debugging_log_name);
|
2019-02-05 02:44:07 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case PARENTAGE_HERE_RELN: WRITE(" (here)"); break;
|
|
|
|
case DIRECTION_RELN: WRITE(" (direction)"); break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|