public Morpher(SpanFactory<ShapeNode> spanFactory, ITraceManager traceManager, Language lang) { _lang = lang; _traceManager = traceManager; _allomorphTries = new Dictionary<Stratum, RootAllomorphTrie>(); foreach (Stratum stratum in _lang.Strata) { var allomorphs = new HashSet<RootAllomorph>(stratum.Entries.SelectMany(entry => entry.Allomorphs)); var trie = new RootAllomorphTrie(ann => ann.Type() == HCFeatureSystem.Segment); foreach (RootAllomorph allomorph in allomorphs) trie.Add(allomorph); _allomorphTries[stratum] = trie; } _analysisRule = lang.CompileAnalysisRule(spanFactory, this); _synthesisRule = lang.CompileSynthesisRule(spanFactory, this); MaxStemCount = 2; LexEntrySelector = entry => true; RuleSelector = rule => true; }
public Morpher(SpanFactory <ShapeNode> spanFactory, ITraceManager traceManager, Language lang) { _lang = lang; _traceManager = traceManager; _allomorphTries = new Dictionary <Stratum, RootAllomorphTrie>(); foreach (Stratum stratum in _lang.Strata) { var allomorphs = new HashSet <RootAllomorph>(stratum.Entries.SelectMany(entry => entry.Allomorphs)); var trie = new RootAllomorphTrie(ann => ann.Type() == HCFeatureSystem.Segment); foreach (RootAllomorph allomorph in allomorphs) { trie.Add(allomorph); } _allomorphTries[stratum] = trie; } _analysisRule = lang.CompileAnalysisRule(spanFactory, this); _synthesisRule = lang.CompileSynthesisRule(spanFactory, this); MaxStemCount = 2; LexEntrySelector = entry => true; RuleSelector = rule => true; }
internal IEnumerable <RootAllomorph> SearchRootAllomorphs(Stratum stratum, Shape shape) { RootAllomorphTrie alloSearcher = _allomorphTries[stratum]; return(alloSearcher.Search(shape).Distinct()); }