本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例7: visit
import edu.cornell.cs.nlp.spf.mr.lambda.LogicalConstant; //导入方法依赖的package包/类
@Override
public void visit(LogicalConstant logicalConstant) {
headString = stripType ? logicalConstant.getBaseName()
: logicalConstant.getName();
}