本文整理汇总了Java中it.unitn.disi.smatch.data.ling.ISense.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ISense.equals方法的具体用法?Java ISense.equals怎么用?Java ISense.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unitn.disi.smatch.data.ling.ISense
的用法示例。
在下文中一共展示了ISense.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSourceSynonymTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceSynonymTarget(ISense source, ISense target) throws SenseMatcherException {
if (source.equals(target)) {
return true;
}
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
try {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
//is synonym
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.SIMILAR_TO);
if (list.size() > 0) {
return !((POS.ADJECTIVE == sourceSyn.getPOS()) || (POS.ADJECTIVE == targetSyn.getPOS())) || (list.get(0).getDepth() == 0);
}
} catch (CloneNotSupportedException | JWNLException e) {
throw new SenseMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
}
}
return false;
}
示例2: isSourceOppositeToTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceOppositeToTarget(ISense source, ISense target) throws SenseMatcherException {
if (source.equals(target)) {
return false;
}
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
try {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
// Checks whether senses are siblings (thus they are opposite)
if (POS.NOUN != sourceSyn.getPOS() || POS.NOUN != targetSyn.getPOS()) {
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.ANTONYM);
if (list.size() > 0) {
return true;
}
}
} catch (CloneNotSupportedException | JWNLException e) {
throw new SenseMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
}
}
return false;
}
示例3: isSourceSynonymTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceSynonymTarget(ISense source, ISense target) throws SenseMatcherException {
if (source.equals(target)) {
return true;
}
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
try {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
//is synonym
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.SIMILAR_TO);
if (list.size() > 0) {
return !((POS.ADJECTIVE == sourceSyn.getPOS()) || (POS.ADJECTIVE == targetSyn.getPOS())) || (list.get(0).getDepth() == 0);
}
} catch (CloneNotSupportedException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new SenseMatcherException(errMessage, e);
}
}
return false;
}
示例4: isSourceOppositeToTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceOppositeToTarget(ISense source, ISense target) throws SenseMatcherException {
if (source.equals(target)) {
return false;
}
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
try {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
// Checks whether senses are siblings (thus they are opposite)
if (POS.NOUN == sourceSyn.getPOS() && POS.NOUN == targetSyn.getPOS()) {
} else {
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.ANTONYM);
if (list.size() > 0) {
return true;
}
}
} catch (CloneNotSupportedException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new SenseMatcherException(errMessage, e);
}
}
return false;
}
示例5: isSourceMoreGeneralThanTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceMoreGeneralThanTarget(ISense source, ISense target) throws SenseMatcherException {
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
if ((POS.NOUN == sourceSyn.getPOS() && POS.NOUN == targetSyn.getPOS()) || (POS.VERB == sourceSyn.getPOS() && POS.VERB == targetSyn.getPOS())) {
if (source.equals(target)) {
return false;
}
try {
// find all more general relationships from WordNet
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.HYPERNYM);
if (!isUnidirectional(list)) {
PointerTargetTree ptt = PointerUtils.getInheritedMemberHolonyms(targetSyn.getSynset());
PointerTargetNodeList ptnl = PointerUtils.getMemberHolonyms(targetSyn.getSynset());
if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
ptt = PointerUtils.getInheritedPartHolonyms(targetSyn.getSynset());
ptnl = PointerUtils.getPartHolonyms(targetSyn.getSynset());
if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
ptt = PointerUtils.getInheritedSubstanceHolonyms(targetSyn.getSynset());
ptnl = PointerUtils.getSubstanceHolonyms(targetSyn.getSynset());
if (traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
return true;
}
} else {
return true;
}
} else {
return true;
}
} else {
return true;
}
} catch (CloneNotSupportedException | JWNLException e) {
throw new SenseMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
}
}
}
return false;
}
示例6: isSourceMoreGeneralThanTarget
import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
public boolean isSourceMoreGeneralThanTarget(ISense source, ISense target) throws SenseMatcherException {
if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
WordNetSense sourceSyn = (WordNetSense) source;
WordNetSense targetSyn = (WordNetSense) target;
if ((POS.NOUN == sourceSyn.getPOS() && POS.NOUN == targetSyn.getPOS()) || (POS.VERB == sourceSyn.getPOS() && POS.VERB == targetSyn.getPOS())) {
if (source.equals(target)) {
return false;
}
try {
// find all more general relationships from WordNet
RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.HYPERNYM);
if (!isUnidirestionalList(list)) {
PointerTargetTree ptt = PointerUtils.getInheritedMemberHolonyms(targetSyn.getSynset());
PointerTargetNodeList ptnl = PointerUtils.getMemberHolonyms(targetSyn.getSynset());
if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
ptt = PointerUtils.getInheritedPartHolonyms(targetSyn.getSynset());
ptnl = PointerUtils.getPartHolonyms(targetSyn.getSynset());
if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
ptt = PointerUtils.getInheritedSubstanceHolonyms(targetSyn.getSynset());
ptnl = PointerUtils.getSubstanceHolonyms(targetSyn.getSynset());
if (traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
return true;
}
} else {
return true;
}
} else {
return true;
}
} else {
return true;
}
} catch (CloneNotSupportedException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new SenseMatcherException(errMessage, e);
}
}
}
return false;
}