retrieve misses Greek words with ΐ or ΰ when case differs
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 77/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python, typescript
調査の方向性
src/selfgraph/retrieval.py の _fold と typescript/src/retrieval.ts の fold を読み、retrieval のテストと docs/retrieval.md の正規化に関する説明を確認します。両方の実装でギリシャ文字の大文字と小文字の不一致を再現し、修正によってクエリと保存されたテキストが一致することを確認します。指定されたギリシャ語の例が機能し、既存のラテン文字の大文字と小文字の一致が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
retrieve is documented as matching without regard to case, but it misses Greek words that contain ΐ or ΰ (a letter with both dialytika and tonos) when the query and the entity differ in case. An entity named "Πρωτεΐνη" ("protein") is not seeded by "ΠΡΩΤΕΪ́ΝΗ", which is what "Πρωτεΐνη".upper() returns, and the reverse fails as well. Latin cases such as Paris/PARIS, Zoë/ZOË, and Straße/STRASSE work.
Tested at 5a277c9 (current main), Python 3.14, Kuzu 0.11.3, on macOS. The cause is in the token fold, not the store.
Reproduce
import asyncio, os, tempfile
from selfgraph import KuzuStore, SelfGraph
async def main():
async with SelfGraph(store=KuzuStore(os.path.join(tempfile.mkdtemp(), "g.kuzu"))) as g:
await g.entities.create("Πρωτεΐνη", "Concept", id="concept:protein")
await g.entities.create("Paris", "Place", id="place:paris")
for q in ["Πρωτεΐνη", "Πρωτεΐνη".upper(), "πρωτεΐνη", "PARIS"]:
print(repr(q), [s.id for s in (await g.retrieve(q)).seeds])
asyncio.run(main())
'Πρωτεΐνη' ['concept:protein']
'ΠΡΩΤΕΪ́ΝΗ' []
'πρωτεΐνη' ['concept:protein']
'PARIS' ['place:paris']
Storing the entity as "ΠΡΩΤΕΪ́ΝΗ" and querying "πρωτεΐνη" also returns no seeds. The same happens with "Ταΐζω" and "ΤΑΪ́ΖΩ", and with any other word that has ΐ (U+0390) or ΰ (U+03B0).
Cause
_fold (src/selfgraph/retrieval.py:161) is normalize_text(text).casefold(): NFC first, then casefold. Casefolding does not keep text in NFC:
import unicodedata as u
lower, upper = "Πρωτεΐνη", "Πρωτεΐνη".upper()
fold = lambda t: u.normalize("NFC", t).casefold()
print(fold(lower) == fold(upper)) # False
print(u.normalize("NFC", fold(lower)) == u.normalize("NFC", fold(upper))) # True
The lowercase ΐ (U+0390) folds to U+03B9 U+0308 U+0301. The uppercase form's NFC is Ϊ plus a combining tonos (U+03AA U+0301), which folds to U+03CA U+0301. The two are canonically equivalent but not byte-equal, so neither the BM25 terms nor the substring boost match.
docs/retrieval.md ("How it works", step 1) says the query is NFC-normalized and casefolded so that query and stored text compare in one form. Unicode's canonical caseless match needs one more normalization after the fold, NFC(casefold(NFC(x))) or the NFD equivalent.
The TypeScript fold (typescript/src/retrieval.ts:87-88) is casefold(normalizeText(text)), using the full case-folding table in typescript/src/internal/casefold.ts, so it gives the same tokens and misses the same matches.
Related: #312 has the same root (case mapping applied after normalization leaves non-NFC text), in entity_id.
- 主要言語
- TypeScript
- スター
- 173
- フォーク
- 58
- 平均マージ
- 6時間
- マージ済み PR(30日)
- 120
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hydra-db/selfgraph のほかの issue
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
hydra-db/selfgraph#401 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: store bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
hydra-db/selfgraph#398 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
hydra-db/selfgraph#392 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: parity area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hydra-db/selfgraph#391 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
hydra-db/selfgraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
code-yeongyu/senpi#7139 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
lingdojo/kana-dojo#34395 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
bug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mastra-ai/mastra#31093 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:web p2 product:business triage:active type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
cuadrao-ai/argus#2328 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nikhilb2/simple_invoicing#907 ·