-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavi.ne
847 lines (746 loc) · 21.6 KB
/
navi.ne
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# Na'vi grammar in Nearley format
# Helper functions
@{%
const Inflectors = require("en-inflectors").Inflectors;
function getDefinitionId(word, type) {
for (let i = 0; i < word['definition'].length; i++) {
if (word['types'][i].indexOf(type) === 0) {
return i;
}
}
//console.log('Warning: couldn\'t find type "' + type + '" for word "' + word['value'] + '"');
return 0;
}
function getTranslation(word, type) {
let def_id = getDefinitionId(word, type);
if (word['definition']) {
return word['definition'][def_id]['translations'][0]['en'];
}
return null;
}
function getShortTranslation(word, type) {
let def_id = getDefinitionId(word, type);
let result = word['definition'][def_id];
if (result["short_translation"]) {
return result["short_translation"];
}
let translation = result["translations"][0]["en"];
translation = translation.split(',')[0];
translation = translation.split(';')[0];
translation = translation.split(' (')[0];
if (result["type"][0] === "v"
&& translation.indexOf("to ") === 0) {
translation = translation.substr(3);
}
return translation;
}
// in order:
// * object form
// * possessive form
// * form of "to be" to use for the present tense
// * form of "to be" to use for the past tense
// * form of other verbs to use for the present tense
const pronouns = {
"I": ["me", "my", "am", "was", "VBP"],
"you": ["you", "your", "are", "were", "VBP"],
"he": ["him", "his", "is", "was", "VBZ"],
"she": ["her", "her", "is", "was", "VBZ"],
"he/she": ["him/her", "his/her", "is", "was", "VBZ"],
"his self": ["himself", "his own", "is", "was", "VBZ"],
"it": ["it", "its", "is", "was", "VBZ"],
"we": ["us", "our", "are", "were", "VBP"],
"they": ["them", "their", "are", "were", "VBP"],
}
class Tree {
constructor() {
this.word = null;
this.translation = null;
this.children = [];
this.roles = [];
this.penalty = 0;
this.errors = [];
}
penalize(penalty) {
this.penalty += penalty;
}
error(penalty, error) {
this.penalty += penalty;
this.errors.push(error);
}
getPenalty() {
let penalty = this.penalty;
for (let i = 0; i < this.children.length; i++) {
penalty += this.children[i].getPenalty();
}
return penalty;
}
getErrors() {
let errors = [...this.errors];
for (let i = 0; i < this.children.length; i++) {
errors = errors.concat(this.children[i].getErrors());
}
return errors;
}
}
class SentenceTree extends Tree {
constructor(clause) {
super();
this.verb = null;
this.verbType = "vcp"; // by default, assume omitted "lu"
this.verbRest = [];
this.subjective = null;
this.predicate = null;
this.predicateType = null;
this.agentive = null;
this.patientive = null;
this.genitive = null;
this.adverbials = [];
this.datives = [];
// first find the verb and its type
let lastVerbSeen = this; // where we'll attach more verbs
let hasModal = false;
for (let i = 0; i < clause.length; i++) {
let part = clause[i];
if (part.type === 'vin' || part.type === 'vtr' ||
part.type === 'vcp' || part.type === 'vm' ||
part.type === 'vsi') {
if (this.verb) {
if (this.verbType !== "vm") {
this.error(1, "The two verbs [" + this.verb.value +
"] and [" +
part.clause.value + "] cannot be in the same clause");
} else {
// TODO make sure this thing has <iv>
hasModal = true;
this.verbRest.push((part.type === 'vsi') ? part.siComplement : part.clause);
let newVerb = new VerbTree((part.type === 'vsi') ?
part.siComplement : part.clause);
lastVerbSeen.children.push(newVerb);
lastVerbSeen.roles.push('dependent verb');
lastVerbSeen = newVerb;
}
} else {
this.verb = (part.type === 'vsi') ? part.siComplement : part.clause;
if (part.negation) {
this.negation = part.negation;
this.children.push(this.negation);
this.roles.push('negation');
}
}
this.verbType = part.type;
if (this.verbType === 'vsi') {
this.verbType = 'vin';
}
}
}
// now collect the other parts of the sentence
for (let i = 0; i < clause.length; i++) {
let part = clause[i];
if (part['type'] !== 'vin' && part['type'] !== 'vtr' &&
part['type'] !== 'vcp' && part['type'] !== 'vm' &&
part['type'] !== 'vsi') {
let role = null;
if (part['type'] === 'subjective') {
if (!this.subjective &&
(!this.verbType !== "vtr")) {
this.subjective = part['clause'];
role = 'subjective';
} else if (!this.predicate && this.verbType === "vcp") {
this.predicate = part['clause'];
role = 'predicate';
this.predicateType = 'noun';
} else if (this.verbType === "vin") {
this.error(1, "The two subjectives [" +
this.subjective.word +
"] and [" + part.clause.word +
"] cannot be in the same clause");
} else if (this.verb) {
this.error(1, "Subjective [" + part.clause.word +
"] cannot be used with transitive verb [" +
this.verb['value'] + "]");
}
}
if (part['type'] === 'agentive') {
if (this.verb && this.verbType !== "vtr") {
this.error(1, "Agentive [" + part.clause.word +
"] cannot be used with intransitive verb [" +
this.verb['value'] + "]");
} else if (this.agentive) {
this.error(1, "The two agentives [" +
this.agentive.word +
"] and [" + part.clause.word +
"] cannot be in the same clause");
} else if (this.subjective) {
this.error(1, "The agentive [" +
part.clause.word +
"] cannot go together with the subjective [" +
this.subjective.word +
"] in the same clause");
} else {
this.agentive = part['clause'];
role = 'agentive';
}
}
if (part['type'] === 'patientive') {
if (this.verb && this.verbType !== "vtr") {
this.error(1, "Patientive [" + part.clause.word +
"] cannot be used with intransitive verb [" +
this.verb['value'] + "]");
} else if (this.patientive) {
this.error(1, "The two patientives [" +
this.patientive.word +
"] and [" + part.clause.word +
"] cannot be in the same clause");
} else if (this.subjective && !hasModal) {
this.error(1, "The patientive [" +
part.clause.word +
"] cannot go together with the subjective [" +
this.subjective.word +
"] in the same clause");
} else {
this.patientive = part['clause'];
role = 'patientive';
}
}
if (part['type'] === 'dative') {
this.datives.push(part['clause']);
role = 'dative';
}
if (part['type'] === 'genitive') {
if (!this.predicate && this.verbType === "vcp") {
this.predicate = part['clause'];
role = 'predicate';
this.predicateType = 'genitive';
} else {
this.error(1, "Genitive [" +
part.clause.word +
"] does not belong to any noun");
}
}
if (part['type'] === 'adjective') {
if (!this.predicate && this.verbType === "vcp") {
this.predicate = part['clause'];
role = 'predicate';
this.predicateType = 'adjective';
} else if (this.verbType === "vcp") {
if (role === "predicate (genitive)") {
this.error(1, "Genitive [" +
this.predicate.word +
"] does not connect to any noun");
} else {
this.error(1, "The words [" +
this.predicate.word +
"] and [" +
part.clause.word +
"] cannot both be predicates in the same clause");
}
} else {
this.error(1, "Adjective [" +
part.clause.word +
"] cannot be used predicatively with a non-copula " +
"verb (did you mean to use an adverb instead?)");
}
}
if (part['type'] === 'adverbial') {
this.adverbials.push(part['clause']);
role = 'adverbial';
}
if (role) {
// special case: put most elements on the main verb
if ((role !== 'subjective' && role !== 'agentive')
&& this.verbRest.length > 0) {
lastVerbSeen.children.push(part['clause']);
lastVerbSeen.roles.push(role);
} else {
this.children.push(part['clause']);
this.roles.push(role);
}
}
}
}
if (this.verb) {
this.word = this.verb['value'];
this.translation = getTranslation(this.verb, "v");
}
// Special penalties:
// omitting a verb is rare and should be avoided
if (!this.verb) {
this.penalize(0.1);
}
// slight penalty for intransitive verb usage, because if both
// transitive and intransitive usages of a verb are possible we don't
// want to show both separately
if (this.verbType === "vin") {
this.penalize(0.001);
}
}
translate() {
let subject = [];
let subjectPlural = true;
if (this.subjective) {
subject = [this.subjective.translate()];
subjectPlural = this.subjective.isPlural();
}
if (this.agentive) {
subject = [this.agentive.translate()];
subjectPlural = this.agentive.isPlural();
}
//if (subject.length === 0) {
// subject = ['(something)'];
//}
let object = [];
if (this.patientive) {
object = [this.patientive.translate("object")];
}
if (this.predicate) {
if (this.predicateType === "genitive") {
object = ['of', this.predicate.translate("object")];
} else {
object = [this.predicate.translate("object")];
}
}
//let verb = ["(verb omitted)"];
let verb = [];
if (this.verb) {
verb = getShortTranslation(this.verb, "v").split(' ');
if (verb[0] === "be") {
if (this.negation) {
verb = ['be', 'not'].concat(verb.splice(1));
}
verb[0] = subjectPlural ? "are" : "is";
if (pronouns.hasOwnProperty(subject[0])) {
verb[0] = pronouns[subject[0]][2];
}
} else {
if (this.negation) {
if (verb[0] === "can" || verb[0] === "will") {
verb = [verb[0], 'not'].concat(verb.splice(1));
} else {
verb = ['do', 'not'].concat(verb);
}
}
let form = subjectPlural ? "VBP" : "VBZ";
if (pronouns.hasOwnProperty(subject[0])) {
form = pronouns[subject[0]][4];
}
verb[0] = new Inflectors(verb[0]).conjugate(form);
}
} else {
if (this.subjective
&& !this.agentive && !this.patientive && !this.topical
&& (this.genitive || this.predicate || this.datives.length > 0)) {
verb[0] = subjectPlural ? "are" : "is";
if (pronouns.hasOwnProperty(subject[0])) {
verb[0] = pronouns[subject[0]][2];
}
}
}
for (let i = 0; i < this.verbRest.length; i++) {
verb.push(getShortTranslation(this.verbRest[i], "v"));
}
let adverbials = [];
if (this.adverbials) {
for (let i = 0; i < this.adverbials.length; i++) {
let adv = this.adverbials[i];
adverbials = adverbials.concat([adv.translate()]);
}
}
if (this.datives) {
for (let i = 0; i < this.datives.length; i++) {
let dative = this.datives[i];
adverbials = adverbials.concat(['to', dative.translate('object')]);
}
}
return subject.concat(verb).concat(object).concat(adverbials).join(' ');
}
}
class NounClauseTree extends Tree {
constructor(clause) {
super();
this.clause = clause;
this.word = this.clause['noun']['value'];
this.translation = getTranslation(this.clause['noun'], 'n_');
if (this.clause['adjectives']) {
this.adjectives = [];
for (let i = 0; i < this.clause['adjectives'].length; i++) {
let adjective = this.clause['adjectives'][i];
this.adjectives.push(adjective);
this.children.push(adjective);
this.roles.push('adjective');
}
}
if (this.clause['subclauses']) {
this.subclauses = [];
for (let i = 0; i < this.clause['subclauses'].length; i++) {
let subclause = this.clause['subclauses'][i];
this.subclauses.push(subclause);
this.children.push(subclause);
this.roles.push('subclause');
}
}
if (this.clause['possessives']) {
for (let i = 0; i < this.clause['possessives'].length; i++) {
this.possessive = this.clause['possessives'][i];
this.children.push(this.possessive);
this.roles.push('possessive');
}
}
}
isPlural() {
let definition = this.clause['noun']['definition'][0];
try {
let prefix = definition['conjugated'][0]['conjugation']['affixes'][1];
return prefix !== "";
} catch (e) {
return false;
}
}
translate(nounCase) {
let noun = getShortTranslation(this.clause['noun'], "n_");
//let determiner = ["a/the"];
let determiner = [];
let possessor = [];
let adjectives = [];
let subclauses = [];
let definition = this.clause['noun']['definition'][0];
// special case: proper nouns
if (definition['type'] === "n:pr") {
noun = this.clause['noun']['definition'][0]['na\'vi'];
determiner = [];
}
// special case: pronouns
if (pronouns.hasOwnProperty(noun) || noun === "this" || noun === "that") {
determiner = [];
}
if (pronouns.hasOwnProperty(noun)) {
if (nounCase === "object") {
noun = pronouns[noun][0];
} else if (nounCase === "possessive") {
noun = pronouns[noun][1];
}
} else {
if (nounCase === "possessive") {
noun += "'s";
}
}
// handle affixes
let plural = this.isPlural();
let postNoun = [];
switch (definition['conjugated'][0]['conjugation']['affixes'][1]) {
case 'me':
determiner = ['two'];
break;
case 'pxe':
determiner = ['three'];
break;
case 'ay':
case '(ay)':
determiner = [];
break;
}
switch (definition['conjugated'][0]['conjugation']['affixes'][0]) {
case 'fì':
determiner = [plural ? 'these' : 'this'];
break;
case 'tsa':
determiner = [plural ? 'those' : 'that'];
break;
case 'pe':
determiner = ['which'];
break;
case 'fra':
determiner = ['every'];
break;
}
switch (definition['conjugated'][0]['conjugation']['affixes'][4]) {
case 'pe':
determiner = ['which'];
break;
case 'o':
determiner = ['some'];
break;
}
switch (definition['conjugated'][0]['conjugation']['affixes'][3]) {
case 'tsyìp':
noun = "little " + noun;
break;
case 'fkeyk':
postNoun = ['of ' + noun];
noun = 'state';
break;
}
switch (definition['conjugated'][0]['conjugation']['affixes'][2]) {
case 'fne':
postNoun = ['of ' + noun];
noun = 'type';
break;
}
if (plural) {
noun = new Inflectors(noun).toPlural();
}
// handle possessives attached to this noun
if (this.possessive) {
let possessiveTranslation = this.possessive.translate("object");
if (possessiveTranslation.split(' ').length === 1) {
determiner = [this.possessive.translate("possessive")];
} else {
possessor = ["of", possessiveTranslation];
}
}
if (this.adjectives) {
for (let i = 0; i < this.adjectives.length; i++) {
adjectives = adjectives.concat([this.adjectives[i].translate()]);
}
if (adjectives[0] === adjectives[1]) {
adjectives[0] = "very";
}
}
if (this.subclauses) {
for (let i = 0; i < this.subclauses.length; i++) {
subclauses = subclauses.concat(["that", this.subclauses[i].translate()]);
}
}
return determiner.concat(adjectives).concat([noun]).concat(postNoun)
.concat(possessor).concat(subclauses).join(' ');
}
}
class AdpositionClauseTree extends Tree {
constructor(adposition, nounClause) {
super();
this.clause = adposition;
this.word = this.clause['value'];
this.translation = getTranslation(adposition, "adp");
this.nounClause = nounClause;
this.roles.push('noun');
this.children.push(nounClause);
}
translate() {
let translation = [getShortTranslation(this.clause, "adp")];
translation.push(this.nounClause.translate("object"));
return translation.join(' ');
}
}
class VerbTree extends Tree {
constructor(clause) {
super();
this.clause = clause;
this.word = this.clause['value'];
this.translation = getTranslation(this.clause, "v");
}
translate() {
let translation = getShortTranslation(this.clause, "v");
return translation;
}
}
class AdjectiveTree extends Tree {
constructor(clause) {
super();
this.clause = clause;
this.word = this.clause['value'];
this.translation = getTranslation(this.clause, "adj");
}
translate() {
let translation = getShortTranslation(this.clause, "adj");
return translation;
}
}
class AdverbialTree extends Tree {
constructor(clause) {
super();
this.clause = clause;
this.word = this.clause['value'];
this.translation = getTranslation(this.clause, "adv");
}
translate() {
let translation = getShortTranslation(this.clause, "adv");
return translation;
}
}
class ParticleTree extends Tree {
constructor(clause) {
super();
this.clause = clause;
this.word = this.clause['value'];
this.translation = getTranslation(this.clause, "part");
}
translate() {
let translation = getShortTranslation(this.clause, "part");
return translation;
}
}
function makeTester(name) {
return {
'test': x => x['types'].includes(name)
};
}
const n_subjective = makeTester('n_subjective');
const n_agentive = makeTester('n_agentive');
const n_patientive = makeTester('n_patientive');
const n_dative = makeTester('n_dative');
const n_genitive = makeTester('n_genitive');
const n_topical = makeTester('n_topical');
const n_adposition = makeTester('n_adposition');
const vsi_comp = makeTester('vsi_comp');
const vin = makeTester('vin');
const vtr = makeTester('vtr');
const vcp = makeTester('vcp');
const vm = makeTester('vm');
const vsi = makeTester('vsi');
const adj = makeTester('adj');
const adj_left = makeTester('adj_left');
const adj_right = makeTester('adj_right');
const adv = makeTester('adv');
const adp = makeTester('adp');
const a_left = makeTester('a_left');
const a_right = makeTester('a_right');
const ma = makeTester('ma');
const ke = makeTester('ke');
let processSentence = function (data) {
return new SentenceTree(data[0]);
}
let processNounClause = function (data) {
let result = {
'noun' : data[3]
};
let adjs = [];
if (data[2]) {
adjs = adjs.concat([new AdjectiveTree(data[2])]);
}
if (data[4]) {
adjs = adjs.concat([new AdjectiveTree(data[4])]);
}
if (adjs.length > 0) {
result['adjectives'] = adjs;
}
let subs = [];
if (data[1]) {
subs = subs.concat([data[1][0]]);
}
if (data[5]) {
subs = subs.concat([data[5][1]]);
}
if (subs.length > 0) {
result['subclauses'] = subs;
}
let possessives = [];
if (data[0]) {
possessives = possessives.concat([data[0][0]]);
}
if (data[6]) {
possessives = possessives.concat([data[6][0]]);
}
if (possessives.length > 0) {
result['possessives'] = possessives;
}
return new NounClauseTree(result);
};
let processParticle = function (data) {
return new ParticleTree(data[0]);
}
%}
### SENTENCE PARTS ###
sentence -> sentence_part:+ {% processSentence %}
sentence_part -> v_clause {% id %}
sentence_part -> n_clause_subjective {% (data) => ({'type': 'subjective', 'clause': data[0]}) %}
sentence_part -> n_clause_agentive {% (data) => ({'type': 'agentive', 'clause': data[0]}) %}
sentence_part -> n_clause_patientive {% (data) => ({'type': 'patientive', 'clause': data[0]}) %}
sentence_part -> n_clause_dative {% (data) => ({'type': 'dative', 'clause': data[0]}) %}
sentence_part -> n_clause_genitive {% (data) => ({'type': 'genitive', 'clause': data[0]}) %}
sentence_part -> n_clause_topical {% (data) => ({'type': 'topical', 'clause': data[0]}) %}
sentence_part -> %adj {% (data) => ({'type': 'adjective', 'clause': new AdjectiveTree(data[0])}) %}
sentence_part -> adverbial {% id %}
### VERB CLAUSES ###
v_clause -> negation:? verb {% (data) => ({
'type': data[1]['type'],
'clause': data[1]['clause'],
'siComplement': data[1]['siComplement'],
'negation': data[0]
}) %}
negation -> %ke {% processParticle %}
verb -> %vin {% (data) => ({'type': 'vin', 'clause': data[0]}) %}
verb -> %vtr {% (data) => ({'type': 'vtr', 'clause': data[0]}) %}
verb -> %vcp {% (data) => ({'type': 'vcp', 'clause': data[0]}) %}
verb -> %vm {% (data) => ({'type': 'vm', 'clause': data[0]}) %}
verb -> %vsi_comp %vsi {% (data) => ({'type': 'vsi', 'clause': data[1], 'siComplement': data[0]}) %}
### NOUN CLAUSES ###
n_clause_subjective ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_subjective %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_agentive ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_agentive %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_patientive ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_patientive %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_dative ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_dative %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_genitive ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_genitive %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_topical ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_topical %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
n_clause_adposition ->
(n_clause_genitive):?
(sentence %a_left):?
%adj_left:? %n_adposition %adj_right:?
(%a_right sentence):?
(n_clause_genitive):?
{% processNounClause %}
### ADVERBIALS ###
adverbial -> %adv {%
function (data) {
return {
'type': 'adverbial',
'clause': new AdverbialTree(data[0])
};
}
%}
adverbial -> %adp n_clause_subjective {%
function (data) {
return {
'type': 'adverbial',
'clause': new AdpositionClauseTree(data[0], data[1])
};
}
%}
adverbial -> n_clause_adposition {%
function (data) {
const affixes = data[0]['clause']['noun']['definition'][0]['affixes'];
const affix = affixes[affixes.length - 1]['affix'];
const affixObject = {
'value': affix["na'vi"],
'types': [affix["type"]],
'definition': [affix]
};
return {
'type': 'adverbial',
'clause': new AdpositionClauseTree(affixObject, data[0])
};
}
%}