/// <summary>
        /// Method too check all the sentences against the APIs
        /// </summary>
        /// <param name="sentences"></param>
        /// <returns>List<Plagiat<String> which has the definitive
        /// plagiates inside </returns>
        public List <Plagiat <String> > CheckSentences(LinkedList <String> sentences)
        {
            //Initialize the plagiates
            var plagiatList = new List <Plagiat <String> >();
            var counter     = 0;

            foreach (string sentence in sentences)
            {
                var check = azureTextAnalytics.Check(new List <String>()
                {
                    sentence
                }, null, null);
                foreach (Plagiat <String> plag in check)
                {
                    if (SentenceSimilarEnough(plag.Origin, plag.FoundPlag, 70))
                    {
                        //Adds new plagiat if they are similar enough
                        plagiatList.Add(plag);

                        //Adding the phrases before and after it.
                        if (counter > 0)
                        {
                            plag.BeforeOrigin = sentences.ElementAt(counter - 1);
                        }
                        if (counter < (sentences.Count - 1))
                        {
                            plag.AfterOrigin = sentences.ElementAt(counter + 1);
                        }
                    }
                }
                counter += 1;
            }
            return(plagiatList);
        }
Beispiel #2
0
        public void Search_BothSourcesFound()
        {
            Boolean       assertion      = false;
            Boolean       wikipediaFound = false;
            Boolean       europaPmcFound = false;
            List <string> origin         = new List <string>();

            origin.Add("Tonight, museums across Europe will take part in the Long Night of Museums");
            origin.Add("Platons Lehrer Sokrates disku­tiert mit dem berühm­ten Redner Gorgias von Leontinoi, nach dem der Dialog benannt ist, sowie dessen Schüler Polos und dem vorneh­men Athener Kallikles.");
            AzureTextAnalytics azureTextAnalytics = new AzureTextAnalytics();

            foreach (Plagiat <String> source in azureTextAnalytics.Check(origin, null, null))
            {
                if (source.Source == "https://de.wikipedia.org/wiki/Gorgias_(Platon)")
                {
                    wikipediaFound = true;
                }
                else if (source.Source == "http://europepmc.org/articles/PMC1298459?pdf=render")
                {
                    europaPmcFound = true;
                }
            }
            if (europaPmcFound && wikipediaFound)
            {
                assertion = true;
            }
            Assert.True(assertion);
        }
Beispiel #3
0
        public IActionResult Get()
        {
            AzureTextAnalytics azureTextAnalytics = new AzureTextAnalytics();
            List <string>      origin             = new List <string>();

            origin.Add("Test");

            return(new ObjectResult(azureTextAnalytics.Check(origin, new List <Uri>(), new List <string>())));
        }