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


Java LogicalConstant.create方法代码示例

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


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

示例1: createRefPredicate

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Create a reference predicate, e.g., ref:<id,e>.
 */
public static LogicalConstant createRefPredicate(Type type) {
	final LogicalConstant cached = INSTANCE.refPredicatesCache.get(type);

	if (cached != null) {
		return cached;
	}

	final ComplexType predicateType = LogicLanguageServices
			.getTypeRepository()
			.getTypeCreateIfNeeded(type, SkolemServices.getIDType());
	final LogicalConstant predicate = LogicalConstant
			.create(INSTANCE.refPredicateBaseName, predicateType, true);

	INSTANCE.refPredicatesCache.put(type, predicate);

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

示例2: createTextConstant

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public static LogicalConstant createTextConstant(List<String> tokens) {
	final String TEXT_STRING_SEP = "++";
	final String escapedString = LogicalConstant
			.escapeString(tokens.stream().map(token -> {
				final StringBuilder modifiedToken = new StringBuilder(
						token);
				if (modifiedToken.charAt(0) == '"') {
					modifiedToken.deleteCharAt(0);
				}
				if (modifiedToken
						.charAt(modifiedToken.length() - 1) == '"') {
					modifiedToken.deleteCharAt(modifiedToken.length() - 1);
				}
				return modifiedToken.toString();
			}).collect(Collectors.joining(TEXT_STRING_SEP)));
	return LogicalConstant.create(escapedString, INSTANCE.textType, true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:18,代码来源:AMRServices.java

示例3: visit

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
@Override
public void visit(Variable variable) {
	if (variable instanceof SkolemId) {
		tempReturn = LogicalConstant.create(anonnymousTag,
				variable.getType(), true);
	} else {
		tempReturn = variable;
	}
}
 
开发者ID:clic-lab,项目名称:spf,代码行数:10,代码来源:GetStructure.java

示例4: createSkolemPredicate

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Create a skolem term predicate, e.g., a:<id,<<e,t>,e>>.
 */
public static LogicalConstant createSkolemPredicate(Type type) {
	final LogicalConstant cached = INSTANCE.skolemPredicatesCache.get(type);

	if (cached != null) {
		return cached;
	}

	final ComplexType predicateType = LogicLanguageServices
			.getTypeRepository().getTypeCreateIfNeeded(
					LogicLanguageServices.getTypeRepository()
							.getTypeCreateIfNeeded(type,
									LogicLanguageServices
											.getTypeRepository()
											.getTypeCreateIfNeeded(
													LogicLanguageServices
															.getTypeRepository()
															.getTruthValueType(),
													type)),
					SkolemServices.getIDType());
	final LogicalConstant predicate = LogicalConstant
			.create(INSTANCE.skolemPredicateBaseName, predicateType, true);

	INSTANCE.skolemPredicatesCache.put(type, predicate);

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

示例5: 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

示例6: 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

示例7: 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

示例8: createLiteral

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Given a list of arguments, a type and a predicate base name create a
 * literal. The type of the predicate is <type,...,<type,type>...>.
 */
public static Literal createLiteral(String name,
		LogicalExpression[] arguments, Type type) {

	// Create the type of the predicate.
	ComplexType predicateType = LogicLanguageServices.getTypeRepository()
			.getTypeCreateIfNeeded(type, type);
	for (int i = 1; i < arguments.length; i++) {
		predicateType = LogicLanguageServices.getTypeRepository()
				.getTypeCreateIfNeeded(predicateType, type);
	}

	return new Literal(LogicalConstant.create(name, predicateType, true),
			arguments);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:19,代码来源:CoordinationServices.java

示例9: createpCOpPredicate

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * Dynamically create c_op predicates, e.g., c_op1:<e,<e,t>>,
 * c_op2:<e,<i,t>> and so on.
 */
public static LogicalConstant createpCOpPredicate(int num, Type argType) {
	final String baseName = INSTANCE.argumentPredicateBaseName + num;
	final Type type = LogicLanguageServices.getTypeRepository()
			.getTypeCreateIfNeeded(
					LogicLanguageServices.getTypeRepository()
							.getTypeCreateIfNeeded(
									LogicLanguageServices
											.getTypeRepository()
											.getTruthValueType(), argType),
					LogicLanguageServices.getTypeRepository()
							.getEntityType());
	return LogicalConstant.create(baseName, type, true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:18,代码来源:CoordinationServices.java

示例10: CoordinationCX4Rule

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public CoordinationCX4Rule(
		ICategoryServices<LogicalExpression> categoryServices) {
	super(categoryServices, LABEL);
	this.extractionPlaceholder = LogicalConstant
			.create(LABEL, LogicLanguageServices.getTypeRepository()
					.getEntityType(), true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:8,代码来源:CoordinationCX4Rule.java

示例11: getIntegerConstant

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
public static LogicalConstant getIntegerConstant(String string,
		IntPredicate filter) {
	if (NUMBER.matches(string) && filter.test(Integer.valueOf(string))) {
		return LogicalConstant.create(Integer.valueOf(string).toString(),
				LogicLanguageServices.getNumeralType(), true);
	} else {
		return null;
	}
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:10,代码来源:NumeralGenerator.java

示例12: createConstant

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
private static LogicalConstant createConstant(String name, Type type) {
	return LogicalConstant.create(LogicalConstant.escapeString(name), type,
			true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:5,代码来源:AmrToLogicalExpressionConverter.java

示例13: SloppyAmrClosure

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
private SloppyAmrClosure() {
	// Usage via 'of' method.
	this.dummyTypingPredicate = LogicalConstant.create("UNK",
			AMRServices.getTypingPredicateType(), true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:6,代码来源:SloppyAmrClosure.java

示例14: integerToOpPredicate

import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
/**
 * @param i
 *            Create opi predicates.
 * @param predicatType
 *            The type of the generated predicate.
 */
public static LogicalConstant integerToOpPredicate(int i, Type type) {
	return LogicalConstant.create(INSTANCE.opPredicatePrefix + i, type,
			true);
}
 
开发者ID:clic-lab,项目名称:amr,代码行数:11,代码来源:AMRServices.java


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