#dictionary #parser #mdx #mdict

mdict-parser

Mdict 字典 mdx 文件解析器

2 个版本

0.1.1 2023年2月13日
0.1.0 2023年2月13日

解析器实现 中排名第 1797

MITGPL-3.0-or-later

23KB
559

mdict-parser

一个用于解析 mdict 字典的 Rust 项目。

简介

mdict-parser 是一个用于解析 mdict 字典的工具,mdict 是字典常用的文件格式。生成的输出格式可以很容易地用于其他目的,例如构建字典或与其他应用程序集成。

特性

解析 .mdx 文件到结构化格式 支持多值条目 用 Rust 编写以提高性能和安全性

使用方法

将以下内容添加到您的 Cargo.toml 文件中

[dependencies]
mdict-parser = "0.1.0"

将以下内容添加到您的 Cargo.toml 文件中

use mdict_parser::{parser, mdict::Record};

fn main() {
    let input = include_bytes!("../dictionary.mdx");
    let dict = parser::parse(input);

    // iter dictionary entries
    for key in dict.keys() {
      println!("{:?}" item)
    }

    // iter all dictionary records
    for item in dict.items() {
      println!("{:?}" item)
    }
}

未实现的功能

  • .mdd 文件格式支持
  • mdict v3 格式支持
  • 加密字典文件支持

许可证

mdict-parser 采用 MIT 许可证。

依赖关系

~16MB
~153K SLoC