public AdjectiveWordToken(string text, InflectionCase inflectionCase,
     GrammaticalGender grammaticalGender, DecliantionNumber decliantionNumber, AdjectiveLevel level)
     : base(text, inflectionCase, decliantionNumber)
 {
     this.level = level;
     this.genre = grammaticalGender;
 }
        void LoadCasesControls(Panel targetPanel, DecliantionNumber amount, AdjectiveLevel level)
        {
            targetPanel.Controls.Clear();

            Array arr = Enum.GetValues(typeof(InflectionCase));

            foreach (InflectionCase aCase in arr)
            {
                if (aCase == InflectionCase._Unknown)
                {
                    continue;
                }

                ControlAdjectiveCaseEdit edit = new ControlAdjectiveCaseEdit();
                edit.Dock              = DockStyle.Bottom;
                edit.Case              = aCase;
                edit.Value             = "";
                edit.DecliantionNumber = amount;
                edit.InflectionCase    = aCase;
                edit.Level             = level;
                // edit.PostfixButtonPressed += new EventHandler(edit_PostfixButtonPressed);
                // edit.IrregularSet += new EventHandler(edit_IrregularSet);

                targetPanel.Controls.Add(edit);
            }
        }
示例#3
0
 public AdjectiveWordToken(string text, InflectionCase inflectionCase,
                           GrammaticalGender grammaticalGender, DecliantionNumber decliantionNumber, AdjectiveLevel level)
     : base(text, inflectionCase, decliantionNumber)
 {
     this.level = level;
     this.genre = grammaticalGender;
 }
示例#4
0
        public string GetForm(GrammaticalGender genre, InflectionCase aCase, DecliantionNumber amount, AdjectiveLevel level)
        {
            AdjectiveWordToken token = new AdjectiveWordToken(null, aCase, genre, amount, level);
            foreach (AdjectiveWordToken tok in Irregulars)
                if (tok.Is(token))
                    return tok.Text;

            return null;
        }
示例#5
0
        public string GetForm(WordGenre genre, WordCase aCase, WordAmount amount,
            AdjectiveLevel level)
        {
            AdjectiveWordToken token = new AdjectiveWordToken(null, aCase, genre, amount, level);
            foreach (AdjectiveWordToken tok in irregulars)
                if (tok.Is(token))
                    return tok.Text;

            return null;
        }
示例#6
0
        public string GetForm(WordGenre genre, WordCase aCase, WordAmount amount,
                              AdjectiveLevel level)
        {
            AdjectiveWordToken token = new AdjectiveWordToken(null, aCase, genre, amount, level);

            foreach (AdjectiveWordToken tok in irregulars)
            {
                if (tok.Is(token))
                {
                    return(tok.Text);
                }
            }

            return(null);
        }
        void LoadCasesControls(Panel targetPanel, DecliantionNumber amount, AdjectiveLevel level)
        {
            targetPanel.Controls.Clear();

            Array arr = Enum.GetValues(typeof(InflectionCase));
            foreach (InflectionCase aCase in arr)
            {
                if (aCase == InflectionCase._Unknown)
                    continue;

                ControlAdjectiveCaseEdit edit = new ControlAdjectiveCaseEdit();
                edit.Dock = DockStyle.Bottom;
                edit.Case = aCase;
                edit.Value = "";
                edit.DecliantionNumber = amount;
                edit.InflectionCase = aCase;
                edit.Level = level;
                // edit.PostfixButtonPressed += new EventHandler(edit_PostfixButtonPressed);
                // edit.IrregularSet += new EventHandler(edit_IrregularSet);

                targetPanel.Controls.Add(edit);
            }
        }
 public string TranslateAdjectiveLevel(AdjectiveLevel level)
 {
     return translationsAdjectiveLevel[level.ToString()];
 }
 public string TranslateAdjectiveLevel(AdjectiveLevel level)
 {
     return(this.translationsAdjectiveLevel[level.ToString()]);
 }
示例#10
0
        public bool Analyze()
        {
            this.results.Clear();

            // get noun...
            if (this.nounIndex < 0)
            {
                // cannot analyze groups without noun...
                return(false);
            }

            InflectionCase    naCase  = EnumHelper.GetWordCase(this.codes[this.nounIndex][1]);
            DecliantionNumber namount = EnumHelper.GetWordAmount(this.codes[this.nounIndex][2]);
            GrammaticalGender ngenre  = EnumHelper.GetWordGenre(this.codes[this.nounIndex][3]);

            // todo: categories

            if (naCase == InflectionCase._Unknown || namount == DecliantionNumber._Unknown ||
                ngenre == GrammaticalGender._Unknown)
            {
                this.results.Add(this.indexes[this.nounIndex], "{NOUN_DEFINITION_INCOMPLETE}");
                return(false);
            }

            Noun noun = NounCollection.Collection.GetRandomNoun(ngenre);

            if (noun == null)
            {
                this.results.Add(this.indexes[this.nounIndex], "{NO_VALID_NOUN}");
                // TODO: fill rest of the placeholders
                return(false);
            }
            else
            {
                if (namount == DecliantionNumber.Plural && !noun.CanBePlural)
                {
                    namount = DecliantionNumber.Singular;
                }
                else if (namount == DecliantionNumber.Singular && !noun.CanBeSingular)
                {
                    namount = DecliantionNumber.Plural;
                }

                string nounStr = NounDecliner.Decliner.MakeWord(noun, naCase, namount);
                if (!string.IsNullOrEmpty(nounStr))
                {
                    this.results.Add(this.indexes[this.nounIndex], nounStr);
                }
                else
                {
                    this.results.Add(this.indexes[this.nounIndex], "{CANT_DECLINE_NOUN}");
                }

                bool error = false;

                for (int codeIndex = 0; codeIndex < this.codes.Count; codeIndex++)
                {
                    if (codeIndex == this.nounIndex)
                    {
                        continue;
                    }

                    string code        = this.codes[codeIndex];
                    int    formatIndex = this.indexes[codeIndex];

                    switch (code[0])
                    {
                        #region Adjective
                    case 'A':       // Adjective (przymiotnik)
                    {
                        if (code.Length == 5)
                        {
                            InflectionCase    aCase  = EnumHelper.GetWordCase(code[1]);
                            DecliantionNumber amount = EnumHelper.GetWordAmount(code[2]);
                            GrammaticalGender genre  = EnumHelper.GetWordGenre(code[3]);
                            AdjectiveLevel    level  = EnumHelper.GetAdjectiveLevel(code[4]);

                            if (aCase == InflectionCase._Unknown)
                            {
                                aCase = naCase;
                            }

                            if (amount == DecliantionNumber._Unknown)
                            {
                                amount = namount;
                            }

                            if (genre == GrammaticalGender._Unknown)
                            {
                                genre = ngenre;
                            }

                            Adjective adj = AdjectiveCollection.Collection.GetRandomAdjective();
                            if (adj == null)
                            {
                                this.results.Add(formatIndex, "{NO_VALID_ADJECTIVE}");
                                error = true;
                                continue;
                            }

                            string form = AdjectiveDecliner.Decliner.MakeWord(adj, noun, aCase,
                                                                              amount, level);

                            if (form != null)
                            {
                                this.results.Add(formatIndex, form);
                                continue;
                            }

                            int tries = 0;
                            // try randomizing little more...
                            // TODO: implement some shuffle algorithm
                            while (form == null && tries++ < 10)
                            {
                                adj  = AdjectiveCollection.Collection.GetRandomAdjective();
                                form = AdjectiveDecliner.Decliner.MakeWord(adj, noun, aCase,
                                                                           amount, level);
                            }
                            if (tries >= 10)
                            {
                                this.results.Add(formatIndex, "{NO_VALID_ADJECTIVE}");
                                error = true;
                                continue;
                            }

                            this.results.Add(formatIndex, form);
                        }
                        break;
                    }
                        #endregion

                        // TODO: Verbs
                    }
                }

                return(!error);
            }

            return(true);
        }
        public string MakeWord(Adjective word, GrammaticalGender genre, InflectionCase aCase,
            DecliantionNumber amount, AdjectiveLevel level)
        {
            // check all arguments are provided...
            if (genre == GrammaticalGender._Unknown || aCase == InflectionCase._Unknown
                || amount == DecliantionNumber._Unknown || level == AdjectiveLevel._Unknown)
                return null;

            // constants
            if (word.IsConstant)
                return word.Root;

            // check word has exceptions
            if (word.IsException)
            {
                string except = word.GetForm(genre, aCase, amount, level);
                if (except != null)
                    return except; // alse - calculate own...
            }

            // now check if word has locked levels
            if (useNonLevellingRule && !word.CanBeLevelled &&
                (level == AdjectiveLevel.Higher || level == AdjectiveLevel.Highest))
                return null;

            string prefix = "";
            string postfix = "";
            string root = word.Root;

            // pick valid prefix for declination

            #region Levelling

            switch (level)
            {
                case AdjectiveLevel.Equal:
                    {
                        // nothing
                        break;
                    }
                case AdjectiveLevel.Higher:
                    {
                        if (!word.IsLevelledComplex && !string.IsNullOrEmpty(word.LevelHigherForm))
                            root = word.LevelHigherForm;
                        else
                            prefix = "bardziej ";
                        break;
                    }
                case AdjectiveLevel.Highest:
                    {
                        if (!word.IsLevelledComplex && !string.IsNullOrEmpty(word.LevelHighestForm))
                            root = word.LevelHighestForm;
                        else
                            prefix = "najbardziej ";
                        break;
                    }
            }

            #endregion

            // Chnage root / postfix depending of selected gender, number etc

            switch (amount)
            {
                #region DecliantionNumber.Singular

                case DecliantionNumber.Singular:
                    {
                        switch (genre)
                        {
                            case GrammaticalGender.MasculinePerson:
                            case GrammaticalGender.MasculineLife:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "go";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "mu";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "go";
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                    }
                                    break;
                                }
                            case GrammaticalGender.MasculineThing:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "go";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "mu";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                    }
                                    break;
                                }
                            case GrammaticalGender.Feminine:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                //postfix = MakePostfix(word, ref root, ending_A_IA);
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "j";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "j";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfixBlue(word, ref root, ending_Aa_IAa);
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfixBlue(word, ref root, ending_Aa_IAa);
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "j";
                                                break;
                                            }
                                    }
                                    break;
                                }
                            case GrammaticalGender.Neuter:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "go";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                postfix += "mu";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                    }
                                    break;
                                }
                        }
                        break;
                    }

                #endregion

                #region DecliantionNumber.Plural

                case DecliantionNumber.Plural:
                    {
                        switch (genre)
                        {
                            case GrammaticalGender.MasculinePerson:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                if (root.EndsWith("cona") || root.EndsWith("iona"))
                                                {
                                                    root = root.Substring(0, root.Length - 3);
                                                    postfix = "eni";
                                                }
                                                else
                                                {
                                                    root = this.MakeWord(word, genre, InflectionCase.Nominative, DecliantionNumber.Singular, level);
                                                    root = Soften(word, root);
                                                    //postfix = MakePostfix(word, ref root, ending_I_Y);
                                                    prefix = ""; // above launch of MakeWord will add prefix either
                                                }
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "ch";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "ch";
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "mi";
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "ch";
                                                break;
                                            }
                                    }
                                    break;
                                }
                            case GrammaticalGender.Feminine:
                            case GrammaticalGender.MasculineLife:
                            case GrammaticalGender.MasculineThing:
                            case GrammaticalGender.Neuter:
                                {
                                    switch (aCase)
                                    {
                                        case InflectionCase.Nominative:
                                        case InflectionCase.Vocative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                break;
                                            }
                                        case InflectionCase.Genitive:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "ch";
                                                break;
                                            }
                                        case InflectionCase.Dative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "m";
                                                break;
                                            }
                                        case InflectionCase.Accusative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_E_IE);
                                                break;
                                            }
                                        case InflectionCase.Ablative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "mi";
                                                break;
                                            }
                                        case InflectionCase.Locative:
                                            {
                                                postfix = MakePostfix(word, ref root, ending_I_Y);
                                                postfix += "ch";
                                                break;
                                            }
                                    }
                                    break;
                                }
                        }
                        break;
                    }

                #endregion
            }

            return string.Format("{0}{1}{2}", prefix, root, postfix);
        }
示例#12
0
        private string Decode(string code)
        {
            if (!string.IsNullOrEmpty(code))
            {
                switch (code[0])
                {
                case 'A':       // Adjective (przymiotnik)
                {
                    if (code.Length == 5)
                    {
                        InflectionCase    aCase  = EnumHelper.GetWordCase(code[1]);
                        DecliantionNumber amount = EnumHelper.GetWordAmount(code[2]);
                        GrammaticalGender genre  = EnumHelper.GetWordGenre(code[3]);
                        AdjectiveLevel    level  = EnumHelper.GetAdjectiveLevel(code[4]);

                        Adjective adj = AdjectiveCollection.Collection.GetRandomAdjective();
                        if (adj == null)
                        {
                            return("{NO_VALID_ADJECTIVE}");
                        }

                        string form = AdjectiveDecliner.Decliner.MakeWord(adj, genre, aCase, amount, level);
                        if (form != null)
                        {
                            return(form);
                        }

                        int tries = 0;
                        // try randomizing little more...
                        // TODO: implement some shuffle algorithm
                        while (form == null && tries++ < 10)
                        {
                            adj  = AdjectiveCollection.Collection.GetRandomAdjective();
                            form = AdjectiveDecliner.Decliner.MakeWord(adj, genre, aCase, amount, level);
                        }
                        if (tries >= 10)
                        {
                            return("{NO_VALID_ADJECTIVE}");        // 10 tries - probably no valid word in dic
                        }
                        return(form);
                    }
                    break;
                }

                case 'N':     // Noun (rzeczownik)
                {
                    if (code.Length == 4)
                    {
                        InflectionCase    aCase  = EnumHelper.GetWordCase(code[1]);
                        DecliantionNumber amount = EnumHelper.GetWordAmount(code[2]);
                        GrammaticalGender genre  = EnumHelper.GetWordGenre(code[3]);

                        Noun noun = NounCollection.Collection.GetNoun(genre,
                                                                      null,
                                                                      (amount == DecliantionNumber.Singular) ? true : false,
                                                                      (amount == DecliantionNumber.Plural) ? true : false);
                        if (noun == null)
                        {
                            return("{NO_VALID_NOUN}");
                        }

                        /*if (amount == DecliantionNumber.Plural && !noun.CanBePlural)
                         *  amount = DecliantionNumber.Singular;
                         * else if (amount == DecliantionNumber.Singular && !noun.CanBeSingular)
                         *  amount = DecliantionNumber.Plural;*/// no longer needed

                        string form = NounDecliner.Decliner.MakeWord(noun, aCase, amount);
                        if (form != null)
                        {
                            return(form);
                        }

                        int tries = 0;
                        // try randomizing little more...
                        // TODO: implement some shuffle algorithm
                        while (form == null && tries++ < 10)
                        {
                            noun = NounCollection.Collection.GetNoun(genre,
                                                                     null,
                                                                     (amount == DecliantionNumber.Singular) ? true : false,
                                                                     (amount == DecliantionNumber.Plural) ? true : false);

                            form = NounDecliner.Decliner.MakeWord(noun, aCase, amount);
                        }
                        if (tries >= 10)
                        {
                            return("{NO_VALID_NOUN}");        // 10 tries - probably no valid word in dic
                        }
                        return(form);
                    }

                    break;
                }
                    //case 'C': // Counter (liczebnik)
                    //    {
                    //        break;
                    //    }
                    //case 'V': // Verb (czsownik)
                    //    {
                    //        break;
                    //    }
                }
            }

            return("{INVALID_FORMATTER}");
        }
示例#13
0
        public bool AnalyzeLine(string line)
        {
            if (!string.IsNullOrEmpty(line))
            {
                string[] elements = line.Split('|');

                this.Root = elements[0]; // always will be at last one element in nonempty string

                if (elements.Length > 1)
                {
                    for (int i = 1; i < elements.Length; i++)
                    {
                        string str = elements[i];
                        if (string.IsNullOrEmpty(str))
                        {
                            continue;
                        }

                        switch (str[0])
                        {
                            #region Irregular levelling

                        case '*':
                        {
                            if (str.Length > 1)
                            {
                                this.IsLevelledComplex = false;

                                if (str[1] == '+')
                                {
                                    this.LevelHighestForm = str.Substring(2);
                                }
                                else
                                {
                                    this.LevelHigherForm = str.Substring(1);
                                }
                            }
                            else
                            {
                                // err
                                return(false);
                            }

                            break;
                        }

                            #endregion

                            #region Nondeclinative item

                        case '#':
                        {
                            this.IsConstant = true;

                            break;
                        }

                        case '!':
                        {
                            this.canBeLevelled = false;

                            break;
                        }

                            #endregion

                            #region Exception Cases

                        case '%':
                        {
                            if (str.Length > 5)
                            {
                                this.IsException = true;
                                WordCase       aCase  = EnumHelper.GetWordCase(str[1]);
                                WordAmount     amount = EnumHelper.GetWordAmount(str[2]);
                                WordGenre      genre  = EnumHelper.GetWordGenre(str[3]);
                                AdjectiveLevel level  = EnumHelper.GetAdjectiveLevel(str[4]);
                                string         txt    = str.Substring(5);

                                AdjectiveWordToken token = new
                                                           AdjectiveWordToken(txt, aCase, genre, amount, level);
                                this.Irregulars.Add(token);
                            }
                            else
                            {
                                // err
                                return(false);
                            }

                            break;
                        }

                            #endregion

                            #region Categories

                        case '$':
                        {
                            string cats = str.Substring(1);
                            categories.Clear();
                            if (!string.IsNullOrEmpty(cats))
                            {
                                string[] arr = cats.Split(',');
                                foreach (string catId in arr)
                                {
                                    int id = int.Parse(catId);

                                    if (!categories.Contains(id))
                                    {
                                        categories.Add(id);
                                    }
                                }
                            }

                            break;
                        }

                            #endregion
                        }
                    }
                }
                else
                {
                    // set defaults
                    this.IsException = false;
                    this.IsConstant  = false;
                }

                //if (adj.IsException && adj.IsLevelledComplex)
                //{
                //    // not supported
                //}
                //else

                return(true);
            }

            return(false);
        }
示例#14
0
        public string GetForm(GrammaticalGender genre, InflectionCase aCase, DecliantionNumber amount, AdjectiveLevel level)
        {
            AdjectiveWordToken token = new AdjectiveWordToken(null, aCase, genre, amount, level);

            foreach (AdjectiveWordToken tok in this.Irregulars)
            {
                if (tok.Is(token))
                {
                    return(tok.Text);
                }
            }

            return(null);
        }
 public string MakeWord(Adjective word, Noun noun, InflectionCase aCase, DecliantionNumber amount,
                        AdjectiveLevel level)
 {
     return(this.MakeWord(word, (noun.HasIrregularGenre) ? noun.IrregularGenre : noun.Genre,
                          aCase, amount, level));
 }
        public string MakeWord(Adjective word, GrammaticalGender genre, InflectionCase aCase,
                               DecliantionNumber amount, AdjectiveLevel level)
        {
            // check all arguments are provided...
            if (genre == GrammaticalGender._Unknown || aCase == InflectionCase._Unknown ||
                amount == DecliantionNumber._Unknown || level == AdjectiveLevel._Unknown)
            {
                return(null);
            }

            // constants
            if (word.IsConstant)
            {
                return(word.Root);
            }

            // check word has exceptions
            if (word.IsException)
            {
                string except = word.GetForm(genre, aCase, amount, level);
                if (except != null)
                {
                    return(except); // alse - calculate own...
                }
            }

            // now check if word has locked levels
            if (this.useNonLevellingRule && !word.CanBeLevelled &&
                (level == AdjectiveLevel.Higher || level == AdjectiveLevel.Highest))
            {
                return(null);
            }

            string prefix  = "";
            string postfix = "";
            string root    = word.Root;

            // pick valid prefix for declination

            #region Levelling

            switch (level)
            {
            case AdjectiveLevel.Equal:
            {
                // nothing
                break;
            }

            case AdjectiveLevel.Higher:
            {
                if (!word.IsLevelledComplex && !string.IsNullOrEmpty(word.LevelHigherForm))
                {
                    root = word.LevelHigherForm;
                }
                else
                {
                    prefix = "bardziej ";
                }
                break;
            }

            case AdjectiveLevel.Highest:
            {
                if (!word.IsLevelledComplex && !string.IsNullOrEmpty(word.LevelHighestForm))
                {
                    root = word.LevelHighestForm;
                }
                else
                {
                    prefix = "najbardziej ";
                }
                break;
            }
            }

            #endregion

            // Chnage root / postfix depending of selected gender, number etc

            switch (amount)
            {
                #region DecliantionNumber.Singular

            case DecliantionNumber.Singular:
            {
                switch (genre)
                {
                case GrammaticalGender.MasculinePerson:
                case GrammaticalGender.MasculineLife:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_I_Y);
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "go";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "mu";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "go";
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }
                    }
                    break;
                }

                case GrammaticalGender.MasculineThing:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_I_Y);
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "go";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "mu";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_I_Y);
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }
                    }
                    break;
                }

                case GrammaticalGender.Feminine:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        //postfix = MakePostfix(word, ref root, ending_A_IA);
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "j";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "j";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix = this.MakePostfixBlue(word, ref root, this.ending_Aa_IAa);
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix = this.MakePostfixBlue(word, ref root, this.ending_Aa_IAa);
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "j";
                        break;
                    }
                    }
                    break;
                }

                case GrammaticalGender.Neuter:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_E_IE);
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "go";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_E_IE);
                        postfix += "mu";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_E_IE);
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }
                    }
                    break;
                }
                }
                break;
            }

                #endregion

                #region DecliantionNumber.Plural

            case DecliantionNumber.Plural:
            {
                switch (genre)
                {
                case GrammaticalGender.MasculinePerson:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        if (root.EndsWith("cona") || root.EndsWith("iona"))
                        {
                            root    = root.Substring(0, root.Length - 3);
                            postfix = "eni";
                        }
                        else
                        {
                            root = this.MakeWord(word, genre, InflectionCase.Nominative, DecliantionNumber.Singular, level);
                            root = this.Soften(word, root);
                            //postfix = MakePostfix(word, ref root, ending_I_Y);
                            prefix = "";                         // above launch of MakeWord will add prefix either
                        }
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "ch";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "ch";
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "mi";
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "ch";
                        break;
                    }
                    }
                    break;
                }

                case GrammaticalGender.Feminine:
                case GrammaticalGender.MasculineLife:
                case GrammaticalGender.MasculineThing:
                case GrammaticalGender.Neuter:
                {
                    switch (aCase)
                    {
                    case InflectionCase.Nominative:
                    case InflectionCase.Vocative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_E_IE);
                        break;
                    }

                    case InflectionCase.Genitive:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "ch";
                        break;
                    }

                    case InflectionCase.Dative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "m";
                        break;
                    }

                    case InflectionCase.Accusative:
                    {
                        postfix = this.MakePostfix(word, ref root, this.ending_E_IE);
                        break;
                    }

                    case InflectionCase.Ablative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "mi";
                        break;
                    }

                    case InflectionCase.Locative:
                    {
                        postfix  = this.MakePostfix(word, ref root, this.ending_I_Y);
                        postfix += "ch";
                        break;
                    }
                    }
                    break;
                }
                }
                break;
            }

                #endregion
            }

            return(string.Format("{0}{1}{2}", prefix, root, postfix));
        }
 public string MakeWord(Adjective word, Noun noun, InflectionCase aCase, DecliantionNumber amount,
     AdjectiveLevel level)
 {
     return MakeWord(word, (noun.HasIrregularGenre) ? noun.IrregularGenre : noun.Genre,
         aCase, amount, level);
 }