Пример #1
0
 /** Test get corpus. */
 @Test
 public void testGetCorpus() {
   Corpus corpus = service.getCorpus(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpus);
   corpus = service.getCorpus(Corpus.TED_TALKS);
   Assert.assertNotNull(corpus);
 }
Пример #2
0
  /** Test get corpora by account. */
  @Test
  public void testGetCorporaByAccount() {
    Corpora corpora = service.listCorpora(PUBLIC);
    Assert.assertNotNull(corpora);
    Assert.assertFalse(corpora.getCorpora().isEmpty());

    corpora = service.listCorpora();
    Assert.assertNotNull(corpora);
    Assert.assertFalse(corpora.getCorpora().isEmpty());
  }
Пример #3
0
 /*
  * (non-Javadoc)
  *
  * @see com.ibm.watson.developer_cloud.WatsonServiceTest#setUp()
  */
 @Override
 @Before
 public void setUp() throws Exception {
   super.setUp();
   service = new ConceptInsights();
   service.setUsernameAndPassword(
       getValidProperty("concept_insights.username"),
       getValidProperty("concept_insights.password"));
   service.setEndPoint(getValidProperty("concept_insights.url"));
 }
Пример #4
0
 /** Test get corpus relation scores. */
 @Test
 public void testGetCorpusRelationScores() {
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   Scores scores = service.getCorpusRelationScores(Corpus.IBM_RESEARCHERS, concepts);
   Assert.assertNotNull(scores);
 }
Пример #5
0
 /** Test get graphs related scores. */
 @Test
 public void testGetGraphsRelatedScores() {
   List<String> concepts = new ArrayList<String>();
   concepts.add(EXAMPLE_CONCEPT.getId());
   Scores scores = service.getGraphRelationScores(EXAMPLE_CONCEPT, concepts);
   Assert.assertNotNull(scores);
 }
Пример #6
0
 /** Test annotate text. */
 @Test
 public void testAnnotateText() {
   Annotations annotations =
       service.annotateText(
           Graph.WIKIPEDIA, "Nizar Magboul Alseddeg is currently living in Austin Texas");
   Assert.assertNotNull(annotations);
 }
Пример #7
0
 /** Test get graphs. */
 @Test
 public void testGetGraphs() {
   Graphs graphs = service.listGraphs();
   Assert.assertNotNull(graphs);
   Assert.assertNotNull(graphs.getGraphs());
   Assert.assertFalse(graphs.getGraphs().isEmpty());
 }
Пример #8
0
 /** Test get document relation scores. */
 @Test
 public void testGetDocumentRelationScores() {
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   Scores scores = service.getDocumentRelationScores(EXAMPLE_DOCUMENT, concepts);
   Assert.assertNotNull(scores);
 }
Пример #9
0
 /** Test get documnet related concepts. */
 @Test
 public void testGetDocumnetRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LEVEL, "1");
   params.put(ConceptInsights.LIMIT, 10);
   Concepts concepts = service.getDocumentRelatedConcepts(EXAMPLE_DOCUMENT, params);
   Assert.assertNotNull(concepts);
 }
Пример #10
0
 /** Test get corpus related concept. */
 @Test
 public void testGetCorpusRelatedConcept() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.PREFIX, false);
   Concepts concepts = service.getCorpusRelatedConcepts(Corpus.IBM_RESEARCHERS, params);
   Assert.assertNotNull(concepts);
 }
Пример #11
0
  /** Test list documents. */
  @Test
  public void testListDocuments() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(ConceptInsights.CURSOR, 0);
    params.put(ConceptInsights.LIMIT, 20);

    Documents documents = service.listDocuments(Corpus.TED_TALKS, params);
    Assert.assertNotNull(documents);
  }
Пример #12
0
 /** Test get corpus label search. */
 @Test
 public void testGetCorpusLabelSearch() {
   Map<String, Object> query = new HashMap<String, Object>();
   query.put(ConceptInsights.QUERY, "IBM");
   query.put(ConceptInsights.LIMIT, 10);
   query.put(ConceptInsights.PREFIX, false);
   Matches matches = service.searchCorpusByLabel(Corpus.IBM_RESEARCHERS, query);
   Assert.assertNotNull(matches);
 }
Пример #13
0
 /** Test conceptual search. */
 @Test
 public void testConceptualSearch() {
   Map<String, Object> params = new HashMap<String, Object>();
   List<String> ids = new ArrayList<String>();
   ids.add(EXAMPLE_CONCEPT.getId());
   params.put(ConceptInsights.IDS, ids);
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.CURSOR, 0);
   QueryConcepts cp = service.conceptualSearch(Corpus.TED_TALKS, params);
   Assert.assertNotNull(cp);
 }
Пример #14
0
 /** Test get concept related concepts. */
 @Test
 public void testGetConceptRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.LEVEL, 1);
   RequestedFields fs = new RequestedFields();
   fs.include("abstract");
   params.put("concept_fields", fs);
   Concepts concepts = service.getConceptRelatedConcepts(EXAMPLE_CONCEPT, params);
   Assert.assertNotNull(concepts);
 }
Пример #15
0
 /** Test get graph related concepts. */
 @Test
 public void testGetGraphRelatedConcepts() {
   Map<String, Object> params = new HashMap<String, Object>();
   List<Concept> concepts = new ArrayList<Concept>();
   concepts.add(EXAMPLE_CONCEPT);
   params.put(ConceptInsights.LIMIT, 10);
   params.put(ConceptInsights.LEVEL, 1);
   RequestedFields fs = new RequestedFields();
   fs.include("abstract");
   params.put("concept_fields", fs);
   Concepts conceptResults = service.getGraphRelatedConcepts(Graph.WIKIPEDIA, concepts, params);
   Assert.assertNotNull(conceptResults);
 }
Пример #16
0
  /** Test get graphs label search. */
  @Test
  public void testGetGraphsLabelSearch() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(ConceptInsights.QUERY, "cognitv");
    params.put(ConceptInsights.LIMIT, 10);
    params.put(ConceptInsights.PREFIX, false);

    RequestedFields fs = new RequestedFields();
    fs.include("abstract");
    params.put("concept_fields", fs);

    Matches matches = service.searchGraphsConceptByLabel(Graph.WIKIPEDIA, params);
    Assert.assertNotNull(matches);
    Assert.assertFalse(matches.getMatches().isEmpty());
  }
Пример #17
0
 /** Test get concept. */
 @Test
 public void testGetConcept() {
   ConceptMetadata conceptMetaData = service.getConcept(EXAMPLE_CONCEPT);
   Assert.assertNotNull(conceptMetaData);
 }
Пример #18
0
 /** Test document annotations. */
 @Test
 public void testDocumentAnnotations() {
   DocumentAnnotations annotations = service.getDocumentAnnotations(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(annotations);
 }
Пример #19
0
 /** Testlist corpora. */
 @Test
 public void testlistCorpora() {
   Corpora corpora = service.listCorpora();
   Assert.assertNotNull(corpora);
   Assert.assertFalse(corpora.getCorpora().isEmpty());
 }
Пример #20
0
 /** Test get accounts. */
 @Test
 public void testGetAccounts() {
   Accounts accounts = service.getAccountsInfo();
   Assert.assertNotNull(accounts);
   Assert.assertFalse(accounts.getAccounts().isEmpty());
 }
Пример #21
0
 /** Test get document processing state. */
 @Test
 public void testGetDocumentProcessingState() {
   DocumentProcessingStatus documentProcessingState =
       service.getDocumentProcessingState(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(documentProcessingState);
 }
Пример #22
0
 /** Test get corpus processing state. */
 @Test
 public void testGetCorpusProcessingState() {
   CorpusProcessingState corpusProcessingState =
       service.getCorpusProcessingState(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpusProcessingState);
 }
Пример #23
0
 /** Test get corpus stats. */
 @Test
 public void testGetCorpusStats() {
   CorpusStats corpusStats = service.getCorpusStats(Corpus.IBM_RESEARCHERS);
   Assert.assertNotNull(corpusStats);
 }
Пример #24
0
 /** Test get document. */
 @Test
 public void testGetDocument() {
   Document document = service.getDocument(EXAMPLE_DOCUMENT);
   Assert.assertNotNull(document);
 }