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


Java Operation类代码示例

本文整理汇总了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();
}
 
开发者ID:apache,项目名称:opennlp-addons,代码行数:44,代码来源:JWNLLemmatizer.java

示例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);
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:15,代码来源:DefaultMorphologicalProcessor.java

示例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;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:8,代码来源:DefaultMorphologicalProcessor.java

示例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);
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:8,代码来源:DefaultMorphologicalProcessor.java

示例5: DefaultMorphologicalProcessor

import net.didion.jwnl.dictionary.morph.Operation; //导入依赖的package包/类
public DefaultMorphologicalProcessor(Operation[] operations) {
	this(operations, DEFAULT_CACHE_CAPACITY);
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:4,代码来源:DefaultMorphologicalProcessor.java


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