Skip to content

Commit 71f550a

Browse files
committed
move up filter
1 parent 1f0f0dc commit 71f550a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/translator.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ function modifier(modifier: TokiPona.Modifier): Output<ModifierTranslation> {
325325
return new Output([{ type: "name", name: modifier.words }]);
326326
case "pi":
327327
return phrase(modifier.phrase, "object")
328+
.filter((modifier) =>
329+
modifier.type !== "noun" || modifier.noun.type !== "simple" ||
330+
modifier.noun.preposition.length === 0
331+
)
328332
.filter((modifier) =>
329333
modifier.type != "adjective" || modifier.inWayPhrase != null
330334
);
@@ -408,10 +412,7 @@ function multipleModifiers(
408412
adverb.length === 0 &&
409413
name.length <= 1 &&
410414
inPositionPhrase.length <= 1 &&
411-
(noun.length === 0 || inPositionPhrase.length === 0) &&
412-
(noun.length === 0 ||
413-
(noun[0] as English.NounPhrase & { type: "simple" }).preposition
414-
.length === 0)
415+
(noun.length === 0 || inPositionPhrase.length === 0)
415416
) {
416417
adjectival = new Output([{
417418
type: "adjectival",
@@ -1295,3 +1296,4 @@ function multipleSentences(
12951296
export function translate(src: string): Output<Array<English.Sentence>> {
12961297
return parse(src).flatMap(multipleSentences);
12971298
}
1299+
translate("jan pi pona mute");

0 commit comments

Comments
 (0)