Repository navigation
Port PR14140 and PR16881 to GO - #17102
Conversation
📝 WalkthroughWalkthroughAdds runtime language selection across ingestion, Go, C, and C++ tokenizer layers. Updates stemming, lemmatization, POS handling, stopword filtering, analyzer state, and CSV/Q&A/tag parsing for multiline records. ChangesLanguage-aware tokenization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/ingestion/component/chunker/qa.go`:
- Around line 308-358: Update extractQATextCSV to distinguish io.EOF from
non-EOF errors returned by csv.Reader.Read: stop only at EOF, and continue
processing after recoverable malformed-row parse errors so later Q&A pairs are
not silently discarded. Preserve the existing record handling and line-offset
mapping, while ensuring any record/error state needed to represent the malformed
row does not prevent subsequent reads.
- Around line 121-123: Update the Q&A chunking flow around
ContentLtks/ContentSmLtks to derive the language from c.param.Lang, defaulting
to English when unset, rather than inputs["lang"]; set the tokenizer language
once before iterating qaPairs, and extend the Chinese test coverage to verify
both content token fields.
In `@internal/ingestion/component/tokenizer.go`:
- Around line 623-629: Update the documentation comment for the tokenizer
language handling to remove the stale statement that setting the language is a
no-op, since the implementation now invokes tokenizer.SetLanguage. Keep the
existing description of the Python behavior and backward-compatible default
accurate.
In `@internal/tokenizer/tokenizer.go`:
- Around line 465-471: The tokenizer’s global language state causes races and
lets pooled analyzers retain a previous task’s language. In
internal/tokenizer/tokenizer.go (465-471), remove SetLanguage; also remove
globalLang at 80, update withAnalyzer (411-414) and withAnalyzerResult (431-434)
to accept a language and always apply it, using the established fallback such as
English when unspecified. In internal/ingestion/component/extractor.go (599 and
637) and internal/ingestion/component/chunker/tag.go (111-117), replace
SetLanguage calls by passing in.lang or lang directly to the tokenization API.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 412607c7-49bb-4dc6-bd7c-aa6a2ea61610
📒 Files selected for processing (17)
internal/binding/cpp/rag_analyzer.cppinternal/binding/cpp/rag_analyzer.hinternal/binding/cpp/rag_analyzer_c_api.cppinternal/binding/cpp/rag_analyzer_c_api.hinternal/binding/cpp/rag_analyzer_c_api_debug.cppinternal/binding/rag_analyzer.gointernal/binding/rag_analyzer_nocgo.gointernal/ingestion/component/chunker/qa.gointernal/ingestion/component/chunker/tag.gointernal/ingestion/component/extractor.gointernal/ingestion/component/globals/globals.gointernal/ingestion/component/parser.gointernal/ingestion/component/parser_dispatch.gointernal/ingestion/component/tokenizer.gointernal/ingestion/component/tokenizer_test.gointernal/ingestion/task/pipeline_executor.gointernal/tokenizer/tokenizer.go
|
LGTM |
Summary
Port
#14140
#16881