Package org.apache.lucene.analysis.en

Examples of org.apache.lucene.analysis.en.EnglishAnalyzer


   
    IndexReader indexReader = IndexReader.open(directory); //<co id="mlt.indexsetup"/>
    IndexSearcher indexSearcher = new IndexSearcher(indexReader);

    Analyzer analyzer //<co id="mlt.analyzersetup"/>
      = new EnglishAnalyzer(Version.LUCENE_36);
   
    if (nGramSize > 1) { //<co id="mlt.ngramsetup"/>
      analyzer = new ShingleAnalyzerWrapper(analyzer, nGramSize,
              nGramSize);
    }
View Full Code Here


      }

      Directory directory = FSDirectory.open(new File(modelPath));
      IndexReader indexReader = IndexReader.open(directory);
      Analyzer analyzer   //<co id="mlt.analyzersetup"/>
        = new EnglishAnalyzer(Version.LUCENE_36);
     
      MoreLikeThisCategorizer categorizer
        = new MoreLikeThisCategorizer(indexReader, categoryField);
      categorizer.setAnalyzer(analyzer);
      categorizer.setMatchMode(mode);
View Full Code Here

  protected void openIndexWriter(String pathname) throws IOException {
    //<start id="lucene.examples.index.setup"/>
    Directory directory //<co id="luc.index.dir"/>
      = FSDirectory.open(new File(pathname));
    Analyzer analyzer   //<co id="luc.index.analyzer"/>
      = new EnglishAnalyzer(Version.LUCENE_36);
   
    if (nGramSize > 1) { //<co id="luc.index.shingle"/>
      ShingleAnalyzerWrapper sw
        = new ShingleAnalyzerWrapper(analyzer,
            nGramSize, // min shingle size
View Full Code Here

        analyzerProviderFactories.put("chinese", new PreBuiltAnalyzerProviderFactory("chinese", AnalyzerScope.INDICES, new ChineseAnalyzer()));
        analyzerProviderFactories.put("cjk", new PreBuiltAnalyzerProviderFactory("cjk", AnalyzerScope.INDICES, new ChineseAnalyzer()));
        analyzerProviderFactories.put("czech", new PreBuiltAnalyzerProviderFactory("czech", AnalyzerScope.INDICES, new CzechAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("dutch", new PreBuiltAnalyzerProviderFactory("dutch", AnalyzerScope.INDICES, new DutchAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("danish", new PreBuiltAnalyzerProviderFactory("danish", AnalyzerScope.INDICES, new DanishAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("english", new PreBuiltAnalyzerProviderFactory("english", AnalyzerScope.INDICES, new EnglishAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("finnish", new PreBuiltAnalyzerProviderFactory("finnish", AnalyzerScope.INDICES, new FinnishAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("french", new PreBuiltAnalyzerProviderFactory("french", AnalyzerScope.INDICES, new FrenchAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("galician", new PreBuiltAnalyzerProviderFactory("galician", AnalyzerScope.INDICES, new GalicianAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("german", new PreBuiltAnalyzerProviderFactory("german", AnalyzerScope.INDICES, new GermanAnalyzer(Lucene.ANALYZER_VERSION)));
        analyzerProviderFactories.put("greek", new PreBuiltAnalyzerProviderFactory("greek", AnalyzerScope.INDICES, new GreekAnalyzer(Lucene.ANALYZER_VERSION)));
View Full Code Here

    private final EnglishAnalyzer analyzer;

    @Inject public EnglishAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, Environment env, @Assisted String name, @Assisted Settings settings) {
        super(index, indexSettings, name, settings);
        analyzer = new EnglishAnalyzer(version,
                Analysis.parseStopWords(env, settings, EnglishAnalyzer.getDefaultStopSet()),
                Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    }
View Full Code Here

 
  /** parse a syn file with bad syntax */
  @Test(expected=ParseException.class)
  public void testInvalidPositionsInput() throws Exception {
    String testFile = "testola => the test";
    SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
    parser.add(new StringReader(testFile));
  }
View Full Code Here

 
  /** parse a syn file with bad syntax */
  @Test(expected=ParseException.class)
  public void testInvalidPositionsOutput() throws Exception {
    String testFile = "the test => testola";
    SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
    parser.add(new StringReader(testFile));
  }
View Full Code Here

    } catch (IOException e) {
      e.printStackTrace();
    }

    Analyzer analyzer = new EnglishAnalyzer(stopwords);

    String querystr = "Alice";
//    String querystr = "\"Alice\'s Adventures in Wonderland\"";
    try {
      QueryBuilder builder = new QueryBuilder(analyzer);
View Full Code Here

        } else
          break;
      }
      sw.close();

      Analyzer analyzer = new EnglishAnalyzer(stopwords);

      IndexWriterConfig conf = new IndexWriterConfig(Version.LATEST,
          analyzer);
      SimpleFSDirectory simpleFSDirectory = new SimpleFSDirectory(
          new File(LuceneIndexConstants.LUCENE_DATABASE));
View Full Code Here

 
  /** parse a syn file with bad syntax */
  @Test(expected=ParseException.class)
  public void testInvalidPositionsInput() throws Exception {
    String testFile = "testola => the test";
    SolrSynonymParser parser = new SolrSynonymParser(true, true, new EnglishAnalyzer(TEST_VERSION_CURRENT));
    parser.add(new StringReader(testFile));
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.en.EnglishAnalyzer

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.