public int MatchTags(SolarixGrammarEngineNET.SyntaxTreeNode proj, int iproj, SolarixGrammarEngineNET.GrammarEngine2 gren) { foreach (TagMatcher m in matchers) { if (m.Match(proj, iproj, gren)) { // ---~~~~~ DEBUG ~~~--- #if DEBUG string matcher = m.ToString(); string form = ""; int npair = SolarixGrammarEngineNET.GrammarEngine.sol_GetNodeVerPairsCount(proj.hNode, iproj); for (int j = 0; j < npair; ++j) { int id_coord = SolarixGrammarEngineNET.GrammarEngine.sol_GetNodeVerPairCoord(proj.hNode, iproj, j); int id_state = SolarixGrammarEngineNET.GrammarEngine.sol_GetNodeVerPairState(proj.hNode, iproj, j); string coord_name = gren.GetCoordName(id_coord); string state_name = null; if (gren.CountCoordStates(id_coord) == 0) { state_name = id_state.ToString(); } else { state_name = gren.GetCoordStateName(id_coord, id_state); } form += string.Format(" {0}:{1}", coord_name, state_name); } #endif // ---~~~~~ ..... ~~~--- return(m.GetId()); } } return(-1); }
public int MatchTags(WordData token, SolarixGrammarEngineNET.GrammarEngine2 gren) { foreach (TagMatcher m in matchers) { if (m.Match(token, gren)) { return(m.GetId()); } } int entry_id = token.GetEntryID(); int pos_id = gren.GetEntryClass(entry_id); string part_of_speech = gren.GetClassName(pos_id); string tags = string.Join(" ", token.GetTags().Select(z => string.Format("{0}={1}", gren.GetCoordName(z.Item1), gren.GetCoordStateName(z.Item1, z.Item2))).ToArray()); string msg = string.Format("Can not find tag for {0} {{ {1} {2} }}", token.GetWord(), part_of_speech, tags); throw new ApplicationException(msg); }
private string GetTokenMorph(WordData token, SolarixGrammarEngineNET.GrammarEngine2 gren) { string part_of_speech = gren.GetClassName(token.part_of_speech); string tags = string.Join(" ", token.GetTags().Select(z => string.Format("{0}={1}", gren.GetCoordName(z.Item1), gren.GetCoordStateName(z.Item1, z.Item2))).ToArray()); return(part_of_speech + "(" + tags + ")"); }