Skip to content

Commit 974c46f

Browse files
committed
update fixer
1 parent f43e9f5 commit 974c46f

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/translator/fixer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ function rankNoun(noun: English.NounPhrase): number {
1515
function fixNounPhrase(noun: English.NounPhrase): English.NounPhrase {
1616
switch (noun.type) {
1717
case "simple":
18+
// if (noun.postAdjective != null && noun.prepositions.length > 0) {
19+
// throw new FilteredError("named noun with preposition");
20+
// }
21+
if (
22+
noun.postCompound != null && noun.postCompound.type === "simple" &&
23+
noun.postCompound.prepositions.length > 0
24+
) {
25+
new FilteredError(`preposition within "${noun.noun.word} X" phrase`);
26+
}
1827
return {
1928
...noun,
2029
determiners: fixMultipleDeterminers(noun.determiners),

src/translator/nanpa.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ export function nanpa(
2121
`${phrase.type} within "position X" phrase`,
2222
),
2323
)
24-
// TODO: do this on `fixer.ts` instead
25-
: (phrase.noun as English.NounPhrase & { type: "simple" })
26-
.prepositions.length > 0
27-
? throwError(
28-
new FilteredError('preposition within "position X" phrase'),
29-
)
3024
: {
3125
type: "simple",
3226
determiners: [],

src/translator/phrase.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ function nounPhrase(
6565
);
6666
const prepositions = nullableAsArray(modifier.ofPhrase)
6767
.map((object) => nounAsPreposition(object, "of"));
68-
// TODO: do this on `fixer.ts` instead
69-
if (prepositions.length > 0 && postAdjective != null) {
70-
throw new FilteredError("named noun with preposition");
71-
}
7268
const { nounPreposition } = modifier;
7369
const headNoun = fromNounForms(noun, quantity)
7470
.map(({ noun: useWord, quantity }): English.NounPhrase => ({

0 commit comments

Comments
 (0)