com.hankcs.hanlp.seg.NShort.NShortSegment Java Examples
The following examples show how to use
com.hankcs.hanlp.seg.NShort.NShortSegment.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HanLPTokenizerFactory.java From elasticsearch-analysis-hanlp with Apache License 2.0 | 5 votes |
public static HanLPTokenizerFactory createNShort(IndexSettings indexSettings, Environment environment, String name, Settings settings) { return new HanLPTokenizerFactory(indexSettings, environment, name, settings) { @Override public Tokenizer create() { Segment seg = new NShortSegment().enableCustomDictionary(false) .enablePlaceRecognize(true) .enableOrganizationRecognize(true); return new HanLPTokenizer(seg, defaultStopWordDictionary, enablePorterStemming); } }; }
Example #2
Source File: HanLPNShortAnalyzer.java From elasticsearch-analysis-hanlp with Apache License 2.0 | 4 votes |
@Override protected Analyzer.TokenStreamComponents createComponents(String fieldName) { return new Analyzer.TokenStreamComponents(TokenizerBuilder.tokenizer( AccessController.doPrivileged((PrivilegedAction<Segment>)() -> new NShortSegment().enableCustomDictionary( false).enablePlaceRecognize(true).enableOrganizationRecognize(true)), configuration)); }