@Override
  public void process( JCas jcas ) throws AnalysisEngineProcessException {
    String text = jcas.getDocumentText();
    int begin = 0; 
    int end = 0;
    
    //lingpipe solution
    File modelFile = new File("./src/main/resources/model/ne-en-bio-genetag.HmmChunker");
    Chunker chunker = null;
    try {
      chunker = (Chunker) AbstractExternalizable.readObject(modelFile);
    } catch (IOException e1) {
      e1.printStackTrace();
    } catch (ClassNotFoundException e1) {
      e1.printStackTrace();
    }
     
    Pattern eol = Pattern.compile("\n");
    Matcher matcher = eol.matcher(text);
    while ( matcher.find() ) {
      end = matcher.start();
      String line = text.substring(begin , end);
      String[] fields = line.split(" " , 2);
      Chunking chunking = chunker.chunk(fields[1]);
      Iterator<Chunk> citer = chunking.chunkSet().iterator();
      while(citer.hasNext())
      {
        Chunk c = citer.next();
        int offset = 0;
        int inneroffset = 0;
        //System.out.println(fields[1]);
        for(int i=0; i<c.start(); i++)
        {
          if(fields[1].charAt(i) == ' ') offset++;
        }
        for(int i=c.start(); i<c.end(); i++)
        {
          if(fields[1].charAt(i) == ' ') inneroffset++;
        }
        
        GeneAnnotation g = new GeneAnnotation(jcas);
        g.setIdentifier(fields[0]);
        g.setGeneName(fields[1].substring(c.start(), c.end()));
        g.setStartOffset(c.start() - offset);
        g.setEndOffset(c.end() - offset - inneroffset - 1);
        g.addToIndexes();
      }
      
      //Stanford NLP solution
      /*PosTagNamedEntityRecognizer p;
      try {
        p = new PosTagNamedEntityRecognizer();
        Map<Integer, Integer> m = new HashMap<Integer, Integer>();
        m = p.getGeneSpans(fields[1]);
        Iterator<Entry<Integer, Integer>> iter = m.entrySet().iterator();
        while(iter.hasNext())
        {
          Map.Entry entry = iter.next();
          Object start_index = entry.getKey();
          Object end_index = entry.getValue();
          
          // create gene annotation CAS
          GeneAnnotation g = new GeneAnnotation(jcas);
          g.setIdentifier(fields[0]);
          g.setGeneName(fields[1].substring((Integer)start_index, (Integer)end_index));
          g.setStartOffset((Integer)start_index);
          g.setEndOffset((Integer)end_index);
          g.addToIndexes();
        }
      } catch (ResourceInitializationException e) {
        e.printStackTrace();
      }*/
      begin = matcher.end();
    }
  }