List of usage examples for org.apache.lucene.analysis.stempel StempelStemmer load
public static Trie load(InputStream stemmerTable) throws IOException
From source file:org.apache.solr.analysis.StempelPolishStemFilterFactory.java
License:Apache License
public void inform(ResourceLoader loader) { try {//from w ww.j av a 2 s . co m stemmer = StempelStemmer.load(loader.openResource(STEMTABLE)); } catch (IOException e) { throw new SolrException(ErrorCode.SERVER_ERROR, "Could not load stem table: " + STEMTABLE); } }
From source file:org.elasticsearch.index.analysis.pl.PolishStemTokenFilterFactory.java
License:Apache License
@Inject public PolishStemTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) { super(index, indexSettingsService.getSettings(), name, settings); Trie tire;//from w w w .j a v a 2 s . co m try { tire = StempelStemmer .load(PolishAnalyzer.class.getResourceAsStream(PolishAnalyzer.DEFAULT_STEMMER_FILE)); } catch (IOException ex) { throw new RuntimeException("Unable to load default stemming tables", ex); } stemmer = new StempelStemmer(tire); }
From source file:org.elasticsearch.indices.analysis.pl.PolishIndicesAnalysis.java
License:Apache License
@Inject public PolishIndicesAnalysis(Settings settings, IndicesAnalysisService indicesAnalysisService) { super(settings); indicesAnalysisService.analyzerProviderFactories().put("polish", new PreBuiltAnalyzerProviderFactory("polish", AnalyzerScope.INDICES, new PolishAnalyzer())); indicesAnalysisService.tokenFilterFactories().put("polish_stem", new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() { @Override// w ww . ja v a 2 s . com public String name() { return "polish_stem"; } @Override public TokenStream create(TokenStream tokenStream) { Trie tire; try { tire = StempelStemmer.load( PolishAnalyzer.class.getResourceAsStream(PolishAnalyzer.DEFAULT_STEMMER_FILE)); } catch (IOException ex) { throw new RuntimeException("Unable to load default stemming tables", ex); } return new StempelFilter(tokenStream, new StempelStemmer(tire)); } })); }