Major features: - Radical-based word matching for conjugated verbs - Morphological decomposition for compound words - Multi-index search (byWord + byFormeLiee) - Cascade search strategy with confidence scoring New files: - ConfluentTranslator/radicalMatcher.js: Extract radicals from conjugated forms - ConfluentTranslator/morphologicalDecomposer.js: Decompose compound words - ConfluentTranslator/plans/radical-lookup-system.md: Implementation plan - ConfluentTranslator/test-results-radical-system.md: Test results and analysis - ancien-confluent/lexique/00-grammaire.json: Grammar particles - ancien-confluent/lexique/lowercase-confluent.js: Lowercase utility Modified files: - ConfluentTranslator/reverseIndexBuilder.js: Added byFormeLiee index - ConfluentTranslator/confluentToFrench.js: Cascade search with radicals - Multiple lexique JSON files: Enhanced entries with forme_liee Test results: - Before: 83% coverage (101/122 tokens) - After: 92% coverage (112/122 tokens) - Improvement: +9 percentage points Remaining work to reach 95%+: - Add missing particles (ve, eol) - Enrich VERBAL_SUFFIXES (aran, vis) - Document missing words (tiru, kala, vulu) 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.0 KiB
JavaScript
68 lines
2.0 KiB
JavaScript
// radicalMatcher.js
|
|
// Système de recherche par radicaux pour le traducteur Confluent→Français
|
|
// Permet de trouver les formes conjuguées et dérivées à partir des racines
|
|
|
|
// Suffixes verbaux identifiés dans le corpus
|
|
const VERBAL_SUFFIXES = [
|
|
'ak', // forme standard : mirak (voir), pasak (prendre), urak (être)
|
|
'an', // conjugaison : takan (porter), vokan (parler?)
|
|
'un', // conjugaison : kisun (transmettre), pasun (prendre?)
|
|
'is', // conjugaison : vokis (parler?)
|
|
'am', // conjugaison : sukam (forger)
|
|
'im', // conjugaison : verim (vérifier?)
|
|
'ok', // impératif : marqueur temporel
|
|
'ul', // passé? : marqueur temporel
|
|
'iran', // dérivé nominal : kisiran (enseignement/transmission?)
|
|
];
|
|
|
|
/**
|
|
* Extrait tous les radicaux possibles d'un mot
|
|
* @param {string} word - Mot en confluent
|
|
* @returns {Array<{radical: string, suffix: string, type: string, confidence: number}>}
|
|
*/
|
|
function extractRadicals(word) {
|
|
const candidates = [];
|
|
|
|
// Essayer chaque suffixe verbal connu
|
|
for (const suffix of VERBAL_SUFFIXES) {
|
|
if (word.endsWith(suffix) && word.length > suffix.length + 1) {
|
|
const radical = word.slice(0, -suffix.length);
|
|
candidates.push({
|
|
radical,
|
|
suffix,
|
|
type: 'verbal',
|
|
confidence: 0.9
|
|
});
|
|
}
|
|
}
|
|
|
|
// Essayer sans suffixe (forme racine directe)
|
|
if (word.length >= 3) {
|
|
candidates.push({
|
|
radical: word,
|
|
suffix: '',
|
|
type: 'root',
|
|
confidence: 0.7
|
|
});
|
|
}
|
|
|
|
// Essayer d'enlever dernière voyelle (forme liée -> forme pleine)
|
|
// mako → mak, voki → vok
|
|
if (word.length >= 4 && 'aeiou'.includes(word[word.length - 1])) {
|
|
candidates.push({
|
|
radical: word.slice(0, -1),
|
|
suffix: word[word.length - 1],
|
|
type: 'liaison',
|
|
confidence: 0.8
|
|
});
|
|
}
|
|
|
|
// Trier par confiance décroissante
|
|
return candidates.sort((a, b) => b.confidence - a.confidence);
|
|
}
|
|
|
|
module.exports = {
|
|
extractRadicals,
|
|
VERBAL_SUFFIXES
|
|
};
|