Package org.apache.lucene.analysis.ngram

Examples of org.apache.lucene.analysis.ngram.NGramTokenFilter


    minGramSize = ( minArg != null ? Integer.parseInt( minArg )
        : NGramTokenFilter.DEFAULT_MIN_NGRAM_SIZE );
  }

  public NGramTokenFilter create(TokenStream input) {
    return new NGramTokenFilter( input, minGramSize, maxGramSize );
  }
View Full Code Here


      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
        Tokenizer tokenizer = new EdgeNGramTokenizer(TEST_VERSION_CURRENT, reader, 2, 94);
        //TokenStream stream = new SopTokenFilter(tokenizer);
        TokenStream stream = new ShingleFilter(tokenizer, 5);
        //stream = new SopTokenFilter(stream);
        stream = new NGramTokenFilter(TEST_VERSION_CURRENT, stream, 55, 83);
        //stream = new SopTokenFilter(stream);
        return new TokenStreamComponents(tokenizer, stream);
     
    };
    checkRandomData(random(), analyzer, 2000);
View Full Code Here

   /*
    * (non-Javadoc)
    * @see org.apache.lucene.analysis.Analyzer#tokenStream(java.lang.String, java.io.Reader)
    */
   public TokenStream tokenStream(String fieldName, Reader reader) {
       return new NGramTokenFilter(new WhitespaceTokenizer(reader),2 , 4);
   }
View Full Code Here

   /**
    * @see org.apache.lucene.analysis.Analyzer#tokenStream(java.lang.String, java.io.Reader)
    */
   public TokenStream tokenStream(String fieldName, Reader reader) {
       return new NGramTokenFilter(new UpperCaseFilter(new SentenceTokenizer(reader)), minTokenLength, maxTokenLength);
   }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Override
    public TokenStream create(TokenStream tokenStream) {
        final Version version = this.version == Version.LUCENE_4_3 ? Version.LUCENE_4_4 : this.version; // we supported it since 4.3
        if (version.onOrAfter(Version.LUCENE_4_3)) {
            return new NGramTokenFilter(tokenStream, minGram, maxGram);
        } else {
            return new Lucene43NGramTokenFilter(tokenStream, minGram, maxGram);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.ngram.NGramTokenFilter

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.