@@ -76,12 +76,41 @@ function sentence(
76
76
: sentence . punctuation ;
77
77
switch ( sentence . type ) {
78
78
case "simple" : {
79
+ let startingAdverb : IterableResult < null | English . Word > ;
80
+ let startingConjunction : null | English . Word ;
79
81
if ( sentence . startingParticle != null ) {
80
- return IterableResult . errors ( [
81
- new TranslationTodoError (
82
- `"${ sentence . startingParticle . word } " starting particle` ,
83
- ) ,
84
- ] ) ;
82
+ const { startingParticle } = sentence ;
83
+ const emphasis = startingParticle . emphasis != null ;
84
+ const reduplicationCount = getReduplicationCount ( startingParticle ) ;
85
+ switch ( sentence . startingParticle . word as "taso" | "kin" | "anu" ) {
86
+ case "taso" :
87
+ startingAdverb = IterableResult . single ( null ) ;
88
+ startingConjunction = word ( {
89
+ reduplicationCount,
90
+ emphasis,
91
+ word : "but" ,
92
+ } ) ;
93
+ break ;
94
+ case "kin" :
95
+ startingAdverb = fromSimpleDefinition (
96
+ startingParticle ,
97
+ ( definition ) =>
98
+ definition . type === "adverb" ? definition . adverb : null ,
99
+ ) ;
100
+ startingConjunction = null ;
101
+ break ;
102
+ case "anu" :
103
+ startingAdverb = IterableResult . single ( null ) ;
104
+ startingConjunction = word ( {
105
+ reduplicationCount,
106
+ emphasis,
107
+ word : "or" ,
108
+ } ) ;
109
+ break ;
110
+ }
111
+ } else {
112
+ startingAdverb = IterableResult . single ( null ) ;
113
+ startingConjunction = null ;
85
114
}
86
115
const useAnuSeme = nullableAsArray ( sentence . anuSeme )
87
116
. map ( ( seme ) : English . Clause => ( {
@@ -113,21 +142,38 @@ function sentence(
113
142
} ) )
114
143
: IterableResult . empty ( ) ;
115
144
const clauses = IterableResult . combine (
145
+ startingAdverb ,
116
146
IterableResult . combine ( ...sentence . contextClauses . map ( contextClause ) )
117
147
. map ( ( clause ) => clause . flat ( ) ) ,
118
148
IterableResult . concat ( interjectionClause , clause ( sentence . finalClause ) ) ,
119
149
)
120
- . map ( ( [ contextClauses , lastClause ] ) => [
150
+ . map ( ( [ adverb , contextClauses , lastClause ] ) => [
151
+ ...nullableAsArray ( adverb )
152
+ . map ( ( adverb ) : English . Clause => ( { type : "adverb" , adverb } ) ) ,
121
153
...contextClauses ,
122
154
lastClause ,
123
155
...useAnuSeme ,
124
156
] ) ;
157
+ let withConjunction : IterableResult < ReadonlyArray < English . Clause > > ;
158
+ if ( startingConjunction != null ) {
159
+ withConjunction = clauses
160
+ . map < ReadonlyArray < English . Clause > > ( ( [ first , ...rest ] ) => [
161
+ {
162
+ type : "dependent" ,
163
+ conjunction : startingConjunction ,
164
+ clause : first ,
165
+ } ,
166
+ ...rest ,
167
+ ] ) ;
168
+ } else {
169
+ withConjunction = clauses ;
170
+ }
125
171
const usePunctuation = emphasisAsPunctuation ( {
126
172
emphasis : sentence . emphasis ,
127
173
interrogative : sentence . interrogative != null ,
128
174
originalPunctuation : punctuation ,
129
175
} ) ;
130
- return clauses . map ( ( clauses ) : English . Sentence => ( {
176
+ return withConjunction . map ( ( clauses ) : English . Sentence => ( {
131
177
clauses,
132
178
punctuation : usePunctuation ,
133
179
} ) ) ;
0 commit comments