• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PreBuiltAnalyzerProviderFactory类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory的典型用法代码示例。如果您正苦于以下问题:Java PreBuiltAnalyzerProviderFactory类的具体用法?Java PreBuiltAnalyzerProviderFactory怎么用?Java PreBuiltAnalyzerProviderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

PreBuiltAnalyzerProviderFactory类属于org.elasticsearch.index.analysis包,在下文中一共展示了PreBuiltAnalyzerProviderFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: AnnotationIndicesAnalysis

点赞 3

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Inject
public AnnotationIndicesAnalysis(Settings settings,
		IndicesAnalysisService indicesAnalysisService) {
	super(settings);
	indicesAnalysisService.analyzerProviderFactories().put(
			"default",
			new PreBuiltAnalyzerProviderFactory("default",
					AnalyzerScope.INDICES, new AnnotationAnalyzer(
							Lucene.ANALYZER_VERSION)));

	indicesAnalysisService.tokenFilterFactories().put("annotation_filter",
			new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() {
				@Override
				public String name() {
					return "annotation_filter";
				}

				@Override
				public TokenStream create(TokenStream tokenStream) {
					return new InlineAnnotationFilter(tokenStream);
				}
			}));
}
 

开发者ID:samekmichal,
项目名称:elasticsearch-analysis-annotation,
代码行数:24,
代码来源:AnnotationIndicesAnalysis.java

示例2: setupMapperParser

点赞 3

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Before
public void setupMapperParser() {
    Index index = new Index("test");

    Map<String, AnalyzerProviderFactory> analyzerFactoryFactories = Maps.newHashMap();
    analyzerFactoryFactories.put("keyword", new PreBuiltAnalyzerProviderFactory("keyword", AnalyzerScope.INDEX, new KeywordAnalyzer()));
    AnalysisService analysisService = new AnalysisService(index, ImmutableSettings.Builder.EMPTY_SETTINGS, null, analyzerFactoryFactories, null, null, null);

    mapperParser = new DocumentMapperParser(index, analysisService, new PostingsFormatService(index),
            new SimilarityLookupService(index, ImmutableSettings.Builder.EMPTY_SETTINGS));
    Settings settings = settingsBuilder()
            .put("opennlp.models.name.file", "src/test/resources/models/en-ner-person.bin")
            .put("opennlp.models.date.file", "src/test/resources/models/en-ner-date.bin")
            .put("opennlp.models.location.file", "src/test/resources/models/en-ner-location.bin")
            .build();

    LogConfigurator.configure(settings);

    OpenNlpService openNlpService = new OpenNlpService(settings);
    openNlpService.start();
    mapperParser.putTypeParser(OpenNlpMapper.CONTENT_TYPE, new OpenNlpMapper.TypeParser(analysisService, openNlpService));
}
 

开发者ID:spinscale,
项目名称:elasticsearch-opennlp-plugin,
代码行数:23,
代码来源:OpenNlpMappingTest.java

示例3: LTPIndicesAnalysis

点赞 2

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Inject
public LTPIndicesAnalysis(final Settings settings, IndicesAnalysisService indicesAnalysisService, Environment env) {
    super(settings);

    logger.info("LTPIndicesAnalysis Initialize......");

    // 插件私有配置初始化
    Configuration.init(settings,env);

    // 注册ltp type analyzer
    indicesAnalysisService.analyzerProviderFactories().put("ltp",
            new PreBuiltAnalyzerProviderFactory("ltp", AnalyzerScope.GLOBAL,
                    new LTPAnalyzer()));

    // 注册ltp type tokenizer
    indicesAnalysisService.tokenizerFactories().put("ltp",
            new PreBuiltTokenizerFactoryFactory(new TokenizerFactory() {

                @Override
                public String name() {
                    return "ltp";
                }

                @Override
                public Tokenizer create() {
                    LTPTokenizer token = null;
                    try {
                        token = new LTPTokenizer(Configuration.getFilters());
                    } catch (JSONException | IOException | UnirestException e) {

                        e.printStackTrace();
                    }
                    return token;
                }

            }));

}
 

开发者ID:lonly197,
项目名称:elasticsearch-analysis-ltp,
代码行数:39,
代码来源:LTPIndicesAnalysis.java

示例4: BosonNLPIndicesAnalysis

点赞 2

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Inject    
public BosonNLPIndicesAnalysis(final Settings settings, IndicesAnalysisService indicesAnalysisService) {
    super(settings);
    // Get all the arguments from settings
    this.TAG_URL = settings.get("API_URL", "").toString();
    this.BOSONNLP_API_TOKEN = settings.get("API_TOKEN", "").toString();
    this.spaceMode = Integer.parseInt(settings.get("space_mode", "0"));
    this.oovLevel = Integer.parseInt(settings.get("oov_level", "3"));
    this.t2s = Integer.parseInt(settings.get("t2s", "0"));
    this.specialCharConv = Integer.parseInt(settings.get("spechial_char_conv", "0"));
    
    // Register the bosonnlp type analyzer
    indicesAnalysisService.analyzerProviderFactories().put("bosonnlp", 
            new PreBuiltAnalyzerProviderFactory("bosonnlp", AnalyzerScope.GLOBAL, 
                    new BosonNLPAnalyzer(TAG_URL, BOSONNLP_API_TOKEN, spaceMode, oovLevel, t2s, specialCharConv)));
    
    // Register the bosonnlp type tokenizer
    indicesAnalysisService.tokenizerFactories().put("bosonnlp", 
            new PreBuiltTokenizerFactoryFactory(new TokenizerFactory(){

                @Override
                public String name() {
                    return "bosonnlp";
                }

                @Override
                public Tokenizer create() {
                    BosonNLPTokenizer BToken = null;
                    try {
                        BToken = new BosonNLPTokenizer(TAG_URL, BOSONNLP_API_TOKEN, spaceMode, oovLevel, t2s, specialCharConv);
                    } catch (JSONException | IOException | UnirestException e) {

                        e.printStackTrace();
                    }
                    return BToken;
                }
    			
            }));
		
}
 

开发者ID:bosondata,
项目名称:elasticsearch-analysis-bosonnlp,
代码行数:41,
代码来源:BosonNLPIndicesAnalysis.java

示例5: IndicesAnalysis

点赞 2

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Inject
public IndicesAnalysis(Settings settings, IndicesAnalysisService indicesAnalysisService) {
    super(settings);

    indicesAnalysisService.analyzerProviderFactories().put("stringlength",
            new PreBuiltAnalyzerProviderFactory("stringlength", AnalyzerScope.INDICES,
                    new StringLengthAnalyzer()));
}
 

开发者ID:SGrondin,
项目名称:es-string-length-analyzer,
代码行数:9,
代码来源:IndicesAnalysis.java

示例6: UkrainianIndicesAnalysis

点赞 2

import org.elasticsearch.index.analysis.PreBuiltAnalyzerProviderFactory; //导入依赖的package包/类
@Inject
public UkrainianIndicesAnalysis(Settings settings, IndicesAnalysisService indicesAnalysisService) {
    super(settings);

    final String ANALYZER_KEY = "ukrainian";
    final String FILTER_KEY = "ukrainian_lemmatizer";

    indicesAnalysisService.analyzerProviderFactories().put(
            ANALYZER_KEY,
            new PreBuiltAnalyzerProviderFactory(
                    ANALYZER_KEY,
                    AnalyzerScope.INDICES,
                    new UkrainianAnalyzer(Lucene.VERSION)));

    indicesAnalysisService.tokenFilterFactories().put(
            FILTER_KEY,
            new PreBuiltTokenFilterFactoryFactory(new TokenFilterFactory() {
                @Override
                public String name() {
                    return FILTER_KEY;
                }

                @Override
                public TokenStream create(TokenStream tokenStream) {
                    return new MorfologikFilter(tokenStream, UkrainianLemmatizerResources.getDictionary());
                }
            }));
}
 

开发者ID:mrgambal,
项目名称:elasticsearch-ukrainian-lemmatizer,
代码行数:29,
代码来源:UkrainianIndicesAnalysis.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)