Beispiel #1
0
        public List <termExploreItem> GetItems(morphRuleMatch match, string excludeForm)
        {
            Dictionary <string, gramCaseSet> output = new Dictionary <string, gramCaseSet>();
            List <termExploreItem>           items  = new List <termExploreItem>();

            foreach (morphRule rule in rules)
            {
                string form = rule.GetForm(match.root, match.stem, SharpSufix);
                if (excludeForm != form)
                {
                    if (!output.ContainsKey(form))
                    {
                        output.Add(form, new gramCaseSet());
                    }
                    output[form].Add(rule.gramEntry);
                }
            }

            foreach (string form in output.Keys)
            {
                termExploreItem item = new termExploreItem(form);
                item.gramSet = output[form];
                items.Add(item);
            }
            return(items);
        }
 public void Add(morphRuleMatch ruleMatch)
 {
     if (ruleMatch != null)
     {
         matches.Add(ruleMatch);
     }
 }
Beispiel #3
0
        public gramCaseSet GetGramSet(morphRuleMatch match)
        {
            gramCaseSet output = new gramCaseSet();

            foreach (morphRule rule in rules)
            {
                if (rule.sufix == match.sufix)
                {
                    output.Add(rule.gramEntry);
                }
            }

            return(output);
        }
Beispiel #4
0
        public morphRuleMatch Match(string token, ILogBuilder loger)
        {
            if (regex.IsMatch(token))
            {
                morphRuleMatch match = new morphRuleMatch();
                match.ruleSet = this;
                match.item    = match.createExploreItem(token);

                return(match);
            }
            else
            {
                return(null);
            }
        }
 public string GetForm(morphRuleMatch match)
 {
     return(GetForm(match.root, match.stem, match.ruleSet.SharpSufix));
 }