Ejemplo n.º 1
0
        public void GoogleCustomSearch_NoResult()
        {
            Boolean       assertion = false;
            List <string> origin    = new List <string>();

            origin.Add("ASDDDDDDDDDASDAAAAAAAAAAAAAAAAAAAasdaskffsafak");
            DocumentStatistics documentStatistics = new DocumentStatistics(origin);
            GoogleSearch       googleSearch       = new GoogleSearch(new Uri("https://www.googleapis.com/customsearch/v1"));

            googleSearch.Check(documentStatistics);
            if (documentStatistics.getPossiblePlagiates().Count == 0)
            {
                assertion = true;
            }
            Assert.True(assertion);
        }
Ejemplo n.º 2
0
        public void EuropePmcSearch_NoResult()
        {
            Boolean       assertion = false;
            List <string> origin    = new List <string>();

            origin.Add("Asd asd ASd jasdfnaLasddasda");
            DocumentStatistics documentStatistics = new DocumentStatistics(origin);
            EuropaPMCSearch    europaPMCSearch    = new EuropaPMCSearch(new Uri("https://www.ebi.ac.uk/europepmc/webservices/rest/search?"));

            europaPMCSearch.Check(documentStatistics);

            if (documentStatistics.getPossiblePlagiates().Count == 0)
            {
                assertion = true;
            }
            Assert.True(assertion);
        }
Ejemplo n.º 3
0
        public void GoogleCustomSearch_SourceFound()
        {
            Boolean       assertion = false;
            List <string> origin    = new List <string>();

            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.");
            DocumentStatistics documentStatistics = new DocumentStatistics(origin);
            GoogleSearch       googleSearch       = new GoogleSearch(new Uri("https://www.googleapis.com/customsearch/v1"));

            googleSearch.Check(documentStatistics);
            foreach (Plagiat <String> source in documentStatistics.getPossiblePlagiates())
            {
                if (source.Source == "https://de.wikipedia.org/wiki/Gorgias_(Platon)")
                {
                    assertion = true;
                }
            }
            Assert.True(assertion);
        }
Ejemplo n.º 4
0
        public void EuropePmcSearch_SourceFound()
        {
            Boolean       assertion = false;
            List <string> origin    = new List <string>();

            origin.Add("Tonight, museums across Europe will take part in the Long Night of Museums");
            DocumentStatistics documentStatistics = new DocumentStatistics(origin);
            EuropaPMCSearch    europaPMCSearch    = new EuropaPMCSearch(new Uri("https://www.ebi.ac.uk/europepmc/webservices/rest/search?"));

            europaPMCSearch.Check(documentStatistics);
            foreach (Plagiat <String> source in documentStatistics.getPossiblePlagiates())
            {
                if (source.Source == "http://europepmc.org/articles/PMC1298459?pdf=render")
                {
                    assertion = true;
                }
            }
            Assert.True(assertion);
        }
 /// <summary>
 /// Processes files contained in Resources directory
 /// </summary>
 /// <param name="filepath"></param>
 /// <param name="stats"></param>
 private void ProcessFiles(string filepath, ref DocumentStatistics stats)
 {
     try
     {
         string[] files = Directory.GetFiles(filepath);
         RaiseLogEvent($"{files.Count()} Files found ");
         if (files.Count() > 0)
         {
             RaiseLogEvent("");
             foreach (string file in files)
             {
                 string fname = Path.GetFileName(file);
                 RaiseLogEvent(fname);
                 stats.Documents.Add(fname);
                 string[] result = ParseText(file);
                 stats.CountWords(result);
             }
         }
         else
         {
             Console.WriteLine($"No files found :/ ");
         }
     }
     catch (UnauthorizedAccessException)
     {
         RaiseDebugEvent("ACCESS DENIED");
     }
     catch (DirectoryNotFoundException)
     {
         RaiseDebugEvent("No Directory found");
     }
     catch (Exception e)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructs a new instance of <see cref="IItemMetadata{TKey}"/>.
 /// </summary>
 public ItemMetadata(int id, T item, DocumentStatistics documentStatistics)
 {
     this.Id   = id;
     this.Item = item;
     this.DocumentStatistics = documentStatistics;
 }
 /// <summary>
 /// Starts process
 /// </summary>
 public ProcessExampleMain(IDictionary <string, object> config)
 {
     Config   = config;
     docStats = new DocumentStatistics();
 }
Ejemplo n.º 8
0
 internal SentimentResult(string id, DocumentStatistics statistics)
     : base(id, statistics)
 {
 }