本文整理汇总了Java中net.didion.jwnl.dictionary.morph.Operation类的典型用法代码示例。如果您正苦于以下问题:Java Operation类的具体用法?Java Operation怎么用?Java Operation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于net.didion.jwnl.dictionary.morph包,在下文中一共展示了Operation类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JWNLLemmatizer
import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
/**
* Creates JWNL dictionary and morphological processor objects in
* JWNLemmatizer constructor. It also loads the JWNL configuration into the
* constructor.
*
* Constructor code based on Apache OpenNLP JWNLDictionary class.
*
* @param wnDirectory
* @throws IOException
* @throws JWNLException
*/
public JWNLLemmatizer(String wnDirectory) throws IOException, JWNLException {
PointerType.initialize();
Adjective.initialize();
VerbFrame.initialize();
Map<POS, String[][]> suffixMap = new HashMap<POS, String[][]>();
suffixMap.put(POS.NOUN, new String[][] { { "s", "" }, { "ses", "s" },
{ "xes", "x" }, { "zes", "z" }, { "ches", "ch" }, { "shes", "sh" },
{ "men", "man" }, { "ies", "y" } });
suffixMap.put(POS.VERB, new String[][] { { "s", "" }, { "ies", "y" },
{ "es", "e" }, { "es", "" }, { "ed", "e" }, { "ed", "" },
{ "ing", "e" }, { "ing", "" } });
suffixMap.put(POS.ADJECTIVE, new String[][] { { "er", "" }, { "est", "" },
{ "er", "e" }, { "est", "e" } });
DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
tokDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
new LookupIndexWordOperation(), new LookupExceptionsOperation() });
TokenizerOperation tokOp = new TokenizerOperation(new String[] { " ", "-" });
tokOp.addDelegate(TokenizerOperation.TOKEN_OPERATIONS,
new Operation[] { new LookupIndexWordOperation(),
new LookupExceptionsOperation(), tokDso });
DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
morphDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
new LookupIndexWordOperation(), new LookupExceptionsOperation() });
Operation[] operations = { new LookupExceptionsOperation(), morphDso, tokOp };
morphy = new DefaultMorphologicalProcessor(operations);
FileManager manager = new FileManagerImpl(wnDirectory,
PrincetonRandomAccessDictionaryFile.class);
FileDictionaryElementFactory factory = new PrincetonWN17FileDictionaryElementFactory();
FileBackedDictionary.install(manager, morphy, factory, true);
dict = net.didion.jwnl.dictionary.Dictionary.getInstance();
morphy = dict.getMorphologicalProcessor();
}
示例2: create
import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
public Object create(Map params) throws JWNLException {
ParamList operationParams = (ParamList) params.get(OPERATIONS);
if (operationParams == null) {
throw new JWNLException("DICTIONARY_EXCEPTION_026");
}
List operations = (List)operationParams.create();
Operation[] operationArray = (Operation[])operations.toArray(new Operation[operations.size()]);
Param param = (Param) params.get(CACHE_CAPACITY);
int capacity = (param == null) ?
DEFAULT_CACHE_CAPACITY : new Integer(param.getValue()).intValue();
return new DefaultMorphologicalProcessor(operationArray, capacity);
}
示例3: LookupInfo
import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
public LookupInfo(POS pos, String derivation, Operation[] operations) {
_pos = pos;
_derivation = derivation;
_operations = operations;
_baseForms = new BaseFormSet();
_currentOperation = -1;
}
示例4: executeNextOperation
import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
public boolean executeNextOperation() throws JWNLException {
if (!isNextOperationAvailable()) {
throw new JWNLRuntimeException("DICTIONARY_EXCEPTION_027");
}
Operation oper = _operations[++_currentOperation];
return oper.execute(_pos, _derivation, _baseForms);
}
示例5: DefaultMorphologicalProcessor
import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
public DefaultMorphologicalProcessor(Operation[] operations) {
this(operations, DEFAULT_CACHE_CAPACITY);
}