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


Java LogicalConstant.getBaseName方法代码示例

本文整理汇总了Java中edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant.getBaseName方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalConstant.getBaseName方法的具体用法?Java LogicalConstant.getBaseName怎么用?Java LogicalConstant.getBaseName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant的用法示例。


在下文中一共展示了LogicalConstant.getBaseName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lemmatizeConstant

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Extract the "lemma" of a constant.
 */
@Deprecated
public static String lemmatizeConstant(LogicalConstant constant) {
	if (isAmrRelation(constant)) {
		return null;
	}

	final String lemma;
	final Matcher matcher = FRAME_PREDICATE_REGEX
			.matcher(constant.getBaseName());
	if (matcher.matches()) {
		lemma = matcher.group("pred");
	} else {
		lemma = constant.getBaseName();
	}
	return lemma;
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:20,代码来源:AMRServices.java

示例2: LogicalExpressionCoordinationServices

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public LogicalExpressionCoordinationServices(
		LogicalConstant baseConjunctionConstant,
		LogicalConstant baseDisjunctionConstant,
		ICategoryServices<LogicalExpression> categoryServices) {
	this.baseConjunctionConstant = baseConjunctionConstant;
	this.baseDisjunctionConstant = baseDisjunctionConstant;
	this.categoryServices = categoryServices;
	this.baseConjunctionName = baseConjunctionConstant.getBaseName();
	this.baseDisjunctionName = baseDisjunctionConstant.getBaseName();
}
 
开发者ID:clic-lab,项目名称:spf,代码行数:11,代码来源:LogicalExpressionCoordinationServices.java

示例3: makeRelationActive

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Given a passive relation, returns its active form. Otherwise, returns
 * null.
 *
 * @param underspecified
 *            The output should be underspecified or not.
 */
public static LogicalExpression makeRelationActive(LogicalConstant constant,
		boolean underspecified) {
	if (isAmrRelation(constant)) {
		String baseName;
		boolean overload;
		if (constant instanceof OverloadedLogicalConstant) {
			baseName = ((OverloadedLogicalConstant) constant)
					.getWrappedConstant().getBaseName();
			overload = true;
		} else {
			baseName = constant.getBaseName();
			overload = false;
		}

		if (baseName.endsWith(INVERSE_RELATION_SUFFIX)) {
			final LogicalConstant activeConstant = underspecified
					? (LogicalConstant) underspecify(LogicalConstant.create(
							baseName.substring(0, baseName.length()
									- INVERSE_RELATION_SUFFIX.length()),
							constant.getType(), true))
					: LogicalConstant.create(
							baseName.substring(0, baseName.length()
									- INVERSE_RELATION_SUFFIX.length()),
							constant.getType(), true);
			if (overload) {
				return ((OverloadedLogicalConstant) constant)
						.cloneWrapper(activeConstant);
			} else {
				return activeConstant;
			}
		}
	}
	return null;
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:42,代码来源:AMRServices.java

示例4: makeRelationPassive

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Convert a binary relation to its passive version, e.g., boo:<e,<e,t>> ->
 * boo-of:<e,<e,t>>.
 */
public static LogicalConstant makeRelationPassive(LogicalConstant constant,
		boolean underspecified) {
	if (isAmrRelation(constant)) {
		String baseName;
		boolean overload;
		if (constant instanceof OverloadedLogicalConstant) {
			baseName = ((OverloadedLogicalConstant) constant)
					.getWrappedConstant().getBaseName();
			overload = true;
		} else {
			baseName = constant.getBaseName();
			overload = false;
		}

		if (!baseName.endsWith(INVERSE_RELATION_SUFFIX)) {
			final LogicalConstant passiveConstant = underspecified
					? (LogicalConstant) underspecify(LogicalConstant.create(
							baseName + INVERSE_RELATION_SUFFIX,
							constant.getType(), true))
					: LogicalConstant.create(
							baseName + INVERSE_RELATION_SUFFIX,
							constant.getType(), true);
			if (overload) {
				return ((OverloadedLogicalConstant) constant)
						.cloneWrapper(passiveConstant);
			} else {
				return passiveConstant;
			}
		}
	}
	return null;
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:37,代码来源:AMRServices.java

示例5: getAssignments

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public Set<LogicalExpression> getAssignments(
		LogicalConstant underspecifiedConstant) {
	final LogicalConstant stripped = OverloadedLogicalConstant
			.getWrapped(underspecifiedConstant);
	final String baseName = stripped.getBaseName();
	final Type type = stripped.getType();
	if (assignmentMapping.containsKey(baseName)) {
		return assignmentMapping.get(baseName).stream()
				.map((name) -> LogicalConstant.create(name, type, true))
				.collect(Collectors.toSet());
	} else if (underspecifyPropBank
			&& baseName.endsWith(PROPBANK_ROLE_WILDCARD)) {
		final String lemma = baseName.substring(0,
				baseName.length() - PROPBANK_ROLE_WILDCARD.length());
		final Set<PropBankFrame> frames = AMRServices
				.getPropBankFrames(lemma);
		if (frames.isEmpty()) {
			return Collections.emptySet();
		}
		return frames.stream()
				.map(frame -> LogicalConstant.create(
						lemma + PROPBANK_ROLE_SEP
								+ String.format("%02d", frame.getId()),
						type, true))
				.collect(Collectors.toSet());
	} else {
		return Collections.emptySet();
	}
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:30,代码来源:SpecificationMapping.java

示例6: underspecify

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public LogicalConstant underspecify(LogicalConstant constant) {
	final String baseName = constant.getBaseName();

	// Verify type <?,<?,t>>.
	if (constant.getType().isComplex()
			&& constant.getType().getRange().isComplex()
			&& LogicLanguageServices.getTypeRepository().getTruthValueType()
					.equals(constant.getType().getRange().getRange())
			&& underspecMapping.containsKey(baseName)) {
		return LogicalConstant.create(underspecMapping.get(baseName),
				constant.getType(), true);
	}

	// Verify type <?,t>.
	if (underspecifyPropBank && constant.getType().isComplex()
			&& constant.getType().getRange().equals(LogicLanguageServices
					.getTypeRepository().getTruthValueType())) {
		// If this is a PropBank frame, underspecify.
		if (AMRServices.isPropBankFrame(baseName)) {
			final String lemma = baseName.substring(0,
					baseName.length() - PROPBANK_ROLE_WILDCARD.length());
			if (!AMRServices.getPropBankFrames(lemma).isEmpty()) {
				return LogicalConstant.create(
						lemma + PROPBANK_ROLE_WILDCARD, constant.getType(),
						true);
			}
		}
	}

	return constant;
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:32,代码来源:SpecificationMapping.java

示例7: visit

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
@Override
public void visit(LogicalConstant logicalConstant) {
	headString = stripType ? logicalConstant.getBaseName()
			: logicalConstant.getName();
}
 
开发者ID:clic-lab,项目名称:spf,代码行数:6,代码来源:GetHeadString.java


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