sudachi-synonyms-parser
Sudachi's synonyms dictionary parser.
Features
Install
Install with npm:
npm install sudachi-synonyms-parser
Usage
export declare type SudachiSynonymsGroup = {
id: string;
items: SudachiSynonyms[];
};
export declare type SudachiSynonyms = {
taigenYogen: "体言" | "用言" | "未定義";
expandControl: 0 | 1 | 2;
vocabularyNumber: number | undefined;
gokeiSyubetsu: "代表語" | "対訳" | "別称" | "旧称" | "間違い" | "未定義";
ryakusyou: "代表語形" | "略語・略称/アルファベット" | "略語・略称" | "未定義";
hyoukiYure: "代表表記" | "アルファベット表記" | "異表記・表記ゆれ" | "間違い表記" | "未定義";
bunya: string[];
midashi: string;
};
export declare const parse: (text: string) => SudachiSynonymsGroup[];
export declare const parseSynonyms: (csv: string) => SudachiSynonymsGroup;
Example
import { parse } from "sudachi-synonyms-parser";
const content = fs.readFileSync(path.join(__dirname, "fixtures/synonyms.txt"), "utf-8");
const groups = parse(content);
assert.deepStrictEqual(groups[45], {
"id": "000050",
"items": [{
"taigenYogen": "体言",
"expandControl": 0,
"vocabularyNumber": 1,
"gokeiSyubetsu": "代表語",
"ryakusyou": "代表語形",
"hyoukiYure": "代表表記",
"bunya": ["IT"],
"midashi": "アドミニストレーター"
}, {
"taigenYogen": "体言",
"expandControl": 0,
"vocabularyNumber": 1,
"gokeiSyubetsu": "代表語",
"ryakusyou": "代表語形",
"hyoukiYure": "異表記・表記ゆれ",
"bunya": ["IT"],
"midashi": "アドミニストレータ"
}, {
"taigenYogen": "体言",
"expandControl": 0,
"vocabularyNumber": 1,
"gokeiSyubetsu": "代表語",
"ryakusyou": "代表語形",
"hyoukiYure": "アルファベット表記",
"bunya": ["IT"],
"midashi": "administrator"
}, {
"taigenYogen": "体言",
"expandControl": 0,
"vocabularyNumber": 1,
"gokeiSyubetsu": "代表語",
"ryakusyou": "略語・略称",
"hyoukiYure": "代表表記",
"bunya": ["IT"],
"midashi": "アドミニ"
}]
});
Changelog
See Releases page.
Running tests
Install devDependencies and Run npm test
:
npm test
Contributing
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
License
MIT © azu
This repository include synonyms.txt that is Apache License.
Copyright (c) 2017 Works Applications Co., Ltd.
https://github.com/WorksApplications/SudachiDict/blob/develop/LICENSE-2.0.txt