#dictionary #korean #crawler #hangul

bin+lib kodict

为 Rust 提供 Korean Dictionary 实现和爬虫

6 个版本

0.2.1 2019 年 1 月 26 日
0.2.0 2019 年 1 月 23 日
0.1.3 2018 年 11 月 29 日

173国际化 (i18n)

MIT 许可证

20KB
411

Kodict

Rust 的 Korean Dictionary 管理器

Crates.io Crates.io

更新日志

查看 CHANGELOG

特性

  • 从在线词典中爬取单词。
  • 从词典中查找给定的单词。
  • 读取和写入词典文件。

支持爬取的在线词典

爬取 标准韩国词典 并保存为 TSV 文件

extern crate kodict;

use kodict::{crawler, fs};
use std::path::Path;

fn main() {
    let words = crawler::get_standard_dictionary_words();
    fs::write_as_tsv(Path::new("./dictionary.tsv"), &words);
}

注意:爬取 Open Korean Dictionary 花费太多时间。您可以从 这里 下载。

解析从 Open Korean Dictionary 下载的 dictionary.zip/words0.xls

extern crate kodict;

use kodict::{Dictionary, parser};
use std::path::Path;

fn main() {
    let words = parser::parse_open_dictionary_xls(Path::new("./words0.xls"));
    let dictionary = Dictionary::new(words);
}

如果您想将 Open Korean DictionaryXLS 转换为 TSV,请使用 xls2tsv 可执行文件。

将词典目录转换为 TSV 文件

xls2tsv input_dir/ output.tsv

将词典文件转换为 TSV 文件

xls2tsv input.xls output.tsv

安装

  • 使用 cargo 安装。

  • 克隆仓库

git clone https://github.com/Astro36/kodict.git

用法

API 文档

查看 API

许可证

Copyright (c) 2019 Seungjae Park

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Kodict 根据 MIT 许可证 许可。

依赖项

~26MB
~539K SLoC