示例#1
0
        public bool TransitionPossible(TxtWord root, State fromState)
        {
            if (root.IsAdjective() && (root.IsNominal() && !root.IsExceptional() || root.IsPronoun()) &&
                _toState.GetName() == "NominalRoot(ADJ)" && _with == "0")
            {
                return(false);
            }

            if (root.IsAdjective() && root.IsNominal() && _with == "^DB+VERB+ZERO+PRES+A3PL" &&
                fromState.GetName() == "AdjectiveRoot")
            {
                return(false);
            }

            if (root.IsAdjective() && root.IsNominal() && _with == "SH" &&
                fromState.GetName() == "AdjectiveRoot")
            {
                return(false);
            }

            if (_with == "ki")
            {
                return(root.TakesRelativeSuffixKi());
            }

            if (_with == "kü")
            {
                return(root.TakesRelativeSuffixKu());
            }

            if (_with == "dHr")
            {
                if (_toState.GetName() == "Adverb")
                {
                    return(true);
                }

                return(root.TakesSuffixDIRAsFactitive());
            }

            if (_with == "Hr" && (_toState.GetName() == "AdjectiveRoot(VERB)" ||
                                  _toState.GetName() == "OtherTense" ||
                                  _toState.GetName() == "OtherTense2"))
            {
                return(root.TakesSuffixIRAsAorist());
            }

            return(true);
        }
示例#2
0
        /**
         * <summary>The softenDuringSuffixation method takes a {@link TxtWord} root as an input. It checks two cases; first case returns
         * true if the given root is nominal or adjective and has one of the flags "IS_SD, IS_B_SD, IS_SDD" and with variable
         * equals o one of the strings "Hm, nDAn, ncA, nDA, yA, yHm, yHz, yH, nH, nA, nHn, H, sH, Hn, HnHz, HmHz".
         * <p/>
         * And the second case returns true if the given root is verb and has the "F_SD" flag, also with variable starts with
         * "Hyor" or equals one of the strings "yHs, yAn, yA, yAcAk, yAsH, yHncA, yHp, yAlH, yArAk, yAdur, yHver, yAgel, yAgor,
         * yAbil, yAyaz, yAkal, yAkoy, yAmA, yHcH, HCH, Hr, Hs, Hn, yHn", yHnHz, Ar, Hl").</summary>
         *
         * <param name="root">{@link TxtWord} input.</param>
         * <returns>true if there is softening during suffixation of the given root, false otherwise.</returns>
         */
        public bool SoftenDuringSuffixation(TxtWord root)
        {
            if ((root.IsNominal() || root.IsAdjective()) && root.NounSoftenDuringSuffixation() &&
                (_with == "Hm" || _with == "nDAn" || _with == "ncA" || _with == "nDA" || _with == "yA" ||
                 _with == "yHm" || _with == "yHz" || _with == "yH" || _with == "nH" ||
                 _with == "nA" || _with == "nHn" || _with == "H" || _with == "sH" || _with == "Hn" ||
                 _with == "HnHz" || _with == "HmHz"))
            {
                return(true);
            }

            if (root.IsVerb() && root.VerbSoftenDuringSuffixation() && (_with.StartsWith("Hyor") || _with == "yHs" ||
                                                                        _with == "yAn" || _with == "yA" ||
                                                                        _with.StartsWith("yAcAk") || _with == "yAsH" ||
                                                                        _with == "yHncA" ||
                                                                        _with == "yHp" || _with == "yAlH" ||
                                                                        _with == "yArAk" || _with == "yAdur" ||
                                                                        _with == "yHver" ||
                                                                        _with == "yAgel" || _with == "yAgor" ||
                                                                        _with == "yAbil" || _with == "yAyaz" ||
                                                                        _with == "yAkal" ||
                                                                        _with == "yAkoy" || _with == "yAmA" ||
                                                                        _with == "yHcH" || _with == "HCH" ||
                                                                        _with.StartsWith("Hr") || _with == "Hs" ||
                                                                        _with == "Hn" || _with == "yHn" ||
                                                                        _with == "yHnHz" ||
                                                                        _with.StartsWith("Ar") || _with == "Hl"))
            {
                return(true);
            }

            return(false);
        }
        public new string Translate()
        {
            bool previousWordNoun = false;

            string[] posArray2 =
            {
                "IN", "TO"
            }

            ;
            string[] posArray3 =
            {
                "POS", "PRP$"
            }

            ;
            string[][] wordArray2 =
            {
                new [] {
                    "of", "in", "on", "at", "into", "with", "from", "since", "by", "until", "than"
                },
                new [] {
                    "to"
                }
            }

            ;
            string[][] wordArray3 =
            {
                new string[] {
                },
                new []       {
                    "my", "your", "his", "her", "its", "our", "their"
                }
            }

            ;
            string[][] suffixArray2 =
            {
                new [] {
                    "nHn", "DA", "DA", "DA", "nA", "ylA", "DAn", "DAn", "ylA", "nA", "DAn"
                },
                new [] {
                    "yA"
                }
            }

            ;
            string[][] suffixArray2Prime =
            {
                new [] {
                    "nHn", "nDA", "nDA", "nDA", "nA", "ylA", "nDAn", "nDAn", "ylA", "nA", "nDAn"
                },
                new [] {
                    "nA"
                }
            }

            ;
            string[][] suffixArray3 =
            {
                new [] {
                    "nHn"
                },
                new [] {
                    "Hm", "Hn", "sH", "sH", "sH", "HmHz", "H"
                }
            }

            ;
            if (parentList.Count > 1)
            {
                if (prefix != null)
                {
                    TxtWord prefixWord = (TxtWord)txtDictionary.GetWord(prefix.Trim());
                    if (prefixWord != null && prefixWord.IsNominal())
                    {
                        previousWordNoun = true;
                    }
                }

                Transition transition;
                string     result;
                if (IsLastWordOfNounPhrase(parseNode) || previousWordNoun)
                {
                    transition = new Transition("lArH");
                    string newLastWordForm = transition.MakeTransition(lastWord, lastWordForm);
                    result = TranslateNouns(posArray2, wordArray2, suffixArray2Prime, parentList, englishWordList,
                                            prefix, lastWord, newLastWordForm);
                    if (result != null)
                    {
                        return(result);
                    }
                }
                else
                {
                    transition = new Transition("lAr");
                    string newLastWordForm = transition.MakeTransition(lastWord, lastWordForm);
                    result = TranslateNouns(posArray3, wordArray3, suffixArray3, parentList, englishWordList, prefix,
                                            lastWord, newLastWordForm);
                    if (result != null)
                    {
                        var result2 = TranslateNouns(posArray2, wordArray2, suffixArray2, parentList, englishWordList, "",
                                                     lastWord, result);
                        if (result2 != null)
                        {
                            result = result2;
                        }
                    }
                    else
                    {
                        result = TranslateNouns(posArray2, wordArray2, suffixArray2, parentList, englishWordList,
                                                prefix, lastWord, newLastWordForm);
                    }
                }

                if (result != null)
                {
                    return(result);
                }

                if (IsLastWordOfNounPhrase(parseNode) || previousWordNoun)
                {
                    return(AddSuffix("lArH", prefix, lastWord, lastWordForm));
                }

                return(AddSuffix("lAr", prefix, lastWord, lastWordForm));
            }

            return(AddSuffix("lAr", prefix, lastWord, lastWordForm));
        }