Esempio n. 1
0
        public void CosineSimilarity()
        {
            var similarities = Similarity.Cosine("We can use Cosine to compute the similarity of two hardcoded lists.", new[]
            {
                "Cosine Similarity algorithm function sample.",
                "The Cosine Similarity function computes the similarity of two lists of numbers.",
                "Compute the similarity of two hardcoded lists.",
                "We can compute the similarity of two hardcoded lists.",
                "Coronavirus app could trace your contacts without sacrificing your privacy"
            }, Path.Combine(dataDir, "dbpedia.ftz"));

            Assert.AreEqual(new[] { 0, 4, 1, 3, 2 }, np.argsort <double>(similarities));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var similarities = Similarity.Cosine("We can use Cosine to compute the similarity of two hardcoded lists.", new[]
            {
                "Cosine Similarity algorithm function sample.",
                "The Cosine Similarity function computes the similarity of two lists of numbers.",
                "Compute the similarity of two hardcoded lists.",
                "We can compute the similarity of two hardcoded lists.",
                "Coronavirus app could trace your contacts without sacrificing your privacy"
            }, Path.Combine(@"D:\SciSharp\CherubNLP\data", "dbpedia.ftz"));

            // var test = new KaggleTest();
            // test.SpookyAuthorIdentification();
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            Dictionary <string, int> fd = new Dictionary <string, int>();
            Dictionary <string, int> sd = new Dictionary <string, int>();

            fd.Add("Visar", 2);
            fd.Add("test", 2);
            fd.Add("aaa", 2);
            fd.Add("bbb", 2);

            sd.Add("Visar", 2);
            sd.Add("test", 3);
            sd.Add("aaa", 1);
            sd.Add("aba", 1);

            Similarity s = new Similarity();

            MessageBox.Show(s.Cosine(fd, sd).ToString());
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var model = Path.Combine(@"D:\SciSharp\CherubNLP\data", "dbpedia.bin");

            using (var fastText = new FastTextWrapper())
            {
                fastText.LoadModel(model);
                var vector1 = fastText.GetSentenceVector("Hello");
            }

            var similarities = Similarity.Cosine("Power Outage -Fifth & Park - JPMC150713", new[]
            {
                "Cosine Similarity algorithm function sample.",
                "Power Restored -Fifth & Park - JPMC150713",
                "Compute the similarity of two hardcoded lists.",
                "We can compute the similarity of two hardcoded lists.",
                "Coronavirus app could trace your contacts without sacrificing your privacy"
            }, model);

            // var test = new KaggleTest();
            // test.SpookyAuthorIdentification();
        }