Skip to content

Commit fdce849

Browse files
committed
refactor
1 parent 7cbb66e commit fdce849

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

src/translator/adjective.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function compoundAdjective(
8282
]);
8383
}
8484
}
85-
export function rankAdjective(kind: Dictionary.AdjectiveType): number {
85+
function rankAdjective(kind: Dictionary.AdjectiveType) {
8686
return [
8787
"opinion",
8888
"size",

src/translator/as_string.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ import * as Dictionary from "../../dictionary/type.ts";
22
import { IterableResult } from "../compound.ts";
33
import { adjective, compoundAdjective } from "./adjective.ts";
44
import * as EnglishComposer from "./composer.ts";
5-
import { nounAsPlainString, simpleNounForms } from "./noun.ts";
5+
import { noun, simpleNounForms } from "./noun.ts";
66
import { pronoun } from "./pronoun.ts";
77
import { partialVerb, verb } from "./verb.ts";
88

9+
function nounAsPlainString(
10+
definition: Dictionary.Noun,
11+
): IterableResult<string> {
12+
return noun({ definition, reduplicationCount: 1, emphasis: false })
13+
.map((noun) => EnglishComposer.noun(noun, 0));
14+
}
915
export function definitionAsPlainString(
1016
definition: Dictionary.Definition,
1117
): IterableResult<string> {

src/translator/composer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function complement(complement: English.Complement) {
7171
return adjective(complement.adjective, 0);
7272
}
7373
}
74-
export function adverbVerb(verbAdverb: English.AdverbVerb): string {
74+
function adverbVerb(verbAdverb: English.AdverbVerb) {
7575
const { preAdverb, verb, postAdverb } = verbAdverb;
7676
return [
7777
...preAdverb.map(({ adverb }) => adverb),

src/translator/modifier.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ export type AdverbialModifier = Readonly<{
4343
export type MultipleModifierTranslation =
4444
| (Readonly<{ type: "adjectival" }> & AdjectivalModifier)
4545
| (Readonly<{ type: "adverbial" }> & AdverbialModifier);
46-
export function defaultModifier(
47-
wordUnit: TokiPona.WordUnit,
48-
): IterableResult<ModifierTranslation> {
46+
function defaultModifier(wordUnit: TokiPona.WordUnit) {
4947
const emphasis = wordUnit.emphasis != null;
5048
switch (wordUnit.type) {
5149
case "number":
@@ -148,9 +146,7 @@ export function defaultModifier(
148146
}
149147
}
150148
}
151-
export function pi(
152-
insidePhrase: TokiPona.Phrase,
153-
): IterableResult<ModifierTranslation> {
149+
function pi(insidePhrase: TokiPona.Phrase) {
154150
return phrase({
155151
phrase: insidePhrase,
156152
place: "object",

src/translator/noun.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { IterableResult } from "../compound.ts";
44
import { settings } from "../settings.ts";
55
import { adjective } from "./adjective.ts";
66
import * as English from "./ast.ts";
7-
import * as EnglishComposer from "./composer.ts";
87
import { determiner, extractNegativeFromDeterminers } from "./determiner.ts";
98
import { condense } from "./misc.ts";
109
import { word } from "./word.ts";
@@ -124,12 +123,6 @@ export function noun(
124123
emphasis: false,
125124
}));
126125
}
127-
export function nounAsPlainString(
128-
definition: Dictionary.Noun,
129-
): IterableResult<string> {
130-
return noun({ definition, reduplicationCount: 1, emphasis: false })
131-
.map((noun) => EnglishComposer.noun(noun, 0));
132-
}
133126
export function perspective(noun: English.NounPhrase): Dictionary.Perspective {
134127
switch (noun.type) {
135128
case "simple":

src/translator/verb.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ export type PartialCompoundVerb =
3838
}>
3939
& VerbObjects
4040
);
41-
export function condenseVerb(present: string, past: string): string {
41+
function condenseVerb(present: string, past: string) {
4242
const [first, ...rest] = present.split(" ");
4343
const second = past.split(" ")[0];
4444
return [condense(first, second), ...rest].join(" ");
4545
}
46-
export function addModal(
46+
function addModal(
4747
modal: string,
4848
verb: PartialVerb,
4949
takeNegative: boolean,
50-
): PartialVerb {
50+
) {
5151
if (verb.modal == null) {
5252
const newRest = nullableAsArray(verb.first)
5353
.map((first) => {
@@ -152,7 +152,7 @@ export function partialVerb(
152152
phraseEmphasis: false,
153153
}));
154154
}
155-
export function everyPartialVerb(
155+
function everyPartialVerb(
156156
verb: PartialCompoundVerb,
157157
): ReadonlyArray<PartialVerb> {
158158
switch (verb.type) {
@@ -175,13 +175,13 @@ export function forObject(verb: PartialCompoundVerb): boolean | string {
175175
}
176176
}
177177
// TODO: handle negatives
178-
export function fromVerbForms(
178+
function fromVerbForms(
179179
options: Readonly<{
180180
verbForms: Dictionary.VerbForms;
181181
perspective: Dictionary.Perspective;
182182
quantity: English.Quantity;
183183
}>,
184-
): IterableResult<Readonly<{ modal: null | string; verb: string }>> {
184+
) {
185185
const { verbForms, perspective, quantity } = options;
186186
const is = verbForms.presentSingular === "is";
187187
const presentSingular = is && perspective === "first"

0 commit comments

Comments
 (0)