当前位置: 首页>>代码示例>>Java>>正文


Java FSIterator.moveToNext方法代码示例

本文整理汇总了Java中org.apache.uima.cas.FSIterator.moveToNext方法的典型用法代码示例。如果您正苦于以下问题:Java FSIterator.moveToNext方法的具体用法?Java FSIterator.moveToNext怎么用?Java FSIterator.moveToNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.uima.cas.FSIterator的用法示例。


在下文中一共展示了FSIterator.moveToNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkForTheSameBoundaries

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
public static void checkForTheSameBoundaries(CAS cas, Class<? extends AnnotationFS> typeClass) {
    Type type = CasUtil.getType(cas, typeClass);
    FSIterator<AnnotationFS> iter = cas.getAnnotationIndex(type).iterator();
    iter.moveToFirst();
    if (!iter.isValid()) {
        return;
    }
    AnnotationOffsetComparator<AnnotationFS> cmp =
            AnnotationOffsetComparator.instance(AnnotationFS.class);
    AnnotationFS lastAnno = iter.get();
    iter.moveToNext();
    while (iter.isValid()) {
        AnnotationFS anno = iter.get();
        if (cmp.compare(anno, lastAnno) == 0) {
            throw new IllegalStateException(String.format(
                    "Annotations %s and %s have the same boundaries",
                    lastAnno, anno));
        }
        iter.moveToNext();
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:22,代码来源:AnnotationOffsetComparator.java

示例2: getNext

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * Return next element if exists.
 *
 * @param iter   iterator
 * @param anchor an anchor
 * @return next element if exists or null otherwise
 */
private static Token getNext(FSIterator<Token> iter, TokenBase anchor) {
    iter.moveTo(anchor);
    // now the current fs either greater (for tokens seq it means 'after') or equal to the anchor
    if (iter.isValid()) {
        Token result = iter.get();
        if (result.equals(anchor)) {
            iter.moveToNext();
            if (iter.isValid()) {
                return iter.get();
            } else {
                return null;
            }
        } else {
            return result;
        }
    } else {
        return null;
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:27,代码来源:SentenceSplitter.java

示例3: normalizeSpaceBetween

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
private String normalizeSpaceBetween(FSIterator<TokenBase> tbIter, final Token x, final Token y) {
    // X must be before Y
    Preconditions.checkArgument(x == null || y == null || x.getCAS().getAnnotationIndex().compare(x, y) < 0);
    if (x == null) {
        tbIter.moveToFirst();
    } else {
        tbIter.moveTo(x);
    }
    while (// if Y is null then iterate till the end
            (y == null && tbIter.isValid())
                    // else - iterate till the Y
                    || (y != null && !tbIter.get().equals(y))) {
        if (tbIter.get() instanceof BREAK) {
            return "\n";
        }
        tbIter.moveToNext();
    }
    return " ";
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:20,代码来源:NormalizedTextWriter.java

示例4: getLastSentenceInDisplayWindow

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * Get the last sentence CAS address in the current display window
 *
 * @param aJcas
 *            the JCas.
 * @param aFirstSentenceAddress
 *            the CAS address of the first sentence in the display window
 * @param aWindowSize
 *            the window size
 * @return The address of the last sentence address in the current display window.
 */
public static Sentence getLastSentenceInDisplayWindow(JCas aJcas, int aFirstSentenceAddress,
        int aWindowSize)
{
    int count = 0;
    FSIterator<Sentence> si = seekByAddress(aJcas, Sentence.class, aFirstSentenceAddress);
    Sentence s = si.get();
    while (count < aWindowSize - 1) {
        si.moveToNext();
        if (si.isValid()) {
            s = si.get();
        }
        else {
            break;
        }
        count++;
    }

    return s;
}
 
开发者ID:webanno,项目名称:webanno,代码行数:31,代码来源:WebAnnoCasUtil.java

示例5: testChunkUnambiguousStrictSubiterator

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
private void testChunkUnambiguousStrictSubiterator(JCas testJcas,
		AnnotationIndex<Annotation> annotationIndex) {
	System.out.println("Debug: ---------------------------------------------------------------");

	System.out.println("Debug: unambiguous and strict subiterating all the chunk annotations");
	AnnotationIndex<Annotation> chunkAnnotationIndex = (AnnotationIndex<Annotation>) testJcas.getAnnotationIndex(Chunk.type);
	for (Annotation aChunk : chunkAnnotationIndex) {
		FSIterator<Annotation> chunkSubIterator = annotationIndex.subiterator(aChunk,false,true);
		System.out.println("annotation to subiterate type>"+aChunk.getClass().getName()+"< coveredText>"+aChunk.getCoveredText()+"<");

		while(chunkSubIterator.isValid()) {
			Annotation subAnnotation = chunkSubIterator.get();

			System.out.println("moveToNext subAnnotation type>"+subAnnotation.getClass().getName()+"< coveredText>"+subAnnotation.getCoveredText()+"<");
			chunkSubIterator.moveToNext();
		}
	}
}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:19,代码来源:TestLocatedAnnotationAE.java

示例6: testNonAmbiguousIterator

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * @param annotationIndex
 */
private void testNonAmbiguousIterator(
		AnnotationIndex<Annotation> annotationIndex) {
	FSIterator<Annotation> annotationIndexIterator;
	Annotation annotation;
	System.out.println("Debug: ---------------------------------------------------------------");
	System.out.println("Debug: non-ambiguous iteration over an annotation index");
	annotationIndexIterator = annotationIndex.iterator(false);
	annotationIndexIterator.moveToFirst();
	annotation = annotationIndexIterator.get();
	System.out.println("first annotation coveredText>"+annotation.getCoveredText()+"< type>"+annotation.getClass().getName()+"< ");
	annotationIndexIterator.moveToNext();
	while(annotationIndexIterator.isValid()) {
		annotation = annotationIndexIterator.get();
		System.out.println("moveToNext annotation coveredText>"+annotation.getCoveredText()+"< type>"+annotation.getClass().getName()+"<");
		annotationIndexIterator.moveToNext();
	}
}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:21,代码来源:TestLocatedAnnotationAE.java

示例7: testNonAmbiguousIteratorOverAnIndexOfAGivenType

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * @param inputViewJCas
 * @param firstChunk
 */
private void testNonAmbiguousIteratorOverAnIndexOfAGivenType(JCas inputViewJCas,
		Annotation firstChunk) {
	AnnotationIndex<Annotation> annotationIndex;
	FSIterator<Annotation> annotationIndexIterator;
	Annotation annotation;
	System.out.println("Debug: ---------------------------------------------------------------");
	System.out.println("Debug: moveTo+ non-ambiguous iteration over an annotation index (of Chunk.type)");
	annotationIndex = (AnnotationIndex<Annotation>) inputViewJCas.getAnnotationIndex(Chunk.type);

	annotationIndexIterator = annotationIndex.iterator(false);
	annotationIndexIterator.moveTo(firstChunk);
	annotation = annotationIndexIterator.get();
	System.out.println("moveTo annotation (first chunk firstly met) coveredText>"+annotation.getCoveredText()+"< type>"+annotation.getClass().getName()+"< ");
	annotationIndexIterator.moveToNext();
	while(annotationIndexIterator.isValid()) {
		annotation = annotationIndexIterator.get();
		System.out.println("moveToNext annotation coveredText>"+annotation.getCoveredText()+"< type>"+annotation.getClass().getName()+"<");
		annotationIndexIterator.moveToNext();
	}
}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:25,代码来源:TestLocatedAnnotationAE.java

示例8: process

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {
    String txt = jCas.getDocumentText();
    if (txt == null || txt.isEmpty()) {
        return;
    }
    int txtLength = txt.length();
    AnnotationIndex<Annotation> tokenIndex = jCas
            .getAnnotationIndex(TokenBase.typeIndexID);
    FSIterator<Annotation> tokenIter = tokenIndex.iterator();
    if (!tokenIter.isValid()) {
        makeNTSpan(jCas, 0, txtLength);
    } else {
        int lastTokenEnd = 0;
        while (tokenIter.isValid()) {
            Annotation token = tokenIter.get();
            if (token.getBegin() > lastTokenEnd) {
                makeNTSpan(jCas, lastTokenEnd, token.getBegin());
            }
            lastTokenEnd = token.getEnd();
            //
            tokenIter.moveToNext();
        }
        // check the span after the last token
        if (txtLength > lastTokenEnd) {
            makeNTSpan(jCas, lastTokenEnd, txtLength);
        }
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:30,代码来源:NonTokenizedSpanAnnotator.java

示例9: areAdjoining

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
public static boolean areAdjoining(Token t1, Token t2) {
    JCas jCas = getJCas(t1);
    FSIterator<Annotation> tokenIter = jCas.getAnnotationIndex(Token.typeIndexID).iterator();
    tokenIter.moveTo(t1);
    assert (t1.equals(tokenIter.get()));
    tokenIter.moveToNext();
    return tokenIter.isValid() && tokenIter.get().equals(t2);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:9,代码来源:TokenUtils.java

示例10: printAnnotations

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
  * (A code that is borrowed from UIMA-library example)
  * Prints all Annotations to a PrintStream.
  * 
  * @param aCAS
  *          the CAS containing the FeatureStructures to print
  * @param aOut
  *          the PrintStream to which output will be written
  */

public static void printAnnotations(CAS aCAS, PrintStream aOut) {
    // get iterator over annotations
    FSIterator<AnnotationFS> iter = aCAS.getAnnotationIndex().iterator();

    // iterate
    while (iter.isValid()) {
      FeatureStructure fs = iter.get();
      printFS(fs, aCAS, 0, aOut);
      iter.moveToNext();
    }
  }
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:22,代码来源:PlatformCASProber.java

示例11: selectMatching

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * REM: modified from CasUtils..
 * 
 * Get a list of annotations of the given annotation type constraint by a
 * start and end. It's good to provide an annotation that is close to the
 * region, to quickly move the iterator
 * 
 * @param cas
 *            a CAS.
 * @param type
 *            a UIMA type.
 * @param annotationCloseToTheRegion
 *            the covering annotation.
 * @return a return value.
 * @see Subiterator
 */
private static List<Annotation> selectMatching(CAS cas, final int begin,
        final int end, AnnotationFS annotationCloseToTheRegion) {

    final List<Annotation> list = new ArrayList<Annotation>();
    final FSIterator<AnnotationFS> it = cas.getAnnotationIndex().iterator();

    // Try to seek the insertion point.
    it.moveTo(annotationCloseToTheRegion);

    // If the insertion point is beyond the index, move back to the last.
    if (!it.isValid()) {
        it.moveToLast();
        if (!it.isValid()) {
            return list;
        }
    }

    // Ignore type priorities by seeking to the first that has the same
    // begin
    boolean moved = false;
    while (it.isValid() && (it.get()).getBegin() >= begin) {
        it.moveToPrevious();
        moved = true;
    }

    // If we moved, then we are now on one starting before the requested
    // begin, so we have to
    // move one ahead.
    if (moved) {
        it.moveToNext();
    }

    // If we managed to move outside the index, start at first.
    if (!it.isValid()) {
        it.moveToFirst();
    }

    // Skip annotations whose start is before the start parameter.
    while (it.isValid() && (it.get()).getBegin() < begin) {
        it.moveToNext();
    }

    while (it.isValid()) {
        AnnotationFS a = it.get();
        if (!(a instanceof Annotation))
            continue;

        // If the start of the current annotation is past the end parameter,
        // we're done.
        if (a.getBegin() > end) {
            break;
        }
        it.moveToNext();

        if (a.getBegin() == begin && a.getEnd() == end) {
            list.add((Annotation) a);
        }
    }
    return unmodifiableList(list);
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:77,代码来源:AbbreviationsExpanderAnnotator.java

示例12: testGatePOSTagger

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
public void testGatePOSTagger() throws Exception {
  // load the TAE containing UIMA tokeniser and GATE POS tagger
  File tokAndPOSTaggerDescriptorFile =
    new File(testConfDir, "TokenizerAndPOSTagger.xml");

  XMLInputSource inputSource =
    new XMLInputSource(tokAndPOSTaggerDescriptorFile);

  ResourceSpecifier tokAndPOSTaggerDescriptor =
    uimaXMLParser.parseResourceSpecifier(inputSource);

  AnalysisEngine tokAndPOSTagger =
    UIMAFramework.produceAnalysisEngine(tokAndPOSTaggerDescriptor);

  // create CAS and populate it with initial text.
  CAS cas = tokAndPOSTagger.newCAS();

  cas.setDocumentText(
      "This is a test document. This is the second sentence.");
  // what POS tags do we expect to get back?
  String[] expectedPOSTags = new String[] {
    "DT",    // This
    "VBZ",   // is
    "DT",    // a
    "NN",    // test
    "NN",    // document
    ".",     // .
    "DT",    // This
    "VBZ",   // is
    "DT",    // the
    "JJ",    // second
    "NN",    // sentence
    "."      // .
  };

  // run the beast
  tokAndPOSTagger.process(cas);

  // check the results have the right POS tags
  Type tokenType = cas.getTypeSystem().getType(
      "org.apache.uima.examples.tokenizer.Token");
  assertNotNull("Token type not found in type system", tokenType);

  Feature posFeature = tokenType.getFeatureByBaseName("POS");
  assertNotNull("Token POS feature not found", posFeature);
  
  FSIndex tokensIndex = cas.getAnnotationIndex(tokenType);
  FSIterator tokensIt = tokensIndex.iterator();
  int tokenNo = 0;
  while(tokensIt.isValid()) {
    // make sure we don't have too many tokens
    assertTrue("Found more tokens than expected",
               tokenNo < expectedPOSTags.length);
    FeatureStructure token = tokensIt.get();
    String actualPOS = token.getStringValue(posFeature);
    assertEquals("Token has wrong part of speech",
                 expectedPOSTags[tokenNo], actualPOS);
    tokensIt.moveToNext();
    tokenNo++;
  }

  assertEquals("Found fewer tokens than expected",
               tokenNo, expectedPOSTags.length);
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:65,代码来源:TestGATEInUIMA.java

示例13: testChunkSubiterator

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
	 * @param testJcas
	 * @param annotationIndex
	 * 
	 * Debug: ---------------------------------------------------------------
Debug: subiterating all the chunk annotations
annotation to subiterate type>common.types.text.Chunk< coveredText>Verne<
moveToNext subAnnotation type>org.apache.uima.examples.SourceDocumentInformation< coveredText><
annotation to subiterate type>common.types.text.Chunk< coveredText>visited<
annotation to subiterate type>common.types.text.Chunk< coveredText>the seaport of Nantes<
moveToNext subAnnotation type>common.types.text.Chunk< coveredText>the seaport<
moveToNext subAnnotation type>common.types.text.Token< coveredText>the<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>the<
moveToNext subAnnotation type>common.types.text.Token< coveredText>seaport<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>seaport<
moveToNext subAnnotation type>common.types.text.Chunk< coveredText>of Nantes<
moveToNext subAnnotation type>common.types.text.Token< coveredText>of<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>of<
moveToNext subAnnotation type>common.types.text.Token< coveredText>Nantes<
moveToNext subAnnotation type>common.types.ne.NamedEntity< coveredText>Nantes<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>Nantes<
annotation to subiterate type>common.types.text.Chunk< coveredText>the seaport<
moveToNext subAnnotation type>common.types.text.Token< coveredText>the<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>the<
moveToNext subAnnotation type>common.types.text.Token< coveredText>seaport<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>seaport<
annotation to subiterate type>common.types.text.Chunk< coveredText>of Nantes<
moveToNext subAnnotation type>common.types.text.Token< coveredText>of<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>of<
moveToNext subAnnotation type>common.types.text.Token< coveredText>Nantes<
moveToNext subAnnotation type>common.types.ne.NamedEntity< coveredText>Nantes<
moveToNext subAnnotation type>common.types.coref.Coreference< coveredText>Nantes<
	 */
	private void testChunkSubiterator(JCas testJcas,
			AnnotationIndex<Annotation> annotationIndex) {
		System.out.println("Debug: ---------------------------------------------------------------");

		System.out.println("Debug: ambiguous subiterating all the chunk annotations");
		AnnotationIndex<Annotation> chunkAnnotationIndex = (AnnotationIndex<Annotation>) testJcas.getAnnotationIndex(Chunk.type);
		for (Annotation aChunk : chunkAnnotationIndex) {
			FSIterator<Annotation> chunkSubIterator = annotationIndex.subiterator(aChunk);
			System.out.println("annotation to subiterate type>"+aChunk.getClass().getName()+"< coveredText>"+aChunk.getCoveredText()+"<");

			while(chunkSubIterator.isValid()) {
				Annotation subAnnotation = chunkSubIterator.get();

				System.out.println("moveToNext subAnnotation type>"+subAnnotation.getClass().getName()+"< coveredText>"+subAnnotation.getCoveredText()+"<");
				chunkSubIterator.moveToNext();
			}
		}
	}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:52,代码来源:TestLocatedAnnotationAE.java

示例14: testTypeSubsumptionConstrainedIterator

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * @param inputViewJCas
 * @param annotationIndexIterator
 */
private void testTypeSubsumptionConstrainedIterator(JCas inputViewJCas,
		FSIterator<Annotation> annotationIndexIterator) {
	Annotation annotation;
	// -- constrained iterator chunk which words occurs at the same offsets 
	System.out.println("Debug: ---------------------------------------------------------------");
	System.out.println("Debug: constrained iterator chunk which words occurs at the same offsets (do not work since none is the surtype of the other) ; works with tcas.annotation");
	// 
	// Start by getting the constraint factory from the CAS.
	ConstraintFactory cf = inputViewJCas.getConstraintFactory();

	// To specify a path to an item to test, you start by
	// creating an empty path.
	//FeaturePath path = cas.createFeaturePath();

	// Add POS feature to path, creating one-element path.
	//path.addFeature(posFeat);

	// You can extend the chain arbitrarily by adding additional
	// features.

	// Create a new type constraint.  

	// Type constraints will check that structures
	// they match against have a type at least as specific
	// as the type specified in the constraint.
	FSTypeConstraint chunkConstraint = cf.createTypeConstraint();

	// Set the type (by default it is TOP).
	// This succeeds if the type being tested by this constraint
	// is nounType or a subtype of nounType.
	chunkConstraint.add(inputViewJCas.getTypeSystem().getType("common.types.text.Chunk"));


	// Embed the noun constraint under the pos path.
	// This means, associate the test with the path, so it tests the
	// proper value.

	// The result is a test which will
	// match a feature structure that has a posFeat defined
	// which has a value which is an instance of a nounType or
	// one of its subtypes.
	//FSMatchConstraint embeddedNoun = cf.embedConstraint(path, chunkConstraint);

	// Create a type constraint for token (or a subtype of it)
	FSTypeConstraint uimaTCasAnnotationConstraint = cf.createTypeConstraint();

	// Set the type.
	uimaTCasAnnotationConstraint.add(inputViewJCas.getTypeSystem().getType("uima.tcas.Annotation"));

	// Create the final constraint by conjoining the two constraints.
	FSMatchConstraint chunkAndLexicalUnitCons = cf.and(chunkConstraint, uimaTCasAnnotationConstraint);

	// Create a filtered iterator from some annotation iterator.
	FSIterator uimaTCasAnnotationUnitIterator = inputViewJCas.createFilteredIterator(annotationIndexIterator, chunkAndLexicalUnitCons);

	uimaTCasAnnotationUnitIterator.moveToFirst();

	annotation = (Annotation) uimaTCasAnnotationUnitIterator.get();
	System.out.println("first chunkAndLexicalUnitIterator annotation type>"+annotation.getClass().getName()+"< coveredText>"+annotation.getCoveredText()+"<");
	uimaTCasAnnotationUnitIterator.moveToNext();

	while(uimaTCasAnnotationUnitIterator.isValid()) {
		annotation =  (Annotation) uimaTCasAnnotationUnitIterator.get();

		System.out.println("moveToNext chunkAndLexicalUnitIterator annotation type>"+annotation.getClass().getName()+"< coveredText>"+annotation.getCoveredText()+"<");
		uimaTCasAnnotationUnitIterator.moveToNext();
	}
}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:73,代码来源:TestLocatedAnnotationAE.java

示例15: testSelectSpecificTypesConstrainedIterator

import org.apache.uima.cas.FSIterator; //导入方法依赖的package包/类
/**
 * @param inputViewJCas
 * @param annotationIndexIterator
 */
private void testSelectSpecificTypesConstrainedIterator(JCas inputViewJCas,
		FSIterator<Annotation> annotationIndexIterator) {
	Annotation annotation;
	// -- constrained iterator chunk which words occurs at the same offsets 
	System.out.println("Debug: ---------------------------------------------------------------");
	System.out.println("Debug: constrained iterator over two types (noun and verb) without inheritance relations");

	// Start by getting the constraint factory from the CAS.
	ConstraintFactory cf = inputViewJCas.getConstraintFactory();

	// Create a new type constraint.  

	// Type constraints will check that structures
	// they match against have a type at least as specific
	// as the type specified in the constraint.
	FSTypeConstraint nounConstraint = cf.createTypeConstraint();

	// Set the type (by default it is TOP).
	// This succeeds if the type being tested by this constraint
	// is nounType or a subtype of nounType.
	nounConstraint.add(inputViewJCas.getTypeSystem().getType("common.types.text.Noun"));


	FSTypeConstraint verbConstraint = cf.createTypeConstraint();

	// Set the type (by default it is TOP).
	// This succeeds if the type being tested by this constraint
	// is nounType or a subtype of nounType.
	verbConstraint.add(inputViewJCas.getTypeSystem().getType("common.types.text.Verb"));



	// Create the final constraint by conjoining the two constraints.
	FSMatchConstraint nounOrVerbConstraint = cf.or(verbConstraint, nounConstraint);

	// Create a filtered iterator from some annotation iterator.
	FSIterator uimaTCasAnnotationUnitIterator = inputViewJCas.createFilteredIterator(annotationIndexIterator, nounOrVerbConstraint);

	uimaTCasAnnotationUnitIterator.moveToFirst();

	annotation = (Annotation) uimaTCasAnnotationUnitIterator.get();
	System.out.println("first nounOrVerbConstraint annotation type>"+annotation.getClass().getName()+"< coveredText>"+annotation.getCoveredText()+"<");
	uimaTCasAnnotationUnitIterator.moveToNext();

	while(uimaTCasAnnotationUnitIterator.isValid()) {
		annotation =  (Annotation) uimaTCasAnnotationUnitIterator.get();

		System.out.println("moveToNext nounOrVerbConstraint annotation type>"+annotation.getClass().getName()+"< coveredText>"+annotation.getCoveredText()+"<");
		uimaTCasAnnotationUnitIterator.moveToNext();
	}
}
 
开发者ID:nicolashernandez,项目名称:dev-star,代码行数:56,代码来源:TestLocatedAnnotationAE.java


注:本文中的org.apache.uima.cas.FSIterator.moveToNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。