Skip to content

Implement Algorithmic CognateDetector with unit tests - #2

Merged
menny merged 1 commit into
mainfrom
cognate-detector
Oct 15, 2026
Merged

menny merged 1 commit into
mainfrom
cognate-detector

Conversation

@menny

@menny menny commented Oct 15, 2026

Copy link
Copy Markdown
Member

Summary

Implements Option 1 from docs/INGESTION.md (Step 2: Algorithmic Cognate Detection) in the pure-JVM //core/linguistics package.

Key Capabilities

  • Normalization: Handles accent and diacritic normalization via java.text.Normalizer.
  • Gloss Candidate Extraction: Cleans definitions by stripping parenthetical markers, leading particles (to , a , an , the ), and splitting multi-definition glosses.
  • Suffix Transformations: Maps Spanish-to-English suffixes (-ción -> -tion, -dad -> -ty, -mente -> -ly, -oso -> -ous, -ico -> -ic, -al -> -al, -cto -> -ct, -ncia -> -nce, -ble -> -ble, -ario -> -ary, -ivo -> -ive, -ido -> -id, -ura -> -ure, -or -> -or, and common verb endings).
  • Stem Distance: Uses Levenshtein distance on stems for fuzzy transparent root matching.

Testing

  • Comprehensive JUnit 4 test suite in CognateDetectorTest.kt verifying exact matches, suffix rules, verb cognates, multi-sense glosses, negative controls, edge cases, and distance calculations.

Add pure-JVM CognateDetector in //core/linguistics implementing Step 2 of INGESTION.md. Features accent stripping, gloss candidate extraction, suffix transformation mappings, and stem Levenshtein distance matching. Includes comprehensive JUnit unit tests.
@menny
menny merged commit 3c34e16 into main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant