database - 字典数据库大小——哪些算法和策略让它如此轻便?

标签 database algorithm optimization wordnet

我正在浏览像 wordnet 这样的开放式词典的数据库大小它的数据库 大小接近52 MB。但是我在 Google Play 上看到了一些离线词典应用程序,比如

1 : http://wordnet.princeton.edu/ English Dictionary使用维基词典数据库的应用程序。我不知道他们如何设法提供只有 15 MB 大小且超过 167000 个单词的离线词典

在数据库中保存单词的方式可能是什么?

最佳答案

Wordnet 在较小的内存占用方面具有相当大的优势。

如何? - 这是简要图片:

words are stored into index files for fast search - index.noun, index.adj, etc.

relation between word and offset in definition file - data.noun, etc is provided.

each of line in definition file corresponds to one definition and relationships between words are marked by a symbol and offset. eg. ! for antonym, @ for kind of, etc.

This makes the whole thing pretty compact.

有关此内容的更多信息,请阅读:man 5 wndb

关于尺寸: 52MB = 52000KB

对于 Wordnet 中大约 180K 的单词 - 每个单词有 52000K/180K ~ 300bytes。

平均约 300 个字节来表示定义 + 关系 - 足够好。 例如(大约)平均每 4 个定义(20 个字符)、2 个用法(20 个字符)、关系开销(10 个关系)

关于database - 字典数据库大小——哪些算法和策略让它如此轻便?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22118062/

相关文章:

database - 相册 table 设计

mysql - 当您认识 parent 时如何搜索特定的 child ?

c# - 如何在c#中实现一个循序渐进的按钮?

algorithm - 将 M 人分成 N 个团队,并设置比例限制

C++ const引用参数优化

database - 如何解决A/B key问题?

mysql - CodeIgniter 验证类是否可以防止 SQL 注入(inject)?

algorithm - 冒泡排序算法分析

algorithm - Quicksort - 具有重复值的 Hoare 分区

c# - 优化.NET中大系列数据的存储和处理