Пример #1
0
        /// <summary>
        /// Gets a pronoun based on the referral and referee wildcards
        /// </summary>
        /// <returns>A pronoun to refer the wilcard received as referee.</returns>
        /// <param name="referral">The refering wildcard.</param>
        /// <param name="referee">The wildcard being referred.</param>
        public static string FromWildcard(Wildcard referral, Wildcard referee)
        {
            if ((referee == null) || (referral == null))
            {
                Console.WriteLine("referral or referee is null");
                throw new NullReferenceException("referral or referee is null");
            }
            if (referral.Name != "pron")
            {
                Console.WriteLine("referral is not a {pron} wildcard");
                throw new InvalidOperationException("referral is not a {pron} wildcard");
            }

            Gender g;

            switch (referee.Keyword)
            {
            case "male":
                g = Gender.Masculine;
                break;

            case "female":
                g = Gender.Femenine;
                break;

            default:
                g = Gender.Neutral;
                break;
            }

            if (!String.IsNullOrEmpty(referral.Type))
            {
                switch (referral.Type.Substring(0, 3))
                {
                case "sub":
                    return(Personal.Subjective(Form.Singular, Person.Third, g));

                case "pab":
                    return(Possessive.PossessiveAbsolute(Form.Singular, Person.Third, g));

                case "paj":
                    return(Possessive.PossessiveAdjective(Form.Singular, Person.Third, g));

                case "pos":
                    if (referral.Type.StartsWith("posabs"))
                    {
                        return(Possessive.PossessiveAbsolute(Form.Singular, Person.Third, g));
                    }
                    return(Possessive.PossessiveAdjective(Form.Singular, Person.Third, g));
                }
            }
            return(Personal.Objective(Form.Singular, Person.Third, g));
        }