当前位置: 首页>>代码示例>>Java>>正文


Java StopFilter.makeStopSet方法代码示例

本文整理汇总了Java中org.apache.lucene.analysis.StopFilter.makeStopSet方法的典型用法代码示例。如果您正苦于以下问题:Java StopFilter.makeStopSet方法的具体用法?Java StopFilter.makeStopSet怎么用?Java StopFilter.makeStopSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.analysis.StopFilter的用法示例。


在下文中一共展示了StopFilter.makeStopSet方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TibetanAnalyzer

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/**
 * Creates a new {@link TibetanAnalyzer}
 * 
 * @param  segmentInWords  if the segmentation is on words instead of syllables
 * @param  lemmatize  if the analyzer should remove affixed particles, and normalize words in words mode
 * @param  filterChars  if the text should be converted to NFD (necessary for texts containing NFC strings)
 * @param  inputMethod  if the text should be converted from EWTS to Unicode
 * @param  stopFilename  a file name with a stop word list
 * @throws IOException  if the file containing stopwords can't be opened 
 */
public TibetanAnalyzer(boolean segmentInWords, boolean lemmatize, boolean filterChars, String inputMethod, String stopFilename) throws IOException {
	this.segmentInWords = segmentInWords;
	this.lemmatize = lemmatize;
	this.filterChars = filterChars;
	this.inputMethod = inputMethod;
	if (stopFilename != null) {
		if (stopFilename.isEmpty()) {
			InputStream stream = null;
	        stream = TibetanAnalyzer.class.getResourceAsStream("/bo-stopwords.txt");
	        if (stream == null) {      // we're not using the jar, there is no resource, assuming we're running the code
	        	this.tibStopSet = null;
	        } else {
	            this.tibStopSet = StopFilter.makeStopSet(getWordList(stream, "#"));
	        }
		} else {
			this.tibStopSet = StopFilter.makeStopSet(getWordList(new FileInputStream(stopFilename), "#"));
		}
	} else {
		this.tibStopSet = null;
	}
}
 
开发者ID:BuddhistDigitalResourceCenter,项目名称:lucene-bo,代码行数:32,代码来源:TibetanAnalyzer.java

示例2: testFillerToken

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
public void testFillerToken() throws IOException {
    ESTestCase.TestAnalysis analysis = AnalysisTestsHelper.createTestAnalysisFromClassPath(createTempDir(), RESOURCE);
    TokenFilterFactory tokenFilter = analysis.tokenFilter.get("shingle_filler");
    String source = "simon the sorcerer";
    String[] expected = new String[]{"simon FILLER", "simon FILLER sorcerer", "FILLER sorcerer"};
    Tokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setReader(new StringReader(source));
    TokenStream stream = new StopFilter(tokenizer, StopFilter.makeStopSet("the"));
    assertTokenStreamContents(tokenFilter.create(stream), expected);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:ShingleTokenFilterFactoryTests.java

示例3: stopwordFilterTest

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
@Test
public void stopwordFilterTest() throws IOException
{
	System.out.println("Testing TibetanAnalyzer.tibStopWords");
	String input = "ཧ་ཏུ་གི་ཀྱི་གིས་ཀྱིས་ཡིས་ཀྱང་སྟེ་ཏེ་མམ་རམ་སམ་ཏམ་ནོ་བོ་ཏོ་གིན་ཀྱིན་གྱིན་ཅིང་ཅིག་ཅེས་ཞེས་ཧ།";
	Reader reader = new StringReader(input);
	List<String> expected = Arrays.asList("ཧ", "ཧ");

	System.out.print(input + " => ");
	TokenStream syllables = tokenize(reader, new TibSyllableTokenizer());
	CharArraySet stopSet = StopFilter.makeStopSet(TibetanAnalyzer.getWordList(new FileInputStream("src/main/resources/bo-stopwords.txt"), "#"));
	StopFilter res = new StopFilter(syllables, stopSet);
	assertTokenStream(res, expected);
}
 
开发者ID:BuddhistDigitalResourceCenter,项目名称:lucene-bo,代码行数:15,代码来源:TibetanAnalyzerTest.java

示例4: GermanAnalyzer

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/**
 * Builds an analyzer with the given stop words.
 */
public GermanAnalyzer(String[] stopwords) {
  stopSet = StopFilter.makeStopSet(stopwords);
}
 
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:7,代码来源:GermanAnalyzer.java

示例5: setStemExclusionTable

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/**
 * Builds an exclusionlist from an array of Strings.
 */
public void setStemExclusionTable(String[] exclusionlist) {
  exclusionSet = StopFilter.makeStopSet(exclusionlist);
}
 
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:7,代码来源:GermanAnalyzer.java

示例6: AlfrescoStandardAnalyser

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/** Builds an analyzer with the given stop words. */
public AlfrescoStandardAnalyser(String[] stopWords)
{
    stopSet = StopFilter.makeStopSet(stopWords);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:6,代码来源:AlfrescoStandardAnalyser.java

示例7: SpellWritingAnalyzer

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/**
 * Builds an analyzer which writes to the given spelling dictionary, using the
 * given stop words.
 */
public SpellWritingAnalyzer(String[] stopWords, SpellWriter spellWriter)
{
  this(StopFilter.makeStopSet(stopWords), spellWriter);
}
 
开发者ID:CDLUC3,项目名称:dash-xtf,代码行数:9,代码来源:SpellWritingAnalyzer.java

示例8: CJKAnalyzer

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
/**
 * Builds an analyzer which removes words in {@link #STOP_WORDS}.
 */
public CJKAnalyzer() {
  stopTable = StopFilter.makeStopSet(STOP_WORDS);
}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:7,代码来源:CJKAnalyzer.java

示例9: StopAnalyzer2

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
public StopAnalyzer2(String[] stopWords) {
  this.stopWords = StopFilter.makeStopSet(stopWords);
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:4,代码来源:StopAnalyzer2.java

示例10: StopAnalyzer1

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
public StopAnalyzer1(String[] stopWords) {
  this.stopWords = StopFilter.makeStopSet(stopWords);
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:4,代码来源:StopAnalyzer1.java

示例11: StopAnalyzerFlawed

import org.apache.lucene.analysis.StopFilter; //导入方法依赖的package包/类
public StopAnalyzerFlawed(String[] stopWords) {
  this.stopWords = StopFilter.makeStopSet(stopWords);
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:4,代码来源:StopAnalyzerFlawed.java


注:本文中的org.apache.lucene.analysis.StopFilter.makeStopSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。