Skip to content

Commit 5cdb9d4

Browse files
committed
implement verb negation
1 parent 6e01e50 commit 5cdb9d4

File tree

4 files changed

+203
-97
lines changed

4 files changed

+203
-97
lines changed

src/translator/phrase.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ function verbPhrase(
159159
...nullableAsArray(modifier.inWayPhrase)
160160
.map((object) => nounAsPreposition(object, "in")),
161161
];
162-
const adverb = [
163-
...[...modifier.adverb].reverse(),
164-
...verb.adverb,
165-
];
162+
const adverb = [...modifier.adverb].reverse();
166163
const extracted = extractNegativeFromAdverbs(adverb);
167164
if (extracted != null && extractNegativeFromAdverbs(extracted) != null) {
168165
throw new FilteredError("double negative");
@@ -172,9 +169,8 @@ function verbPhrase(
172169
if (verb.first != null) {
173170
return {
174171
...verb,
175-
first: { ...verb.first, negated },
176-
adverb: useAdverb,
177-
phraseEmphasis: emphasis,
172+
first: { ...verb.first, negated, adverb: useAdverb },
173+
emphasis: emphasis,
178174
preposition,
179175
};
180176
} else if (verb.modal != null) {
@@ -186,7 +182,7 @@ function verbPhrase(
186182
verb: verb.modal.verb,
187183
postAdverb,
188184
},
189-
phraseEmphasis: emphasis,
185+
emphasis: emphasis,
190186
preposition,
191187
};
192188
} else {
@@ -247,23 +243,23 @@ function prepositionAsVerb(preposition: English.Preposition) {
247243
const extracted = extractNegativeFromPreposition(preposition);
248244
return {
249245
modal: null,
250-
adverb: [],
251246
first: {
247+
adverb: [],
252248
presentPlural: "are",
253249
presentSingular: "is",
254250
past: "were",
255251
negated: extracted != null,
252+
reduplicationCount: 1,
253+
emphasis: false,
256254
},
257-
reduplicationCount: 1,
258-
wordEmphasis: false,
259255
rest: [],
260256
subjectComplement: null,
261257
object: null,
262258
objectComplement: null,
263259
preposition: [extracted ?? preposition],
264260
forObject: false,
265261
predicateType: null,
266-
phraseEmphasis: false,
262+
emphasis: false,
267263
};
268264
}
269265
export function phrase(
@@ -378,23 +374,23 @@ export function phraseAsVerb(
378374
return {
379375
type: "simple",
380376
modal: null,
381-
adverb: [],
382377
first: {
378+
adverb: [],
383379
presentPlural: "are",
384380
presentSingular: "is",
385381
past: "were",
386382
negated,
383+
emphasis: false,
384+
reduplicationCount: 1,
387385
},
388-
wordEmphasis: false,
389-
reduplicationCount: 1,
390386
rest: [],
391387
subjectComplement,
392388
object: null,
393389
objectComplement: null,
394390
preposition: [],
395391
forObject: false,
396392
predicateType: null,
397-
phraseEmphasis: false,
393+
emphasis: false,
398394
};
399395
}
400396
case "verb":

src/translator/predicate.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,45 @@ function applyToAndTurnInto(
4444
IterableResult.fromArray([
4545
{
4646
type: "simple",
47-
adverb: [],
4847
modal: null,
4948
first: {
49+
adverb: [],
5050
presentPlural: "apply",
5151
presentSingular: "applies",
5252
past: "applied",
5353
negated,
54+
reduplicationCount: 1,
55+
emphasis: false,
5456
},
55-
reduplicationCount: 1,
56-
wordEmphasis: false,
5757
rest: [],
5858
subjectComplement: null,
5959
object: predicate,
6060
objectComplement: null,
6161
preposition: [nounAsPreposition(object, "to")],
6262
forObject: false,
6363
predicateType: null,
64-
phraseEmphasis: false,
64+
emphasis: false,
6565
},
6666
{
6767
type: "simple",
68-
adverb: [],
6968
modal: null,
7069
first: {
70+
adverb: [],
7171
presentPlural: "turn",
7272
presentSingular: "turns",
7373
past: "turned",
7474
negated,
75+
reduplicationCount: 1,
76+
emphasis: false,
7577
},
76-
reduplicationCount: 1,
77-
wordEmphasis: false,
7878
rest: [],
7979
subjectComplement: null,
8080
object,
8181
objectComplement: null,
8282
preposition: [nounAsPreposition(predicate, "into")],
8383
forObject: false,
8484
predicateType: null,
85-
phraseEmphasis: false,
85+
emphasis: false,
8686
},
8787
])
8888
);
@@ -97,16 +97,16 @@ function make(predicate: AdjectiveWithInWay, object: English.NounPhrase) {
9797
)
9898
.map(([negated, adjective]) => ({
9999
type: "simple",
100-
adverb: [],
101100
modal: null,
102101
first: {
102+
adverb: [],
103103
presentPlural: "make",
104104
presentSingular: "makes",
105105
past: "made",
106106
negated,
107+
reduplicationCount: 1,
108+
emphasis: false,
107109
},
108-
reduplicationCount: 1,
109-
wordEmphasis: false,
110110
rest: [],
111111
subjectComplement: null,
112112
object,
@@ -118,7 +118,7 @@ function make(predicate: AdjectiveWithInWay, object: English.NounPhrase) {
118118
.map((phrase) => nounAsPreposition(phrase, "in")),
119119
forObject: false,
120120
predicateType: null,
121-
phraseEmphasis: false,
121+
emphasis: false,
122122
}));
123123
}
124124
function predicateVerb(

0 commit comments

Comments
 (0)