Coder Social home page Coder Social logo

Comments (1)

KnIfER avatar KnIfER commented on June 17, 2024

可以参考他 github/zhansliu/writemdict 的文档,或者 python analysis


mdx有两级的二分法索引结构。搜索 keyword 时先搜索第一级,第一级由所有词块的块首、块尾单词组成,每个词块包含2~3k单词,但是搜索第一级索引时,词块数据(key block)并未加载,而是加载了构成第一级索引的词块信息数据(key info block)。

搜索第一级得到搜索词可能落于哪个词块,然后加载它,再在这2k单词内进行二分搜索(参考getEntryAt、Lookup)。搜索到具体词条后,会得到词条解释内容的文件偏移。


所有的解释内容也分成两级结构,第一级是记录块信息(record block info),第二级是记录块本身(record block)。各个信息块大小固定(4 * 2或8 * 2字节),看参考图,记录块信息只有两个信息:所对应记录块的存储(压缩)大小、解压大小。程序把所有信息块扫入解析,之后就可以按其信息寻址,找到解释内容(参考 getRecordData、getRecordAt)。

各个记录块按顺序记录,一个记录块可包含整数多个词条内容。


num(词条信息块)==num(词条块)==var0

num(记录信息块)==num(记录块)==var1

var0 != var1

数值都由压制时指定的期望区块大小决定。

from mdict-java.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.