Esempio n. 1
0
  public static void showSdiWithCategory2(JCas jcas) {
    String wordsLine = "";
    String catsLine = "";
    int cnt = 0;
    FSIterator<Annotation> it = jcas.getAnnotationIndex(WordAnnotation.type).iterator();
    while (it.hasNext()) {
      cnt += 1;
      WordAnnotation a = (WordAnnotation) it.next();

      String[] strings = center(a.getCoveredText(), a.getTag());
      wordsLine += strings[0] + " ";
      catsLine += strings[1] + " ";
      if (cnt == 20) {
        System.out.println(wordsLine);
        System.out.println(catsLine);
        System.out.println();

        wordsLine = "";
        catsLine = "";
        cnt = 0;
      }
    }
    if (cnt > 0) {
      System.out.println(wordsLine);
      System.out.println(catsLine);
    }
  }
 @Override
 public void process(JCas cas) throws AnalysisEngineProcessException {
   try {
     AnnotationIndex<Annotation> index = cas.getAnnotationIndex(WordAnnotation.type);
     FSIterator<Annotation> iterator = index.iterator();
     while (iterator.hasNext()) {
       WordAnnotation annotation = (WordAnnotation) iterator.next();
       String norm = annotation.getCoveredText();
       annotation.setLemma(norm);
       annotation.setStem(norm);
     }
   } catch (Exception e) {
     throw new AnalysisEngineProcessException(e);
   }
 }
Esempio n. 3
0
 public static void showSdiWithCategory(JCas jcas) {
   FSIterator<Annotation> it = jcas.getAnnotationIndex(WordAnnotation.type).iterator();
   int wordCnt = 0;
   while (it.hasNext()) {
     wordCnt++;
     WordAnnotation a = (WordAnnotation) it.next();
     System.out.print(a.getCoveredText() + "_" + a.getTag());
     if (wordCnt < 12) {
       System.out.print(" ");
     } else {
       System.out.println();
       wordCnt = 0;
     }
   }
   System.out.println(Joiner.on(" ").join(it));
 }