File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { writeFile } from "../deps.ts" ;
2
- import { convertJsonToTsv } from "./convert.ts" ;
3
- import type { CombineDictionaries , IMEType , Insert } from "../model.ts" ;
2
+ import type {
3
+ CombineDictionaries ,
4
+ Dictionaries ,
5
+ IMEType ,
6
+ Insert ,
7
+ } from "../model.ts" ;
4
8
5
9
/** ファイル出力ログを生成 */
6
10
const outputBuildLog = ( pathname : string ) =>
@@ -15,14 +19,19 @@ export const generateDictionaryFile = async (data: string, path: string) => {
15
19
/** 単語のまとまりごとにユーザー辞書ファイルを生成 */
16
20
export const generateDictionaryFileByType = async (
17
21
basePath : string ,
22
+ converter : (
23
+ dictionaries : Dictionaries ,
24
+ imeType : IMEType ,
25
+ insert ?: Insert ,
26
+ ) => string ,
18
27
combineDictionaries : CombineDictionaries ,
19
28
imeType : IMEType ,
20
29
insert ?: Insert ,
21
30
) => {
22
31
for ( const dictionary in combineDictionaries ) {
23
32
const filepath = `${ basePath } /${ imeType } _${ dictionary . toLowerCase ( ) } .txt` ;
24
33
await generateDictionaryFile (
25
- convertJsonToTsv ( combineDictionaries [ dictionary ] , imeType , insert ) ,
34
+ converter ( combineDictionaries [ dictionary ] , imeType , insert ) ,
26
35
filepath ,
27
36
) ;
28
37
}
Original file line number Diff line number Diff line change @@ -46,12 +46,14 @@ export const buildDictionaryFile = async (
46
46
if ( combineDictionaries ) {
47
47
await generateDictionaryFileByType (
48
48
basePath ,
49
+ convertJsonToCsv ,
49
50
combineDictionaries ,
50
51
"google" ,
51
52
{ after : "\n" } ,
52
53
) ;
53
54
await generateDictionaryFileByType (
54
55
basePath ,
56
+ convertJsonToTsv ,
55
57
combineDictionaries ,
56
58
"kotoeri" ,
57
59
) ;
You can’t perform that action at this time.
0 commit comments