Examples of JCas


Examples of org.apache.uima.jcas.JCas

  @SuppressWarnings("unchecked")
  @Test
  public void mockedAnnotatorTest() {
    try {
      String mockedAnnotatorName = MockedMicroformatsAnnotator.class.getName();
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAEWithMockedImplementation(XML_PATH,mockedAnnotatorName), URL);
      List<MicroformatFS> microformats = (List<MicroformatFS>) TestUtils.getAllFSofType(MicroformatFS.type, resultingCAS);
      assertTrue(microformats!=null);
      assertTrue(microformats.size()==2);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @Test
  public void annotatorIntegrationTest() {
    try {
      Map<String,Object> parameterSettings = new HashMap<String, Object>();
      parameterSettings.put("apikey","04490000a72fe7ec5cb3497f14e77f338c86f2fe");
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAE(XML_PATH,parameterSettings), DOC);
      List<LanguageFS> language = (List<LanguageFS>) TestUtils.getAllFSofType(LanguageFS.type, resultingCAS);
      assertTrue(language!=null);
      assertTrue(language.size()==1);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @SuppressWarnings("unchecked")
  @Test
  public void mockedAnnotatorTest() {
    try {
      String mockedAnnotatorName = MockedTextLanguageDetectionAnnotator.class.getName();
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAEWithMockedImplementation(XML_PATH,mockedAnnotatorName), DOC);
      List<LanguageFS> language = (List<LanguageFS>) TestUtils.getAllFSofType(LanguageFS.type, resultingCAS);
      assertTrue(language!=null);
      assertTrue(language.size()==1);
    }
    catch (Exception e) {
View Full Code Here

Examples of org.apache.uima.jcas.JCas

    String doc = "The BBC's Jim Muir says the Tunisians have been struggling to cope with the deluge of refugees";
    String xmlPath = "desc/TextSentimentAnalysisAEDescriptor.xml";
    try {
      Map<String, Object> parameterSettings = new HashMap<String, Object>();
      parameterSettings.put("apikey", "04490000a72fe7ec5cb3497f14e77f338c86f2fe");
      JCas sentimentJCas = TestUtils.executeAE(TestUtils.getAE(xmlPath, parameterSettings), doc);
      List<SentimentFS> sentimentList = (List<SentimentFS>) TestUtils.getAllFSofType(
              SentimentFS.type, sentimentJCas);
      assertTrue(sentimentList != null);
      assertTrue(sentimentList.size() == 1);
      SentimentFS sentimentFS = sentimentList.get(0);
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  public void annotatorIntegrationTest() {
    try {
      Map<String, Object> parameterSettings = new HashMap<String, Object>();
      parameterSettings.put("apikey", "04490000a72fe7ec5cb3497f14e77f338c86f2fe");
      String documentText = FileUtils.file2String(new File(DOCPATH));
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAE(XML_PATH, parameterSettings),
              documentText);
      List<TelevisionStation> entities = (List<TelevisionStation>) TestUtils.getAllFSofType(
              TelevisionStation.type, resultingCAS);
      assertTrue(entities != null);
      assertTrue(entities.size() == 1);
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @SuppressWarnings("unchecked")
  @Test
  public void mockedAnnotatorTest() {
    try {
      String mockedAnnotatorName = MockedTextRankedEntityAnnotator.class.getName();
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAEWithMockedImplementation(XML_PATH,
              mockedAnnotatorName), DOC);
      List<Country> entities = (List<Country>) TestUtils.getAllFSofType(Country.type, resultingCAS);
      assertTrue(entities != null);
      assertTrue(entities.size() == 1);
    } catch (Exception e) {
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @Test
  public void mockedNotSyncAnnotatorTest() {
    try {
      String mockedAnnotatorName = MockedNotSyncTextRankedEntityAnnotator.class.getName();
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAEWithMockedImplementation(XML_PATH,
              mockedAnnotatorName), DOC);
      assertTrue(resultingCAS != null);
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.toString());
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @Test
  public void testAnalysisEngineError() {
    try {
      Map<String, Object> parameterSettings = new HashMap<String, Object>();
      parameterSettings.put("apikey", "asdasdas12131");
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAE("desc/TextCategorizationAEDescriptor.xml", parameterSettings), "the big brown fox jumped on the table");
      fail("it should've failed with AnalysisEngineProcessException but it worked flawlessly");
    } catch (ResourceInitializationException e) {
      fail("it should've failed with AnalysisEngineProcessException - "+e.getLocalizedMessage());
    } catch (AnalysisEngineProcessException e) {
      assertEquals("org.apache.uima.alchemy.annotator.exception.AlchemyCallFailedException: ERROR - invalid-api-key",
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @Test
  public void annotatorIntegrationTest() {
    try {
      Map<String,Object> parameterSettings = new HashMap<String, Object>();
      parameterSettings.put("apikey","04490000a72fe7ec5cb3497f14e77f338c86f2fe");
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAE(XML_PATH,parameterSettings), DOC);
      List<Category> categories = (List<Category>) TestUtils.getAllFSofType(Category.type, resultingCAS);
      assertTrue(categories!=null);
      assertTrue(categories.size()==1);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.apache.uima.jcas.JCas

  @SuppressWarnings("unchecked")
  @Test
  public void mockedAnnotatorTest() {
    try {
      String mockedAnnotatorName = MockedTextCategorizationAnnotator.class.getName();
      JCas resultingCAS = TestUtils.executeAE(TestUtils.getAEWithMockedImplementation(XML_PATH,mockedAnnotatorName), DOC);
      List<Category> categories = (List<Category>) TestUtils.getAllFSofType(Category.type, resultingCAS);
      assertTrue(categories!=null);
      assertTrue(categories.size()==1);
    }
    catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.