Ejemplo n.º 1
0
        /// <summary>
        /// Determines if two AdverbPhrases are similar.
        /// </summary>
        /// <param name="first">The first AdverbPhrase</param>
        /// <param name="second">The second AdverbPhrase</param>
        /// <returns><c>true</c> if the given AdverbPhrases are similar; otherwise, <c>false</c>.</returns>
        public static Similarity IsSimilarTo(this AdverbPhrase first, AdverbPhrase second)
        {
            var percentMatched = first.Words.OfAdverb()
                                 .Zip(second.Words.OfAdverb(), (x, y) => x.IsSimilarTo(y) == true)
                                 .PercentTrue();

            return(Similarity.FromBoolean(first == second || percentMatched / 100 > Lexicon.SimilarityThreshold));
        }
Ejemplo n.º 2
0
        public void ModifyWithTest()
        {
            var target = new Adjective("orangish");
            var adv    = new Adverb("demonstrably");
            var advp   = new AdverbPhrase(new[] { adv });

            target.ModifyWith(adv);
            target.ModifyWith(advp);
            Check.That(target.AdverbialModifiers).Contains(adv).And.Contains(advp);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Determines if the provided Adverb is similar to the provided AdverbPhrase.
 /// </summary>
 /// <param name="first">The Adverb.</param>
 /// <param name="second">The AdverbPhrase.</param>
 /// <returns>
 /// <c>true</c> if the provided Adverb is similar to the provided AdverbPhrase; otherwise, <c>false</c>.
 /// </returns>
 public static Similarity IsSimilarTo(this Adverb first, AdverbPhrase second) => Similarity.FromBoolean(second.Words.OfAdverb().Any(a => a.IsSimilarTo(first)));
Ejemplo n.º 4
0
 /// <summary>
 /// Determines if the provided AdverbPhrase is similar to the provided Adverb.
 /// </summary>
 /// <param name="first">The AdverbPhrase.</param>
 /// <param name="second">The Adjective.</param>
 /// <returns>
 /// <c>true</c> if the provided AdverbPhrase is similar to the provided Adverb; otherwise, <c>false</c>.
 /// </returns>
 public static Similarity IsSimilarTo(this AdverbPhrase first, Adverb second) => second.IsSimilarTo(first);