Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.Token.reinit()


                public final boolean incrementToken() throws IOException {
                  if (!it.hasNext()) {
                    return false;
                  }

                  reusableToken.reinit(it.next());
                  return true;
                }

                public void reset() throws IOException {
                  it = tokens.iterator();
View Full Code Here


    tokenQueue = new LinkedList<Token>();
  }
 
  public void addToken(String val, int startOffset, int endOffset) {
    Token t = new Token();
    t.reinit(val, startOffset, endOffset);
    tokenQueue.add(t);
  }
 
  @Override
  public Token next(Token token) throws IOException {
View Full Code Here

        Token res = new Token();
        if (null == t1) {
            return t2;
        }
        char[] text = (TokenUtil.termText(t1)+"_"+TokenUtil.termText(t2)).toCharArray();
        res.reinit(text, 0, text.length, t1.startOffset(), t2.endOffset());
        return res;
    }

    @Override
    @Deprecated
View Full Code Here

  }

  private void offer(Token nextToken, String term, int freq) {
    for (int i = 0; i < freq; i++) {
      Token t = new Token();
      t.reinit(nextToken, term);
      queue.offer(t);
    }
  }

  public final Token next(final Token reusableToken)
View Full Code Here

    String type = this.tree.getOEMap().get(nextToken.term());
    if (type != null) {
      for (int i = 0; i < tree.getWeightBase() - 1; i++) {
        Token t = new Token();
        t.reinit(nextToken);
        queue.offer(t);
      }
      String uri = this.tree.getOntModel().expandPrefix(
          ":" + nextToken.term());
      if (type.equals(OntologyElementTree.ONTCLASS)) {
View Full Code Here

                public final boolean incrementToken() throws IOException {
                  if (!it.hasNext()) {
                    return false;
                  }

                  reusableToken.reinit(it.next());
                  return true;
                }

                public void reset() throws IOException {
                  it = tokens.iterator();
View Full Code Here

                {
                    // simple word - just pass it through
                    newTokenText = termText;
                }
            }
            nextToken.reinit(newTokenText, 0, newTokenText.length());
        }
        while (nextToken.termLength() == 0);
        return nextToken;
    }
}
View Full Code Here

            String termText = nextToken.term();
            if (termText.contains(oldPrefix))
            {
                // the term contains the character we're looking for - replace all occurrences
                String keyword = termText.replace(oldPrefix, newPrefix);
                nextToken.reinit(keyword, 0, keyword.length());

                if (keyword.startsWith(newPrefix))
                {
                    // and it started with the keyword
                    if (!extractedKeywords.contains(keyword))
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.