public bool MatchPartOfSpeech(TagMatcher t) { if (pos != null && t.pos != null) { foreach (int p2 in t.pos) { if (pos.Contains(p2)) { return(true); } } return(false); } else if (pos != null && t.entry_pos != null) { foreach (int p2 in t.entry_pos) { if (pos.Contains(p2)) { return(true); } } return(false); } throw new ApplicationException(); }
public void Difference(TagMatcher m, List <int> coord_diff_list) { foreach (var p in pairs) { if (!m.pairs.Contains(p)) { coord_diff_list.Add(p.CoordID); } } foreach (var p in m.pairs) { if (!pairs.Contains(p) && !coord_diff_list.Contains(p.CoordID)) { coord_diff_list.Add(p.CoordID); } } return; }
public void Load(string lines, SolarixGrammarEngineNET.GrammarEngine2 gren) { matchers = new List <TagMatcher>(); id2matcher = new Dictionary <int, TagMatcher>(); id2index = new Dictionary <int, int>(); index2id = new Dictionary <int, int>(); foreach (string line in lines.Split('\n')) { string l = line.Trim(); if (!string.IsNullOrEmpty(l)) { TagMatcher m = new TagMatcher(line, gren); matchers.Add(m); id2matcher.Add(m.GetId(), m); id2index.Add(m.GetId(), matchers.Count - 1); index2id.Add(matchers.Count - 1, m.GetId()); } } return; }