private static List<String> getStopList(String path) { List<String> stopwords = new ArrayList<String>(); try { //Get the stopwords from Apache Thai Analyzer Jar InputStream in = ThaiAnalyzer.class.getResourceAsStream(path); BufferedReader input = new BufferedReader( new InputStreamReader(in)); for(String line = input.readLine(); line != null; line = input.readLine()) { if (line.startsWith("#")) continue; stopwords.add(line); } input.close(); return stopwords; } catch(IOException e) { e.printStackTrace(); System.exit(1); return null; } }
public ThaiAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new ThaiAnalyzer( Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, ThaiAnalyzer.getDefaultStopSet())); analyzer.setVersion(version); }
@Override public ThaiAnalyzer get() { return this.analyzer; }
@Inject public ThaiAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) { super(index, indexSettingsService.getSettings(), name, settings); analyzer = new ThaiAnalyzer(Analysis.parseStopWords(env, settings, ThaiAnalyzer.getDefaultStopSet())); analyzer.setVersion(version); }