diff --git a/src/english.ts b/src/english.ts index 9c4c47d..ab99cf5 100644 --- a/src/english.ts +++ b/src/english.ts @@ -47,7 +47,9 @@ class ClauseTranslator { toaqAspect: string = 'tam'; negative: boolean = false; subject?: string = undefined; + earlyAdjuncts: string[] = []; objects: string[] = []; + lateAdjuncts: string[] = []; modals: string[] = []; constructor(toaqSpeechAct?: string) { this.toaqSpeechAct = toaqSpeechAct; @@ -66,11 +68,24 @@ class ClauseTranslator { if ('children' in node) { if (node.label !== '*𝘷P') throw new Error('non-*𝘷P Rose'); this.verb = serialToEnglish(node.children[0]); - if (node.children[1]) { - this.subject = treeToEnglish(node.children[1]); - } - for (let i = 2; i < node.children.length; i++) { - this.objects.push(treeToEnglish(node.children[i])); + let late = false; + for (let i = 1; i < node.children.length; i++) { + const child = node.children[i]; + const english = treeToEnglish(child); + if (child.label === 'AdjunctP') { + if (late) { + this.lateAdjuncts.push(english); + } else { + this.earlyAdjuncts.push(english); + } + } else { + if (this.subject) { + this.objects.push(english); + } else { + this.subject = english; + } + late = true; + } } break; } else if ('left' in node) { @@ -189,19 +204,23 @@ class ClauseTranslator { tense, aspect, auxiliary, + ...this.earlyAdjuncts, this.subject ?? '', this.verb ?? '', ...this.objects, + ...this.lateAdjuncts, ]; } else { order = [ complementizer, + ...this.earlyAdjuncts, this.subject ?? '', tense, aspect, auxiliary ?? '', this.verb ?? '', ...this.objects, + ...this.lateAdjuncts, ]; }