Package org.apache.ctakes.typesystem.type.syntax

Examples of org.apache.ctakes.typesystem.type.syntax.Chunk


  public void initialize(UimaContext uimaContext) throws ResourceInitializationException {
   
  }

  public Annotation createChunk(JCas jCas, int start, int end, String chunkType) {
    Chunk chunk;
    if(chunkType.equals("ADJP")) {
      chunk = new ADJP(jCas, start, end);
    } else if(chunkType.equals("ADVP")) {
      chunk = new ADVP(jCas, start, end);
    } else if(chunkType.equals("CONJP")) {
      chunk = new CONJP(jCas, start, end);
    } else if(chunkType.equals("INTJ")) {
      chunk = new INTJ(jCas, start, end);
    } else if(chunkType.equals("LST")) {
      chunk = new LST(jCas, start, end);
    } else if(chunkType.equals("NP")) {
      chunk = new NP(jCas, start, end);
    } else if(chunkType.equals("PP")) {
      chunk = new PP(jCas, start, end);
    } else if(chunkType.equals("PRT")) {
      chunk = new PRT(jCas, start, end);
    } else if(chunkType.equals("SBAR")) {
      chunk = new SBAR(jCas, start, end);
    } else if(chunkType.equals("UCP")) {
      chunk = new UCP(jCas, start, end);
    } else if(chunkType.equals("VP")) {
      chunk = new VP(jCas, start, end);
    } else if(chunkType.equals("O")) {
      chunk = new O(jCas, start, end);
    } else {
      chunk = new Chunk(jCas, start, end);
    }
       
    chunk.setChunkType(chunkType);
    chunk.addToIndexes();
    return chunk;
  }
View Full Code Here


    // For each Chunk, there is a corresponding more specific such as NP,
    // PP, etc
    FSIterator chunkItr = indexes.getAnnotationIndex(Chunk.type).iterator();
    ArrayList<Chunk> list = new ArrayList<Chunk>();
    while (chunkItr.hasNext()) {
      Chunk baseChunk = (Chunk) chunkItr.next();
      if (baseChunk.getBegin() >= rangeBegin
          && baseChunk.getEnd() <= rangeEnd) {
        list.add(baseChunk);
      }
    }

    // For each chunk in the Sentence, see if the chunk is the start of a
    // matching pattern
    // If so, extend the end offset of the <code>i</code> +
    // <code>indexOfTokenToInclude</code>
    for (int i = 0; i < list.size(); i++) {

      boolean matches = true;
      Chunk chunk = list.get(i);

      while (matches == true) {
        matches = compareToPattern(list, i);
        if (matches) {
          extendChunk(chunk, list.get(i + indexOfTokenToInclude)
View Full Code Here

   * This allows the rule to be applied again.
   *
   */
  private void removeEnvelopedChunks(ArrayList<Chunk> list, int i) {
    for (int j = 0; j < indexOfTokenToInclude; j++) {
      Chunk chunk = list.remove(i + 1);
      if (false)
        logger.info("removed '" + chunk.getCoveredText() + "'");
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.typesystem.type.syntax.Chunk

Copyright © 2018 www.massapicom. 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.