Package org.apache.uima.jcas

Examples of org.apache.uima.jcas.JFSIndexRepository


   * @param end
   * @return int[] - int[0] is begin offset and int[1] is end offset of subsequent sentence end (if available)
   */
private int[] getNarrativeSpansContainingGivenSpanType(JCas jcas, int begin, int annotType)
{
  JFSIndexRepository indexes = jcas.getJFSIndexRepository();
  Iterator iter = indexes.getAnnotationIndex(annotType).iterator();
  int[] span = new int[2];
  boolean foundFirstTypeSpan = false;
  boolean foundSecondTypeSpan = false;
  int spanSizeCount = 0;
  while (iter.hasNext() && !foundSecondTypeSpan)
View Full Code Here


   * @param begin
   * @param end
   * @return
   */
  private int [] findOffsetsInPattern(JCas jcas, int begin, int end, int elementType, int[][] location, boolean highest) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();//FSUtil.getAnnotationsInSpanIterator(jcas, elementType, begin, end);
    int [] lastLocation =  {-1,-1};
    boolean wantMuliple = true;
    if (elementType == StrengthUnitAnnotation.type) {
      while (neItr.hasNext() && wantMuliple) {
        StrengthUnitAnnotation nea = (StrengthUnitAnnotation) neItr.next();
View Full Code Here

   * @return int[0] is begin offset and int[1] is end offset
   * @throws Exception
   */
  private int[] getAdjustedWindowSpan(JCas jcas,  int begin, int end, boolean highestRange) throws Exception {
    int[] spanStrength = {-1, -1}, spanFrequency = {-1, -1}, spanDose = {-1, -1};
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    int[] senSpan = {begin, end };

    // Up to 10 of each type of signature item and drug mentions are allowed.  If more than that are available the
    // ArrayIndexOutOfBoundsException is thrown/caught and the sentence is skipped

View Full Code Here

   * @param begin
   * @param end
   * @return
   */
  private int findInPattern(JCas jcas, int begin, int end, int elementType, int[][] location) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();//FSUtil.getAnnotationsInSpanIterator(jcas, elementType, begin, end);
    int [] lastLocation =  {-1,-1};
    int counter = 0;
    if (elementType == StrengthUnitAnnotation.type) {
      while (neItr.hasNext()) {
        StrengthUnitAnnotation nea = (StrengthUnitAnnotation) neItr.next();
View Full Code Here

   * @param begin
   * @param end
   * @return
   */
  private int lastInPattern(JCas jcas, int begin, int end, int elementType, int[][] location) {
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    Iterator neItr = indexes.getAnnotationIndex(elementType).iterator();
    int [] lastLocation =  {-1,-1};
    int counter = 0;
    if (elementType == StrengthAnnotation.type) {
      int holdBeginElement = 0, holdEndElement = 0;
      while (neItr.hasNext()) {
View Full Code Here

    {
      JCas jcas;
      jcas = cas.getJCas();
   
      List<String> offsets = new ArrayList<String>();
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
      Iterator<?> tokenItr = indexes.getAnnotationIndex(BaseToken.type).iterator();
          while (tokenItr.hasNext())
          {
            BaseToken token = (BaseToken) tokenItr.next();
            String offset = ""+token.getBegin()+"|"+token.getEnd();
            offsets.add(offset);
View Full Code Here

      JCas jcas;
      jcas = cas.getJCas();
   
      StringBuffer normalizedText = new StringBuffer();
     
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
          Iterator<?> tokenItr = indexes.getAnnotationIndex(WordToken.type).iterator();
          while (tokenItr.hasNext())
          {
            WordToken token = (WordToken) tokenItr.next();
            String tokenNormText = token.getCanonicalForm();
            normalizedText.append(tokenNormText+" ");         
View Full Code Here

{
  public static String getDocumentID(JCas jcas)
  {
    try
    {
       JFSIndexRepository indexes = jcas.getJFSIndexRepository();
       FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
       DocumentID documentIDAnnotation = (DocumentID) documentIDIterator.next();
       String documentID = documentIDAnnotation.getDocumentID();
       return documentID;
    }
    catch(Exception e) { return null;}
View Full Code Here

      endFeaturePath.addFeature(endSpanFeature);
      FSMatchConstraint endSpanConstraint = constraintFactory.embedConstraint(endFeaturePath, windowConstraint);
     
      FSMatchConstraint spanConstraint = constraintFactory.and(beginSpanConstraint, endSpanConstraint);
     
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
      FSIndex<?> annotIndex = indexes.getAnnotationIndex(type);
      FSIterator<?> annotsInSpanItr = jcas.createFilteredIterator(annotIndex.iterator(), spanConstraint);
      return annotsInSpanItr;
  }
View Full Code Here

    iv_logger.info("process(JCas)");

    try
    {
      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
      FSIterator segmentItr = indexes.getAnnotationIndex(Segment.type).iterator();
      FSIterator baseTokenItr = indexes.getAnnotationIndex(BaseToken.type).iterator();

      List<org.apache.ctakes.core.fsm.token.BaseToken> baseTokenList = new ArrayList<org.apache.ctakes.core.fsm.token.BaseToken>();
      while (baseTokenItr.hasNext())
      {
        BaseToken bta = (BaseToken) baseTokenItr.next();
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.JFSIndexRepository

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.