Skip to content

Commit

Permalink
Parse and denote prefix tenses/aspects
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn committed Aug 26, 2023
1 parent c451bc4 commit b784d40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare var conjunction: any;
declare var conjunction_in_t1: any;
declare var conjunction_in_t4: any;
declare var aspect: any;
declare var prefix_aspect: any;
declare var topic_marker: any;
declare var complementizer: any;
declare var subordinating_complementizer: any;
Expand All @@ -31,6 +32,7 @@ declare var illocution: any;
declare var polarity: any;
declare var word_quote: any;
declare var tense: any;
declare var prefix_tense: any;
declare var end_quote: any;
declare var predicate: any;
declare var object_incorporating_verb: any;
Expand Down Expand Up @@ -163,8 +165,10 @@ const grammar: Grammar = {
{"name": "CPsub1", "symbols": ["CPsub"], "postprocess": id},
{"name": "CPsub1", "symbols": ["CPsub", "Conjunction", "CPsub1"], "postprocess": makeConn},
{"name": "T1", "symbols": ["T"], "postprocess": id},
{"name": "T1", "symbols": ["T_prefix"], "postprocess": id},
{"name": "T1", "symbols": ["T", "Conjunction", "T1"], "postprocess": makeConn},
{"name": "Asp1", "symbols": ["Asp"], "postprocess": id},
{"name": "Asp1", "symbols": ["Asp_prefix"], "postprocess": id},
{"name": "Asp1", "symbols": ["Asp", "Conjunction", "Asp1"], "postprocess": makeConn},
{"name": "AdjunctP1", "symbols": ["AdjunctP"], "postprocess": id},
{"name": "AdjunctP1", "symbols": ["AdjunctP", "Conjunction", "AdjunctP1"], "postprocess": makeConn},
Expand All @@ -189,6 +193,7 @@ const grammar: Grammar = {
{"name": "ConjunctionT1", "symbols": [(lexer.has("conjunction_in_t1") ? {type: "conjunction_in_t1"} : conjunction_in_t1)], "postprocess": makeLeaf('&')},
{"name": "ConjunctionT4", "symbols": [(lexer.has("conjunction_in_t4") ? {type: "conjunction_in_t4"} : conjunction_in_t4)], "postprocess": makeLeaf('&')},
{"name": "Asp", "symbols": [(lexer.has("aspect") ? {type: "aspect"} : aspect)], "postprocess": makeLeaf('Asp')},
{"name": "Asp_prefix", "symbols": [(lexer.has("prefix_aspect") ? {type: "prefix_aspect"} : prefix_aspect)], "postprocess": makeLeaf('Asp')},
{"name": "Bi", "symbols": [(lexer.has("topic_marker") ? {type: "topic_marker"} : topic_marker)], "postprocess": makeLeaf('Topic')},
{"name": "C", "symbols": [(lexer.has("complementizer") ? {type: "complementizer"} : complementizer)], "postprocess": makeLeaf('C')},
{"name": "Copt$ebnf$1", "symbols": ["C"], "postprocess": id},
Expand Down Expand Up @@ -219,6 +224,7 @@ const grammar: Grammar = {
{"name": "Sigma", "symbols": [(lexer.has("polarity") ? {type: "polarity"} : polarity)], "postprocess": makeLeaf('Σ')},
{"name": "Shu", "symbols": [(lexer.has("word_quote") ? {type: "word_quote"} : word_quote)], "postprocess": makeLeaf('shu')},
{"name": "T", "symbols": [(lexer.has("tense") ? {type: "tense"} : tense)], "postprocess": makeLeaf('T')},
{"name": "T_prefix", "symbols": [(lexer.has("prefix_tense") ? {type: "prefix_tense"} : prefix_tense)], "postprocess": makeLeaf('T')},
{"name": "Teo", "symbols": [(lexer.has("end_quote") ? {type: "end_quote"} : end_quote)], "postprocess": makeLeaf('teo')},
{"name": "Text", "symbols": ["Fragment"], "postprocess": id},
{"name": "V", "symbols": [(lexer.has("predicate") ? {type: "predicate"} : predicate)], "postprocess": makeLeaf('V')},
Expand Down
4 changes: 2 additions & 2 deletions src/semantics/denote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const fi = λ(['v', ['s', 't']], [], c =>
);

function denoteAspect(toaq: string): Expr {
switch (toaq) {
switch (toaq.replace(/-$/, '')) {
case 'tam':
return tam;
case 'chum':
Expand Down Expand Up @@ -250,7 +250,7 @@ const jela = λ(['i', ['s', 't']], [], c =>
);

function denoteTense(toaq: string): Expr {
switch (toaq) {
switch (toaq.replace(/-$/, '')) {
case 'naı':
return nai;
case 'pu':
Expand Down
4 changes: 4 additions & 0 deletions src/toaq.ne
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ DP1 -> DP Roi DP1 {% makeConn %}
CPsub1 -> CPsub {% id %}
CPsub1 -> CPsub Conjunction CPsub1 {% makeConn %}
T1 -> T {% id %}
T1 -> T_prefix {% id %}
T1 -> T Conjunction T1 {% makeConn %}
Asp1 -> Asp {% id %}
Asp1 -> Asp_prefix {% id %}
Asp1 -> Asp Conjunction Asp1 {% makeConn %}
AdjunctP1 -> AdjunctP {% id %}
AdjunctP1 -> AdjunctP Conjunction AdjunctP1 {% makeConn %}
Expand All @@ -172,6 +174,7 @@ Conjunction -> %conjunction {% makeLeaf('&') %}
ConjunctionT1 -> %conjunction_in_t1 {% makeLeaf('&') %}
ConjunctionT4 -> %conjunction_in_t4 {% makeLeaf('&') %}
Asp -> %aspect {% makeLeaf('Asp') %}
Asp_prefix -> %prefix_aspect {% makeLeaf('Asp') %}
Bi -> %topic_marker {% makeLeaf('Topic') %}
C -> %complementizer {% makeLeaf('C') %}
Copt -> C:? {% makeOptLeaf('C') %}
Expand All @@ -196,6 +199,7 @@ SAopt -> SA:? {% makeOptLeaf('SA') %}
Sigma -> %polarity {% makeLeaf('Σ') %}
Shu -> %word_quote {% makeLeaf('shu') %}
T -> %tense {% makeLeaf('T') %}
T_prefix -> %prefix_tense {% makeLeaf('T') %}
Teo -> %end_quote {% makeLeaf('teo') %}
# TODO: multiple-fragment quotes?
Text -> Fragment {% id %}
Expand Down

0 comments on commit b784d40

Please sign in to comment.