GetCoordState() public method

public GetCoordState ( int CoordID ) : int
CoordID int
return int
Example #1
0
 static bool IsPronoun_1s_nom(SolarixGrammarEngineNET.GrammarEngine2 gren, SolarixGrammarEngineNET.SyntaxTreeNode node)
 {
     return(GetPOS(gren, node) == SolarixGrammarEngineNET.GrammarEngineAPI.PRONOUN_ru &&
            node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_1_ru &&
            node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.NOMINATIVE_CASE_ru &&
            node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.SINGULAR_NUMBER_ru);
 }
Example #2
0
    static bool IsVerb_1s(SolarixGrammarEngineNET.GrammarEngine2 gren, SolarixGrammarEngineNET.SyntaxTreeNode node)
    {
        if (GetPOS(gren, node) == SolarixGrammarEngineNET.GrammarEngineAPI.VERB_ru)
        {
            if (node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_1_ru &&
                node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.SINGULAR_NUMBER_ru &&
                node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.VERB_FORM_ru) == SolarixGrammarEngineNET.GrammarEngineAPI.VB_INF_ru)
            {
                return(true);
            }
        }

        return(false);
    }
Example #3
0
    string GetNodeNonterminal(SolarixGrammarEngineNET.SyntaxTreeNode node)
    {
        string res = string.Empty;

        int e1 = node.GetEntryID();
        int c1 = gren.GetEntryClass(e1);

        if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.NOUN_ru || c1 == SolarixGrammarEngineNET.GrammarEngineAPI.PRONOUN_ru || c1 == SolarixGrammarEngineNET.GrammarEngineAPI.PRONOUN2_ru)
        {
            int    id_case  = node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru);
            string case_str = string.Empty;
            switch (id_case)
            {
            case SolarixGrammarEngineNET.GrammarEngineAPI.NOMINATIVE_CASE_ru: case_str = "им"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.INSTRUMENTAL_CASE_ru: case_str = "твор"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.GENITIVE_CASE_ru: case_str = "род"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.ACCUSATIVE_CASE_ru: case_str = "вин"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.DATIVE_CASE_ru: case_str = "дат"; break;
            }

            res = string.Format("Сущ_{0}", case_str);
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.ADJ_ru)
        {
            int    id_case  = node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.CASE_ru);
            string case_str = string.Empty;
            switch (id_case)
            {
            case SolarixGrammarEngineNET.GrammarEngineAPI.NOMINATIVE_CASE_ru: case_str = "им"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.INSTRUMENTAL_CASE_ru: case_str = "твор"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.GENITIVE_CASE_ru: case_str = "род"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.ACCUSATIVE_CASE_ru: case_str = "вин"; break;

            case SolarixGrammarEngineNET.GrammarEngineAPI.DATIVE_CASE_ru: case_str = "дат"; break;
            }

            res = string.Format("Прил_{0}", case_str);
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.ADVERB_ru)
        {
            res = string.Format("Наречие_{0}", node.GetWord());
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.PREPOS_ru)
        {
            res = string.Format("Предлог_{0}", node.GetWord());
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.PARTICLE_ru)
        {
            res = string.Format("Частица_{0}", node.GetWord());
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.INFINITIVE_ru)
        {
            res = string.Format("Инф_{0}", node.GetWord());
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.PUNCTUATION_class)
        {
            res = string.Empty;
        }
        else if (c1 == SolarixGrammarEngineNET.GrammarEngineAPI.CONJ_ru)
        {
            res = string.Empty;
        }
        else
        {
            res = string.Empty;
        }

        return(res);
    }
Example #4
0
    static string ChangeVerbTo(SolarixGrammarEngineNET.GrammarEngine2 gren, SolarixGrammarEngineNET.SyntaxTreeNode node, string to_person)
    {
        List <int> coords = new List <int>();
        List <int> states = new List <int>();

        coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.TENSE_ru);
        states.Add(node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.TENSE_ru));

        if (node.GetCoordState(SolarixGrammarEngineNET.GrammarEngineAPI.TENSE_ru) != SolarixGrammarEngineNET.GrammarEngineAPI.PAST_ru)
        {
            if (to_person == "1s")
            {
                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.SINGULAR_NUMBER_ru);

                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_1_ru);
            }
            else if (to_person == "2s")
            {
                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.SINGULAR_NUMBER_ru);

                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_2_ru);
            }
            else if (to_person == "3s")
            {
                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.NUMBER_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.SINGULAR_NUMBER_ru);

                coords.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_ru);
                states.Add(SolarixGrammarEngineNET.GrammarEngineAPI.PERSON_2_ru);
            }
            else
            {
                throw new ArgumentException("to_person");
            }
        }


        foreach (var p in node.GetPairs())
        {
            if (p.CoordID == SolarixGrammarEngineNET.GrammarEngineAPI.TENSE_ru ||
                p.CoordID == SolarixGrammarEngineNET.GrammarEngineAPI.VERB_FORM_ru)
            {
                coords.Add(p.CoordID);
                states.Add(p.StateID);
            }
        }

        string        v2 = "";
        List <string> fx = SolarixGrammarEngineNET.GrammarEngine.sol_GenerateWordformsFX(gren.GetEngineHandle(), node.GetEntryID(), coords, states);

        if (fx != null && fx.Count > 0)
        {
            v2 = fx[0].ToLower();
        }
        else
        {
            v2 = null;
        }

        return(v2);
    }