1
- import { nullableAsArray , repeatWithSpace } from "../../misc/misc.ts" ;
1
+ import { nullableAsArray } from "../../misc/misc.ts" ;
2
2
import { ArrayResult } from "../array_result.ts" ;
3
3
import { dictionary } from "../dictionary.ts" ;
4
4
import * as TokiPona from "../parser/ast.ts" ;
5
5
import { definitionAsPlainString } from "./as_string.ts" ;
6
6
import * as English from "./ast.ts" ;
7
7
import { clause , contextClause , unwrapSingleWord } from "./clause.ts" ;
8
- import { FilteredError , TranslationTodoError } from "./error.ts" ;
9
- import { noEmphasis } from "./word.ts" ;
10
- import { fromSimpleDefinition } from "./word_unit.ts" ;
8
+ import { TranslationTodoError } from "./error.ts" ;
9
+ import { noEmphasis , word } from "./word.ts" ;
10
+ import { fromSimpleDefinition , getReduplicationCount } from "./word_unit.ts" ;
11
11
12
12
function filler ( filler : TokiPona . Filler ) : ArrayResult < string > {
13
13
switch ( filler . type ) {
@@ -64,26 +64,6 @@ function emphasisAsPunctuation(
64
64
return `${ questionMark } ${ exclamationMark } ` ;
65
65
}
66
66
}
67
- function anuSeme ( seme : TokiPona . HeadedWordUnit ) : English . Clause {
68
- let interjection : string ;
69
- switch ( seme . type ) {
70
- case "default" :
71
- interjection = "right" ;
72
- break ;
73
- case "reduplication" :
74
- interjection = repeatWithSpace ( "right" , seme . count ) ;
75
- break ;
76
- case "x ala x" :
77
- throw new FilteredError ( '"seme ala seme"' ) ;
78
- }
79
- return {
80
- type : "interjection" ,
81
- interjection : {
82
- word : interjection ,
83
- emphasis : seme . emphasis != null ,
84
- } ,
85
- } ;
86
- }
87
67
function sentence (
88
68
sentence : TokiPona . Sentence ,
89
69
isFinal : boolean ,
@@ -103,7 +83,17 @@ function sentence(
103
83
) ,
104
84
) ;
105
85
}
106
- const useAnuSeme = nullableAsArray ( sentence . anuSeme ) . map ( anuSeme ) ;
86
+ const useAnuSeme = nullableAsArray ( sentence . anuSeme )
87
+ . map ( ( seme ) =>
88
+ ( {
89
+ type : "interjection" ,
90
+ interjection : word ( {
91
+ word : "right" ,
92
+ reduplicationCount : getReduplicationCount ( seme ) ,
93
+ emphasis : seme . emphasis != null ,
94
+ } ) ,
95
+ } ) as const
96
+ ) ;
107
97
const interjectionClause : ArrayResult < English . Clause > =
108
98
sentence . contextClauses . length === 0 &&
109
99
sentence . startingParticle == null
0 commit comments