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


Java ISense.equals方法代码示例

本文整理汇总了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;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:20,代码来源:WordNet.java

示例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;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:22,代码来源:WordNet.java

示例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;
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:22,代码来源:WordNet.java

示例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;
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:25,代码来源:WordNet.java

示例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;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:41,代码来源:WordNet.java

示例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;
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:43,代码来源:WordNet.java


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