@@ -4,6 +4,7 @@ import * as TokiPona from "../parser/ast.ts";
44import * as Composer from "../parser/composer.ts" ;
55import {
66 AdjectiveWithInWay ,
7+ combineAdjective ,
78 extractNegativeFromAdjective ,
89} from "./adjective.ts" ;
910import { extractNegativeFromMultipleAdverbs , NOT } from "./adverb.ts" ;
@@ -21,7 +22,12 @@ import {
2122 AdverbialModifier ,
2223 multipleModifiers ,
2324} from "./modifier.ts" ;
24- import { extractNegativeFromNoun , fromNounForms , PartialNoun } from "./noun.ts" ;
25+ import {
26+ combineNoun ,
27+ extractNegativeFromNoun ,
28+ fromNounForms ,
29+ PartialNoun ,
30+ } from "./noun.ts" ;
2531import {
2632 extractNegativeFromPreposition ,
2733 nounAsPreposition ,
@@ -291,48 +297,6 @@ export function phrase(
291297 return IterableResult . errors ( [ new TranslationTodoError ( phrase . type ) ] ) ;
292298 }
293299}
294- function compoundNoun (
295- conjunction : string ,
296- phrases : ReadonlyArray < English . NounPhrase > ,
297- ) : English . NounPhrase {
298- const nouns = phrases
299- . flatMap ( ( noun ) => {
300- if (
301- noun . type === "compound" &&
302- noun . conjunction === conjunction
303- ) {
304- return noun . nouns ;
305- } else {
306- return [ noun ] ;
307- }
308- } ) ;
309- return {
310- type : "compound" ,
311- conjunction,
312- nouns,
313- } ;
314- }
315- function compoundAdjective (
316- conjunction : string ,
317- phrases : ReadonlyArray < English . AdjectivePhrase > ,
318- ) : English . AdjectivePhrase {
319- return {
320- type : "compound" ,
321- conjunction,
322- adjectives : phrases
323- . flatMap ( ( adjective ) => {
324- if (
325- adjective . type === "compound" &&
326- adjective . conjunction === conjunction
327- ) {
328- return adjective . adjectives ;
329- } else {
330- return [ adjective ] ;
331- }
332- } ) ,
333- emphasis : false ,
334- } ;
335- }
336300export function phraseAsVerb (
337301 phrase : PhraseTranslation ,
338302) : PartialVerb {
@@ -420,7 +384,7 @@ export function multiplePhrases(
420384 if ( phrase . every ( ( phrase ) => phrase . type === "noun" ) ) {
421385 return {
422386 type : "noun" ,
423- noun : compoundNoun (
387+ noun : combineNoun (
424388 conjunction ,
425389 phrase . map ( ( phrase ) => phrase . noun ) ,
426390 ) ,
@@ -431,7 +395,7 @@ export function multiplePhrases(
431395 } else {
432396 return {
433397 type : "adjective" ,
434- adjective : compoundAdjective (
398+ adjective : combineAdjective (
435399 conjunction ,
436400 phrase . map ( ( phrase ) => phrase . adjective ) ,
437401 ) ,
0 commit comments