• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MaltChainedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: copyPartialDependencyStructure

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public void copyPartialDependencyStructure(DependencyStructure sourceGraph, DependencyStructure targetGraph) throws MaltChainedException {
	SymbolTable partHead = cachedSource.getSymbolTables().getSymbolTable("PARTHEAD");
	SymbolTable partDeprel = cachedSource.getSymbolTables().getSymbolTable("PARTDEPREL");
	if (partHead == null || partDeprel == null) {
		return;
	}
	SymbolTable deprel = cachedTarget.getSymbolTables().getSymbolTable("DEPREL");
	for (int index : sourceGraph.getTokenIndices()) {
		DependencyNode snode = sourceGraph.getTokenNode(index);
		DependencyNode tnode = targetGraph.getTokenNode(index);
		if (snode != null && tnode != null) {
			int spartheadindex = Integer.parseInt(snode.getLabelSymbol(partHead));
			String spartdeprel = snode.getLabelSymbol(partDeprel);
			if (spartheadindex > 0) {
				Edge tedge = targetGraph.addDependencyEdge(spartheadindex, snode.getIndex());
				tedge.addLabel(deprel, spartdeprel);
			}
		}
	}
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:21,代码来源:CopyChartItem.java


示例2: LWDeterministicParser

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public LWDeterministicParser(LWSingleMalt lwSingleMalt, SymbolTableHandler symbolTableHandler, FeatureModel _featureModel) throws MaltChainedException {
	this.manager = lwSingleMalt;
	this.registry = new ParserRegistry();
	this.registry.setSymbolTableHandler(symbolTableHandler);
	this.registry.setDataFormatInstance(manager.getDataFormatInstance());
	this.registry.setAbstractParserFeatureFactory(manager.getParserFactory());
	this.registry.setAlgorithm(this);
	this.transitionSystem = manager.getParserFactory().makeTransitionSystem();
	this.transitionSystem.initTableHandlers(lwSingleMalt.getDecisionSettings(), symbolTableHandler);
	
	this.tableHandlers = transitionSystem.getTableHandlers();
	this.kBestSize = lwSingleMalt.getkBestSize();
	this.decisionTables = new ArrayList<TableContainer>();
	this.actionTables = new ArrayList<TableContainer>();
	initDecisionSettings(lwSingleMalt.getDecisionSettings(), lwSingleMalt.getClassitem_separator());
	this.transitionSystem.initTransitionSystem(this);
	this.config = manager.getParserFactory().makeParserConfiguration();
	this.featureModel = _featureModel;
	this.currentAction = new ComplexDecisionAction(this);
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:21,代码来源:LWDeterministicParser.java


示例3: moveDependencyEdge

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent) throws MaltChainedException {
	if (dependent == null || !dependent.hasHead() || newHead.getBelongsToGraph() != this || dependent.getBelongsToGraph() != this) {
		return null;
	}
	Edge headEdge = dependent.getHeadEdge();

	LabelSet labels = null;
	if (headEdge.isLabeled()) { 
		labels = checkOutNewLabelSet();
		for (SymbolTable table : headEdge.getLabelTypes()) {
			labels.put(table, headEdge.getLabelCode(table));
		}
	}
	headEdge.clear();
	headEdge.setBelongsToGraph(this);
	headEdge.setEdge((Node)newHead, (Node)dependent, Edge.DEPENDENCY_EDGE);
	if (labels != null) {
		headEdge.addLabel(labels);
		labels.clear();
		checkInLabelSet(labels);
	}
	return headEdge;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:24,代码来源:MappablePhraseStructureGraph.java


示例4: initialize

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public void initialize(Object[] arguments) throws MaltChainedException {
	if (arguments.length != 2) {
		throw new SyntaxGraphException("Could not initialize OutputColumnFeature: number of arguments are not correct. ");
	}
	if (!(arguments[0] instanceof String)) {
		throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the first argument is not a string. ");
	}
	if (!(arguments[1] instanceof AddressFunction)) {
		throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the second argument is not an address function. ");
	}
	ColumnDescription column = dataFormatInstance.getColumnDescriptionByName((String)arguments[0]);
	if (column == null) {
		throw new SyntaxGraphException("Could not initialize OutputColumnFeature: the output column type '"+(String)arguments[0]+"' could not be found in the data format specification. ' ");
	}
	setColumn(column);
	setSymbolTable(tableHandler.getSymbolTable(column.getName()));
	setAddressFunction((AddressFunction)arguments[1]);
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:19,代码来源:OutputColumnFeature.java


示例5: addSymbol

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public int addSymbol(String symbol) throws MaltChainedException {
	if (nullValues == null || !nullValues.isNullValue(symbol)) {
		if (symbol == null || symbol.length() == 0) {
			throw new SymbolException("Symbol table error: empty string cannot be added to the symbol table");
		}

		if (this.type == SymbolTable.REAL) {
			addSymbolValue(symbol);
		}
		if (!symbolCodeMap.containsKey(symbol)) {
			int code = valueCounter;
			symbolCodeMap.put(symbol, code);
			codeSymbolMap.put(code, symbol);
			valueCounter++;
			return code;
		} else {
			return symbolCodeMap.get(symbol);
		}
	} else {
		return nullValues.symbolToCode(symbol);
	}
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:23,代码来源:HashSymbolTable.java


示例6: loadFeatureModelManager

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
private FeatureModelManager loadFeatureModelManager(int optionContainer, McoModel mcoModel) throws MaltChainedException {
	final FeatureEngine system = new FeatureEngine();
	system.load("/appdata/features/ParserFeatureSystem.xml");
	system.load(PluginLoader.instance());
	FeatureModelManager featureModelManager = new FeatureModelManager(system);
	String featureModelFileName = OptionManager.instance().getOptionValue(optionContainer, "guide", "features").toString().trim();
	try {
		if (featureModelFileName.endsWith(".par")) {
			String markingStrategy = OptionManager.instance().getOptionValue(optionContainer, "pproj", "marking_strategy").toString().trim();
			String coveredRoot = OptionManager.instance().getOptionValue(optionContainer, "pproj", "covered_root").toString().trim();
			featureModelManager.loadParSpecification(mcoModel.getMcoEntryURL(featureModelFileName), markingStrategy, coveredRoot);
		} else {
			featureModelManager.loadSpecification(mcoModel.getMcoEntryURL(featureModelFileName));
		}
	} catch(IOException e) {
		throw new MaltChainedException("Couldn't read file "+featureModelFileName+" from mco-file ", e);
	}
	return featureModelManager;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:20,代码来源:ConcurrentMaltParserModel.java


示例7: updateActionContainers

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
protected GuideUserAction updateActionContainers(int transition, LabelSet arcLabels) throws MaltChainedException {	
	transActionContainer.setAction(transition);

	if (arcLabels == null) {
		for (int i = 0; i < arcLabelActionContainers.length; i++) {
			arcLabelActionContainers[i].setAction(-1);	
		}
	} else {
		for (int i = 0; i < arcLabelActionContainers.length; i++) {
			arcLabelActionContainers[i].setAction(arcLabels.get(arcLabelActionContainers[i].getTable()).shortValue());
		}		
	}
	GuideUserAction oracleAction = history.getEmptyGuideUserAction();
	oracleAction.addAction(actionContainers);
	return oracleAction;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:17,代码来源:Oracle.java


示例8: initialize

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public void initialize(Object[] arguments) throws MaltChainedException {
	if (arguments.length != 3) {
		throw new FeatureException("Could not initialize InputArcFeature: number of arguments are not correct. ");
	}
	// Checks that the two arguments are address functions

	if (!(arguments[0] instanceof String)) {
		throw new FeatureException("Could not initialize InputArcFeature: the first argument is not a string. ");
	}
	if (!(arguments[1] instanceof AddressFunction)) {
		throw new SyntaxGraphException("Could not initialize InputArcFeature: the second argument is not an address function. ");
	}
	if (!(arguments[2] instanceof AddressFunction)) {
		throw new SyntaxGraphException("Could not initialize InputArcFeature: the third argument is not an address function. ");
	}
	setAddressFunction1((AddressFunction)arguments[1]);
	setAddressFunction2((AddressFunction)arguments[2]);
	
	setColumn(dataFormatInstance.getColumnDescriptionByName((String)arguments[0]));
	setSymbolTable(tableHandler.addSymbolTable("ARC_"+column.getName(),ColumnDescription.INPUT, ColumnDescription.STRING, "one"));
	table.addSymbol("LEFT");
	table.addSymbol("RIGHT");
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:24,代码来源:InputArcFeature.java


示例9: getRightmostProperDescendant

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
@Override
public ComparableNode getRightmostProperDescendant() throws MaltChainedException {
	ComparableNode candidate = null;
	List<DependencyNode> dependents = graph.getListOfDependents(index);
	for (int i = 0; i < dependents.size(); i++) {
		final DependencyNode dep = dependents.get(i);
		if (candidate == null || dep.getIndex() > candidate.getIndex()) {
			candidate = dep;
		}
		final ComparableNode tmp = dep.getRightmostProperDescendant();
		if (tmp == null) {
			continue;
		}
		if (candidate == null || tmp.getIndex() > candidate.getIndex()) {
			candidate = tmp;
		}
	}
	return candidate;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:20,代码来源:LWNode.java


示例10: deprojectivizeWithHeadAndPath

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
private boolean deprojectivizeWithHeadAndPath(DependencyStructure pdg, DependencyNode node, boolean[] nodeLifted, boolean[] nodePath, String[] synacticHeadDeprel, SymbolTable deprelSymbolTable) throws MaltChainedException {
	boolean success = true, childSuccess = false;
	int i, childAttempts = 2;
	DependencyNode possibleSyntacticHead;
	if (node.hasHead() && node.getHeadEdge().isLabeled() && nodeLifted[node.getIndex()] && nodePath[node.getIndex()]) {
		possibleSyntacticHead = breadthFirstSearchSortedByDistanceForHeadAndPath(pdg, node.getHead(), node, synacticHeadDeprel[node.getIndex()], nodePath, deprelSymbolTable);
		if (possibleSyntacticHead != null) {
			pdg.moveDependencyEdge(possibleSyntacticHead.getIndex(), node.getIndex());
			nodeLifted[node.getIndex()] = false;
		} else {
			success = false;
		}
	}
	if (node.hasHead() && node.getHeadEdge().isLabeled() && nodeLifted[node.getIndex()]) {
		possibleSyntacticHead = breadthFirstSearchSortedByDistanceForHeadAndPath(pdg, node.getHead(), node, synacticHeadDeprel[node.getIndex()], nodePath, deprelSymbolTable);
		if (possibleSyntacticHead != null) {
			pdg.moveDependencyEdge(possibleSyntacticHead.getIndex(), node.getIndex());
			nodeLifted[node.getIndex()] = false;
		} else {
			success = false;
		}
	}
	while (!childSuccess && childAttempts > 0) {
		childSuccess = true;
		List<DependencyNode> children = node.getListOfDependents();
		for (i = 0; i < children.size(); i++) {
			if (!deprojectivizeWithHeadAndPath(pdg, children.get(i), nodeLifted, nodePath, synacticHeadDeprel, deprelSymbolTable)) {
				childSuccess = false;
			}
		}
		childAttempts--;
	}
	return childSuccess && success;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:35,代码来源:LWDeprojectivizer.java


示例11: addSecondaryEdge

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public Edge addSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException {
	if (source == null || target == null || source.getBelongsToGraph() != this || target.getBelongsToGraph() != this) {
		throw new SyntaxGraphException("Head or dependent node is missing.");
	} else if (!target.isRoot()) {
		Edge e = edgePool.checkOut();
		e.setBelongsToGraph(this);
		e.setEdge((Node)source, (Node)target, Edge.SECONDARY_EDGE);
		graphEdges.add(e);
		return e;
	}
	return null;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:13,代码来源:MappablePhraseStructureGraph.java


示例12: checkInAll

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public synchronized void checkInAll() throws MaltChainedException {
	for (T t : inuse) {
		resetObject(t);
		if (available.size() < keepThreshold) {
			available.add(t);
		}
	}
	inuse.clear();
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:10,代码来源:ObjectPoolSet.java


示例13: setUsage

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
/**
 * Sets the usage of the option.
 * 
 * @param usage	the usage of the option.
 * @throws OptionException
 */
public void setUsage(int usage) throws MaltChainedException {
	if (usage >= 0 && usage <= 4) {
		this.usage = usage;
	} else {
		throw new OptionException("Illegal use of the usage attibute value: "+usage+" for the '"+getName()+"' option. ");
	}
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:14,代码来源:Option.java


示例14: getCode

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public int getCode(String symbol) throws MaltChainedException {
	if (cachedSymbol == null || !cachedSymbol.equals(symbol)) {
		clearCache();
		cachedSymbol.append(symbol);
		cachedCode = table.getSymbolStringToCode(symbol);
		split();
	}
	return cachedCode;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:10,代码来源:CombinedTableContainer.java


示例15: writeSentence

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException {
	if (syntaxGraph == null || dataFormatInstance == null || !(syntaxGraph instanceof PhraseStructure) || !syntaxGraph.hasTokens()) {
		return;
	}
	PhraseStructure phraseStructure = (PhraseStructure)syntaxGraph;
	sentenceCount++;
	try {
		writer.write("#BOS ");
		if (phraseStructure.getSentenceID() != 0) {
			writer.write(Integer.toString(phraseStructure.getSentenceID()));
		} else {
			writer.write(Integer.toString(sentenceCount));
		}
		writer.write('\n');

		if (phraseStructure.hasNonTerminals()) {
			calculateIndices(phraseStructure);
			writeTerminals(phraseStructure);
			writeNonTerminals(phraseStructure);
		} else {
			writeTerminals(phraseStructure);
		}
		writer.write("#EOS ");
		if (phraseStructure.getSentenceID() != 0) {
			writer.write(Integer.toString(phraseStructure.getSentenceID()));
		} else {
			writer.write(Integer.toString(sentenceCount));
		}
		writer.write('\n');
	} catch (IOException e) {
		throw new DataFormatException("Could not write to the output file. ", e);
	}
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:34,代码来源:NegraWriter.java


示例16: TrieSymbolTable

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public TrieSymbolTable(String _name, Trie _trie, int _category, String nullValueStrategy) throws MaltChainedException { 
	this.name = _name;
	this.trie = _trie;
	this.category = _category;
	codeTable = new TreeMap<Integer, TrieNode>();
	if (this.category != SymbolTable.OUTPUT) {
		nullValues = new OutputNullValues(nullValueStrategy, this);
	} else {
		nullValues = new InputNullValues(nullValueStrategy, this);
	}
	valueCounter = nullValues.getNextCode();
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:13,代码来源:TrieSymbolTable.java


示例17: ParseSymbolTable

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public ParseSymbolTable(String name, SymbolTableHandler parentSymbolTableHandler) throws MaltChainedException {
	this.name = name;
	this.type = SymbolTable.STRING;
	this.parentSymbolTable = parentSymbolTableHandler.addSymbolTable(name);
	this.symbolCodeMap = new HashMap<String, Integer>();
	this.codeSymbolMap = new HashMap<Integer, String>();
	this.symbolValueMap = new HashMap<String, Double>();
	this.valueCounter = -1;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:10,代码来源:ParseSymbolTable.java


示例18: update

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
public void update() throws MaltChainedException {
	// Retrieve the address value 
	final AddressValue arg1 = addressFunction1.getAddressValue();
	final AddressValue arg2 = addressFunction2.getAddressValue();
	if (arg1.getAddress() != null && arg1.getAddressClass() == org.maltparser.core.syntaxgraph.node.DependencyNode.class &&
	    arg2.getAddress() != null && arg2.getAddressClass() == org.maltparser.core.syntaxgraph.node.DependencyNode.class) {
	    DependencyNode node1 = (DependencyNode)arg1.getAddress();
	    DependencyNode node2 = (DependencyNode)arg2.getAddress();
	    try {
	    SymbolTable symbolTable = tableHandler.getSymbolTable(column.getName());
		int head1 = Integer.parseInt(node1.getLabelSymbol(symbolTable));
		int head2 = Integer.parseInt(node2.getLabelSymbol(symbolTable));
		if (!node1.isRoot() && head1 == node2.getIndex()) {
		    featureValue.setIndexCode(table.getSymbolStringToCode("LEFT"));
		    featureValue.setSymbol("LEFT");
		    featureValue.setNullValue(false);
		} else if (!node2.isRoot() && head2 == node1.getIndex()) {
		    featureValue.setIndexCode(table.getSymbolStringToCode("RIGHT"));
		    featureValue.setSymbol("RIGHT");
		    featureValue.setNullValue(false);			
		} else {
		    featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
		    featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
		    featureValue.setNullValue(true);
		}
	    } catch (NumberFormatException e) {
	    	throw new FeatureException("The index of the feature must be an integer value. ", e);
	    }
	} else {
	    featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
	    featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
	    featureValue.setNullValue(true);
	}
	featureValue.setValue(1);
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:36,代码来源:InputArcFeature.java


示例19: attachCoveredRoots

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
private boolean attachCoveredRoots(DependencyStructure pdg, DependencyNode deepest) throws MaltChainedException {
	int i;
	boolean foundCoveredRoot = false;
	DependencyNode coveredRootHead;
	for (i = Math.min(deepest.getIndex(), deepest.getHead().getIndex()) + 1; i < Math.max(deepest.getIndex(), deepest.getHead()
			.getIndex()); i++) {
		int leftMostIndex = pdg.getDependencyNode(i).getLeftmostProperDescendantIndex();
		if (leftMostIndex == -1) {
			leftMostIndex = i;
		}
		int rightMostIndex = pdg.getDependencyNode(i).getRightmostProperDescendantIndex();
		if (rightMostIndex == -1) {
			rightMostIndex = i;
		}
		if (!nodeLifted.get(i) && pdg.getDependencyNode(i).getHead().isRoot() && !deepest.getHead().isRoot()
				&& Math.min(deepest.getIndex(), deepest.getHead().getIndex()) < leftMostIndex
				&& rightMostIndex < Math.max(deepest.getIndex(), deepest.getHead().getIndex())) {
			if (rootAttachment == CoveredRootAttachment.LEFT) {
				if (deepest.getHead().getIndex() < deepest.getIndex()) {
					coveredRootHead = deepest.getHead();
				} else {
					coveredRootHead = deepest;
				}
			} else if (rootAttachment == CoveredRootAttachment.RIGHT) {
				if (deepest.getIndex() < deepest.getHead().getIndex()) {
					coveredRootHead = deepest.getHead();
				} else {
					coveredRootHead = deepest;
				}
			} else {
				coveredRootHead = deepest.getHead();
			}
			pdg.moveDependencyEdge(coveredRootHead.getIndex(), pdg.getDependencyNode(i).getIndex());
			setCoveredRoot(pdg.getDependencyNode(i));
			foundCoveredRoot = true;
		}
	}
	return foundCoveredRoot;
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:40,代码来源:PseudoProjectivity.java


示例20: initialize

import org.maltparser.core.exception.MaltChainedException; //导入依赖的package包/类
private void initialize() throws MaltChainedException {
	if (OptionManager.instance().getOptionDescriptions().getOptionGroupNameSet().size() > 0) {
		return; // OptionManager is already initialized
	}
	OptionManager.instance().loadOptionDescriptionFile();
	OptionManager.instance().generateMaps();
}
 
开发者ID:jhamalt,项目名称:maltparser,代码行数:8,代码来源:MaltParserService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseDatatype类代码示例发布时间:2022-05-22
下一篇:
Java MockHttpResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap