示例#1
0
        internal List <Affix <PrefixEntry> > GetMatchingAffixes(string word)
        {
            if (string.IsNullOrEmpty(word))
            {
                return(new List <Affix <PrefixEntry> >(0));
            }

            var results = new List <Affix <PrefixEntry> >();

            if (AffixesByIndexedByKey.TryGetValue(word[0], out AffixEntryGroupCollection <PrefixEntry> indexedGroups))
            {
                foreach (var group in indexedGroups)
                {
                    foreach (var entry in group.Entries)
                    {
                        if (HunspellTextFunctions.IsSubset(entry.Key, word))
                        {
                            results.Add(Affix <PrefixEntry> .Create(entry, group));
                        }
                    }
                }
            }

            if (AffixesWithDots.HasItems)
            {
                results.AddRange(GetMatchingWithDotAffixes(word, HunspellTextFunctions.IsSubset));
            }

            return(results);
        }
示例#2
0
        internal List <Affix <SuffixEntry> > GetMatchingAffixes(string word, FlagSet groupFlagFilter = null)
        {
            if (string.IsNullOrEmpty(word))
            {
                return(new List <Affix <SuffixEntry> >(0));
            }

            var results = new List <Affix <SuffixEntry> >();

            if (AffixesByIndexedByKey.TryGetValue(word[word.Length - 1], out AffixEntryGroupCollection <SuffixEntry> indexedGroups))
            {
                foreach (var group in indexedGroups)
                {
                    if (groupFlagFilter == null || groupFlagFilter.Contains(group.AFlag))
                    {
                        foreach (var entry in group.Entries)
                        {
                            if (HunspellTextFunctions.IsReverseSubset(entry.Key, word))
                            {
                                results.Add(Affix <SuffixEntry> .Create(entry, group));
                            }
                        }
                    }
                }
            }

            if (AffixesWithDots.HasItems)
            {
                results.AddRange(GetMatchingWithDotAffixes(word, HunspellTextFunctions.IsReverseSubset));
            }

            return(results);
        }