Exemplo n.º 1
0
        public virtual bool CheckAccord(MorphBaseInfo v, bool ignoreGender = false, bool ignoreNumber = false)
        {
            if (v.Language != Language)
            {
                if (v.Language == MorphLang.Unknown && Language == MorphLang.Unknown)
                {
                    return(false);
                }
            }
            MorphNumber num = v.Number & Number;

            if (num == MorphNumber.Undefined && !ignoreNumber)
            {
                if (v.Number != MorphNumber.Undefined && Number != MorphNumber.Undefined)
                {
                    if (v.Number == MorphNumber.Singular && v.Case.IsGenitive)
                    {
                        if (Number == MorphNumber.Plural && Case.IsGenitive)
                        {
                            if (((v.Gender & MorphGender.Masculine)) == MorphGender.Masculine)
                            {
                                return(true);
                            }
                        }
                    }
                    return(false);
                }
            }
            if (!ignoreGender && num != MorphNumber.Plural)
            {
                if (((v.Gender & Gender)) == MorphGender.Undefined)
                {
                    if (v.Gender != MorphGender.Undefined && Gender != MorphGender.Undefined)
                    {
                        return(false);
                    }
                }
            }
            if (((v.Case & Case)).IsUndefined)
            {
                if (!v.Case.IsUndefined && !Case.IsUndefined)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public static string ToStringMorphNumber(MorphNumber number)
        {
            StringBuilder res = new StringBuilder();

            if (((number & MorphNumber.Singular)) != MorphNumber.Undefined)
            {
                res.Append("единств.|");
            }
            if (((number & MorphNumber.Plural)) != MorphNumber.Undefined)
            {
                res.Append("множеств.|");
            }
            if (res.Length > 0)
            {
                res.Length--;
            }
            return(res.ToString());
        }