Skip to content

Commit

Permalink
English: handle verb prefixes kinda
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn committed Aug 26, 2023
1 parent 1de58e4 commit 7a670a8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/english.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@ function leafToEnglish(leaf: Tree): string {
return new Glosser(true).glossWord(leafText(leaf));
}

function verbToEnglish(tree: Tree): string {
if ('word' in tree) {
return leafToEnglish(tree);
} else if ('left' in tree) {
return verbToEnglish(tree.left) + verbToEnglish(tree.right);
} else {
throw new Error('weird verb');
}
}

function serialToEnglish(serial: Tree): string {
if ('word' in serial && serial.word === 'covert') return '';
if (serial.label !== '*Serial') throw new Error('non-*Serial serial');
if (!('children' in serial)) throw new Error('non-Rose serial');
return serial.children.map(x => leafToEnglish(x)).join('-');
return serial.children.map(x => verbToEnglish(x)).join('-');
}

class ClauseTranslator {
Expand Down

0 comments on commit 7a670a8

Please sign in to comment.