-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 人工檢查分詞系統產生的結果列表來了解為什麼沒有發生預期的轉換
- Loading branch information
1 parent
4ad089f
commit 5183324
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { async as FastGlob } from '@bluelovers/fast-glob/bluebird'; | ||
import { join } from 'upath2'; | ||
import { __root } from './__root'; | ||
import { outputJSON, readFile } from 'fs-extra'; | ||
import { initIdeaSegmentText } from '../lib/segment'; | ||
|
||
const cwd = join(__root, 'test', 'temp'); | ||
|
||
/** | ||
* 人工檢查分詞系統產生的結果列表來了解為什麼沒有發生預期的轉換 | ||
*/ | ||
export default FastGlob<string>([ | ||
'*.txt', | ||
], { | ||
cwd, | ||
}) | ||
.mapSeries(async (file) => | ||
{ | ||
const input = await readFile(join(cwd, file)).then(buf => buf.toString()); | ||
|
||
return initIdeaSegmentText() | ||
.then(seg => seg.doSegment(input)) | ||
.then(result => outputJSON(join(cwd, file + '.json'), result, { | ||
spaces: 2, | ||
})) | ||
; | ||
}) | ||
; |
Empty file.