Examples of incrementToken()


Examples of org.apache.lucene.wikipedia.analysis.WikipediaTokenizer.incrementToken()

  static Set<String> getTokens(Article article) throws IOException {
    Set<String> tokenList = new HashSet<String>();
    WikipediaTokenizer tok = new WikipediaTokenizer(new StringReader(article.getText()));
    TermAttribute term = tok.addAttribute(TermAttribute.class);
    try {
      while (tok.incrementToken()) {
        String token = term.term();
        if (!StringUtils.isEmpty(token))
          tokenList.add(token);
      }
    } catch (IOException e) {
View Full Code Here

Examples of org.opensolaris.opengrok.analysis.uue.UuencodeFullTokenizer.incrementToken()

    public void truncatedUuencodedFile() throws IOException {
        UuencodeFullTokenizer tokenizer = new UuencodeFullTokenizer(
                new StringReader("begin 644 test\n"));
        CharTermAttribute term = tokenizer.addAttribute(CharTermAttribute.class);

        assertTrue(tokenizer.incrementToken());
        assertEquals("begin", term.toString());
        assertTrue(tokenizer.incrementToken());
        assertEquals("644", term.toString());
        assertTrue(tokenizer.incrementToken());
        assertEquals("test", term.toString());
View Full Code Here

Examples of org.wltea.analyzer.lucene.IKTokenizer.incrementToken()

 
  public void testLucene3Tokenizer(){
    String t = "IK分词器Lucene Analyzer接口实现类 民生银行";
    IKTokenizer tokenizer = new IKTokenizer(new StringReader(t) , false);
    try {
      while(tokenizer.incrementToken()){
        TermAttribute termAtt = tokenizer.getAttribute(TermAttribute.class);
        System.out.println(termAtt);       
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
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.