本文整理了Java中org.apache.lucene.analysis.synonym.WordnetSynonymParser.add()
方法的一些代码示例,展示了WordnetSynonymParser.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WordnetSynonymParser.add()
方法的具体详情如下:
包路径:org.apache.lucene.analysis.synonym.WordnetSynonymParser
类名称:WordnetSynonymParser
方法名:add
暂无
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void add(CharsRef input, CharsRef output, boolean includeOrig) {
// This condition follows up on the overridden analyze method. In case lenient was set to true and there was an
// exception during super.analyze we return a zero-length CharsRef for that word which caused an exception. When
// the synonym mappings for the words are added using the add method we skip the ones that were left empty by
// analyze i.e., in the case when lenient is set we only add those combinations which are non-zero-length. The
// else would happen only in the case when the input or output is empty and lenient is set, in which case we
// quietly ignore it. For more details on the control-flow see SolrSynonymParser::addInternal.
if (lenient == false || (input.length > 0 && output.length > 0)) {
super.add(input, output, includeOrig);
}
}
代码示例来源:origin: org.apache.lucene/lucene-analyzers-common
private void addInternal(CharsRef synset[], int size) {
if (size <= 1) {
return; // nothing to do
}
if (expand) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
add(synset[i], synset[j], false);
}
}
} else {
for (int i = 0; i < size; i++) {
add(synset[i], synset[0], false);
}
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public void add(CharsRef input, CharsRef output, boolean includeOrig) {
// This condition follows up on the overridden analyze method. In case lenient was set to true and there was an
// exception during super.analyze we return a zero-length CharsRef for that word which caused an exception. When
// the synonym mappings for the words are added using the add method we skip the ones that were left empty by
// analyze i.e., in the case when lenient is set we only add those combinations which are non-zero-length. The
// else would happen only in the case when the input or output is empty and lenient is set, in which case we
// quietly ignore it. For more details on the control-flow see SolrSynonymParser::addInternal.
if (lenient == false || (input.length > 0 && output.length > 0)) {
super.add(input, output, includeOrig);
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public void add(CharsRef input, CharsRef output, boolean includeOrig) {
// This condition follows up on the overridden analyze method. In case lenient was set to true and there was an
// exception during super.analyze we return a zero-length CharsRef for that word which caused an exception. When
// the synonym mappings for the words are added using the add method we skip the ones that were left empty by
// analyze i.e., in the case when lenient is set we only add those combinations which are non-zero-length. The
// else would happen only in the case when the input or output is empty and lenient is set, in which case we
// quietly ignore it. For more details on the control-flow see SolrSynonymParser::addInternal.
if (lenient == false || (input.length > 0 && output.length > 0)) {
super.add(input, output, includeOrig);
}
}
代码示例来源:origin: org.apache.lucene/lucene-analyzers
private void addInternal(CharsRef synset[], int size) throws IOException {
if (size <= 1) {
return; // nothing to do
}
if (expand) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
add(synset[i], synset[j], false);
}
}
} else {
for (int i = 0; i < size; i++) {
add(synset[i], synset[0], false);
}
}
}
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
private void addInternal(CharsRef synset[], int size) {
if (size <= 1) {
return; // nothing to do
}
if (expand) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
add(synset[i], synset[j], false);
}
}
} else {
for (int i = 0; i < size; i++) {
add(synset[i], synset[0], false);
}
}
}
}
代码示例来源:origin: stackoverflow.com
Analyzer analyzer = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer source = new FooTokenizer(reader);
TokenStream filter = new FooFilter(source);
//etc...
WordnetSynonymParser parser = new WordnetSynonymParser(true, false, analyzer);
parser.add(wordnetReader);
filter = new SynonymFilter(filter, parser.build(), true);
return new TokenStreamComponents(source, filter);
}
};
内容来源于网络,如有侵权,请联系作者删除!