miniCOIL clean_words mutates input and loses counts when normalized words collide

未关闭
#877 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

@pear1-pea 已经在做这个了。

开始于 2026年11月11日。

  • #878 来自 @pear1-pea —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
1/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python

调研方向

The issue identifies SparseVectorConverter.clean_words() and provides two offline regression cases, with examples for input mutation and lost counts when normalized words collide. Start by reading that method and inspect the linked pull request #878, which is already open. Done means the cleaned result combines counts while retaining the known word's vocabulary ID and embedding, and the caller's input remains unchanged.

由索引模型根据 Issue 内容生成。

描述

SparseVectorConverter.clean_words() changes the caller's WordEmbedding when an unknown word normalizes to a known word. It also loses the unknown word's count if the known word occurs later in the input mapping.

Reproduced on current main, without downloading a model:

from py_rust_stemmers import SnowballStemmer
from fastembed.sparse.utils.sparse_vectors_converter import SparseVectorConverter, WordEmbedding

converter = SparseVectorConverter(set(), SnowballStemmer("english"))
known = WordEmbedding("cat", ["cat"], 1, 1, [1.0, 0.0])
unknown = WordEmbedding("cat!", ["cat!"], 2, -1, [1.0])
sentence = {"cat": known, "cat!": unknown}
converter.clean_words(sentence)
print(known.count)  # 3: caller's original count was 1
print(converter.clean_words(sentence)["cat"].count)  # 5 instead of 3

With fresh inputs in the reverse order, the cleaned count is 1 instead of 3. The known word should retain its vocabulary ID and embedding while combining both counts, without changing the input. Two parameterized offline regression cases fail on main (one for input mutation, one for the lost count).

AI assistance: Codex inspected the source and ran the reproductions and tests.

主要语言
Python
星标
3.3k
派生
314
平均合并
5 天 7 小时
30 天内合并 PR
23

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

qdrant/fastembed 的其他 Issue

查看 qdrant/fastembed 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。