Skip to content

Commit aab0197

Browse files
committed
more information to english ast
1 parent 8179b05 commit aab0197

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

src/translator2/ast.ts

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import * as Dictionary from "../../dictionary/type.ts";
2+
3+
export type Word = Readonly<{
4+
word: string;
5+
emphasis: boolean;
6+
}>;
7+
export type Quantity = "singular" | "plural" | "condensed";
8+
export type AdjectiveName = Readonly<{ adjective: string; name: string }>;
9+
export type SimpleNounPhrase =
10+
& Dictionary.NounForms
11+
& Readonly<{
12+
determiners: ReadonlyArray<Determiner>;
13+
adjectives: ReadonlyArray<AdjectivePhrase>;
14+
reduplicationCount: number;
15+
wordEmphasis: boolean;
16+
quantity: Quantity;
17+
perspective: Dictionary.Perspective;
18+
adjectiveName: null | AdjectiveName;
19+
postCompound: null | NounPhrase;
20+
prepositions: ReadonlyArray<Preposition>;
21+
phraseEmphasis: boolean;
22+
}>;
23+
export type NounPhrase =
24+
| (Dictionary.NounForms & Readonly<{ type: "simple" }>)
25+
| Readonly<{
26+
type: "compound";
27+
conjunction: string;
28+
nouns: ReadonlyArray<NounPhrase>;
29+
}>;
30+
export type Determiner = Readonly<{
31+
kind: Dictionary.DeterminerType;
32+
determiner: Word;
33+
quantity: Dictionary.Quantity;
34+
}>;
35+
export type AdjectivePhrase =
36+
| Readonly<{
37+
type: "simple";
38+
kind: Dictionary.AdjectiveType;
39+
adverbs: ReadonlyArray<Adverb>;
40+
adjective: Word;
41+
emphasis: boolean;
42+
}>
43+
| Readonly<{
44+
type: "compound";
45+
conjunction: string;
46+
adjectives: ReadonlyArray<AdjectivePhrase>;
47+
emphasis: boolean;
48+
}>;
49+
export type Complement =
50+
| Readonly<{ type: "noun"; noun: NounPhrase }>
51+
| Readonly<{ type: "adjective"; adjective: AdjectivePhrase }>;
52+
export type Adverb = Readonly<{
53+
adverb: Word;
54+
negative: boolean;
55+
}>;
56+
export type Verb =
57+
| (
58+
& Dictionary.VerbForms
59+
& Readonly<{
60+
type: "non-modal";
61+
reduplicationCount: number;
62+
emphasis: boolean;
63+
}>
64+
)
65+
| (Word & Readonly<{ type: "modal" }>);
66+
export type AdverbVerb = Readonly<{
67+
preAdverbs: ReadonlyArray<Adverb>;
68+
verb: Verb;
69+
postAdverb: null | Adverb;
70+
}>;
71+
export type SimpleVerbPhrase = Readonly<{
72+
verb: ReadonlyArray<AdverbVerb>;
73+
subjectComplement: null | Complement;
74+
contentClause: null | Clause;
75+
object: null | NounPhrase;
76+
objectComplement: null | Complement;
77+
prepositions: ReadonlyArray<Preposition>;
78+
hideVerb: boolean;
79+
}>;
80+
export type VerbPhrase =
81+
| (SimpleVerbPhrase & Readonly<{ type: "simple" }>)
82+
| Readonly<{
83+
type: "compound";
84+
conjunction: string;
85+
verbs: ReadonlyArray<VerbPhrase>;
86+
object: null | NounPhrase;
87+
objectComplement: null | Complement;
88+
prepositions: ReadonlyArray<Preposition>;
89+
}>;
90+
export type Clause =
91+
| Readonly<{
92+
type: "simple";
93+
subject: NounPhrase;
94+
verb: VerbPhrase;
95+
hideSubject: boolean;
96+
}>
97+
| Readonly<{ type: "subject phrase"; subject: NounPhrase }>
98+
| Readonly<{ type: "interjection"; interjection: Word }>
99+
| Readonly<{ type: "vocative"; call: string; addressee: NounPhrase }>
100+
| (Readonly<{ type: "preposition" }> & Preposition)
101+
| Readonly<{ type: "adverb"; adverb: Word }>
102+
| Readonly<{ type: "dependent"; conjunction: Word; clause: Clause }>;
103+
export type Preposition = Readonly<{
104+
adverbs: ReadonlyArray<Adverb>;
105+
preposition: Word;
106+
object: NounPhrase;
107+
emphasis: boolean;
108+
}>;
109+
export type Sentence = Readonly<{
110+
clauses: ReadonlyArray<Clause>;
111+
punctuation: string;
112+
}>;
113+
export type MultipleSentences =
114+
| Readonly<{ type: "free form"; text: string }>
115+
| Readonly<{ type: "sentences"; sentences: ReadonlyArray<Sentence> }>;

0 commit comments

Comments
 (0)