目录

MoonEmbed

MoonEmbed is a MoonBit-first library for working with word embeddings locally.

Repository links:

What it does

  • Load word2vec text embeddings
  • Load GloVe-style text embeddings
  • Load word2vec binary embeddings
  • Normalize vectors for cosine search
  • Search with a tiny bucketed approximate index and exact fallback
  • Provide a small CLI demo and test coverage

Why this shape

The contest page encourages a public repository, clear README, runnable example, CI, tests, and an OSI license. MoonEmbed stays focused on one practical niche: semantic word lookup without depending on Python or a database.

Contest readiness:

  • single contributor
  • commit history expanded into multiple meaningful steps
  • public-source-only implementation
  • clear source notes and OSI license

I deliberately kept it narrower than a general vector database so it does not overlap too closely with existing MoonBit ecosystem work such as broader ANN/vector DB packages.

Repository layout

  • MoonEmbed.mbt library code
  • MoonEmbed_test.mbt tests
  • cmd/main/main.mbt CLI demo
  • LICENSE Apache-2.0
  • .github/workflows/ci.yml basic build/test CI

Usage

Build and test:

moon test
moon run cmd/main

Example API:

let corpus = EmbeddingCorpus::from_glove_text(
  "king 0.92 0.10 0.00\nqueen 0.90 0.14 0.00\n",
)
let index = MoonEmbedIndex::from_corpus(corpus, signature_bits=3)
let report = index.search_token("king", 3)
println(format_report(report))

Source notes

This repository is original MoonBit code written for the contest. If you later extend it with upstream data, ports, or borrowed algorithms, document the source, license, and porting scope clearly in this section before submission.

License

Apache-2.0

关于

MoonEmbed 是一个 MoonBit 原生的词向量加载与轻量语义检索库,支持 word2vec 文本、GloVe 文本和 word2vec 二进制文件解析,并提供基于余弦相似度的本地相似词检索与轻量近似索引,适合在 Wasm、浏览器或离线环境中直接使用,无需 Python 或数据库。

65.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号