Пример #1
0
        public void GetSimilarityInternalJaroTest()
        {
            var sim = new SemanticBagOfWordsSimilarity(_vocabulary, TokenSimilarity.Jaro);
            var semanticSimString = sim.GetSimilarity(new[] { "THE", "TEXT" }, new[] { "SOME", "TEXT" });

            semanticSimString.Should().BeApproximately(0.946, ErrorTolerance);
        }
Пример #2
0
        public void GetSimilarityInternalMetricAndSymmetricTest()
        {
            var sim = new SemanticBagOfWordsSimilarity(_vocabulary, TokenSimilarity.Levenshtein, true);

            var semanticNormalizedString = sim.GetSimilarity(new[] { new NormalizedString("the"), new NormalizedString("text") },
                                                             new[] { new NormalizedString("some"), new NormalizedString("text") });

            semanticNormalizedString.Should().BeApproximately(0.856, ErrorTolerance);
        }
Пример #3
0
        public void GetSimilarityDefaultTest()
        {
            const string pattern = "the text";
            const string target  = "some text";

            var sim = new SemanticBagOfWordsSimilarity(_vocabulary);

            var semanticSim = sim.GetSimilarity(new StandardTokenizer(pattern), new StandardTokenizer(target));

            semanticSim.Should().BeApproximately(0.856, ErrorTolerance);
        }