Search in sources :

Example 1 with WikiParsing

use of infoeval.main.WikiData.WikiParsing in project Info-Evaluation by TechnionYP5777.

the class AwardsQueryTest method test1.

@Test
public void test1() throws IOException {
    WikiParsing wiki = new WikiParsing("https://en.wikipedia.org/wiki/Taylor_Swift");
    wiki.Parse("awarded");
    System.out.print(wiki.getText());
    infoeval.main.Analysis.AwardsQuery aw = new AwardsQuery(wiki.getParagraphs());
    aw.analyze();
    for (final String ¢ : aw.getInformation()) System.out.println(¢);
}
Also used : WikiParsing(infoeval.main.WikiData.WikiParsing) AwardsQuery(infoeval.main.Analysis.AwardsQuery) AwardsQuery(infoeval.main.Analysis.AwardsQuery) Test(org.junit.Test)

Example 2 with WikiParsing

use of infoeval.main.WikiData.WikiParsing in project Info-Evaluation by TechnionYP5777.

the class InfoevalServiceImp method getAwards.

@Override
@CrossOrigin
@RequestMapping(path = "Queries/Awards", method = RequestMethod.GET)
public synchronized LinkedList<String> getAwards(String name) throws Exception {
    // Parse user's input:
    try {
        String UpdatedName = updteName(name);
        logger.log(Level.INFO, "Analyzing Awards query from url: " + "https://en.wikipedia.org/wiki/" + UpdatedName);
        WikiParsing wiki = (new WikiParsing("https://en.wikipedia.org/wiki/" + UpdatedName));
        wiki.Parse("won");
        wiki.isConflictedName();
        wiki.getNames();
        new ArrayList<>();
        analyze.setParagraphsAwards(wiki.getParagraphs());
        analyze.clearAwardsInformation();
        analyze.AwardsQuery();
        return analyze.getAwardsInformation();
    } catch (Exception e) {
        logger.log(Level.WARNING, "Problem in awards query");
        throw e;
    }
}
Also used : WikiParsing(infoeval.main.WikiData.WikiParsing) ArrayList(java.util.ArrayList) IOException(java.io.IOException) CrossOrigin(org.springframework.web.bind.annotation.CrossOrigin) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with WikiParsing

use of infoeval.main.WikiData.WikiParsing in project Info-Evaluation by TechnionYP5777.

the class AnalyzeParagraphTest method Test3.

// This test is for the new method of awards query.(see issue #224)
@Test
public void Test3() throws IOException {
    WikiParsing wiki = (new WikiParsing("https://en.wikipedia.org/wiki/Justin_Bieber"));
    wiki.Parse("arrested");
    AnalyzeParagraph analyze = new AnalyzeParagraph();
    analyze.setParagraphsArrests(wiki.getParagraphs());
    analyze.ArrestsQuery();
    assert analyze.getArrestsInformation().contains(" When he failed to do so, an arrest warrant was issued and two of his bodyguards were released in Argentina in April 2015");
}
Also used : WikiParsing(infoeval.main.WikiData.WikiParsing) AnalyzeParagraph(infoeval.main.Analysis.AnalyzeParagraph) Test(org.junit.Test)

Example 4 with WikiParsing

use of infoeval.main.WikiData.WikiParsing in project Info-Evaluation by TechnionYP5777.

the class WikiParsingTest method test6.

@Test
public void test6() throws IOException {
    WikiParsing wp = new WikiParsing("https://en.wikipedia.org/wiki/Michelle_Ann_Williams");
    wp.Parse("refer");
    wp.CheckAmbiguities();
    assert wp.getNames().isEmpty();
}
Also used : WikiParsing(infoeval.main.WikiData.WikiParsing) Test(org.junit.Test)

Example 5 with WikiParsing

use of infoeval.main.WikiData.WikiParsing in project Info-Evaluation by TechnionYP5777.

the class WikiParsingTest method test9.

@Test
public void test9() throws IOException {
    WikiParsing wp = new WikiParsing("https://en.wikipedia.org/wiki/Agüero");
    wp.Parse("refer");
    wp.CheckAmbiguities();
    assert wp.getNames().size() == 13;
}
Also used : WikiParsing(infoeval.main.WikiData.WikiParsing) Test(org.junit.Test)

Aggregations

WikiParsing (infoeval.main.WikiData.WikiParsing)18 Test (org.junit.Test)12 IOException (java.io.IOException)4 AnalyzeParagraph (infoeval.main.Analysis.AnalyzeParagraph)3 CrossOrigin (org.springframework.web.bind.annotation.CrossOrigin)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ArrayList (java.util.ArrayList)2 LemmaAnnotation (edu.stanford.nlp.ling.CoreAnnotations.LemmaAnnotation)1 SentencesAnnotation (edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation)1 TokensAnnotation (edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation)1 CoreLabel (edu.stanford.nlp.ling.CoreLabel)1 Annotation (edu.stanford.nlp.pipeline.Annotation)1 CollapsedDependenciesAnnotation (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation)1 CoreMap (edu.stanford.nlp.util.CoreMap)1 AwardsQuery (infoeval.main.Analysis.AwardsQuery)1 LinkedList (java.util.LinkedList)1 Element (org.jsoup.nodes.Element)1