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


Java ISense.getGloss方法代码示例

本文整理汇总了Java中it.unitn.disi.smatch.data.ling.ISense.getGloss方法的典型用法代码示例。如果您正苦于以下问题:Java ISense.getGloss方法的具体用法?Java ISense.getGloss怎么用?Java ISense.getGloss使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unitn.disi.smatch.data.ling.ISense的用法示例。


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

示例1: match

import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
/**
 * Computes the relations with WordNet gloss comparison matcher.
 *
 * @param source gloss of source
 * @param target gloss of target
 * @return synonym or IDK relation
 */
public char match(ISense source, ISense target) {
    String sSynset = source.getGloss();
    String tSynset = target.getGloss();
    StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();");
    String lemmaS, lemmaT;
    int counter = 0;
    while (stSource.hasMoreTokens()) {
        StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();");
        lemmaS = stSource.nextToken();
        if (!meaninglessWords.contains(lemmaS))
            while (stTarget.hasMoreTokens()) {
                lemmaT = stTarget.nextToken();
                if (!meaninglessWords.contains(lemmaT))
                    if (lemmaS.equals(lemmaT))
                        counter++;
            }
    }
    if (counter >= threshold)
        return IMappingElement.EQUIVALENCE;
    else
        return IMappingElement.IDK;
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:30,代码来源:WNGlossComparison.java

示例2: match

import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
/**
 * Computes the relation for extended semantic gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return more general, less general or IDK relation
 */
public char match(ISense source, ISense target) throws ElementMatcherException {
    char result = IMappingElement.IDK;
    try {
        String sSynset = source.getGloss();

        // get gloss of Immediate ancestor of target node
        String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
        // get relation frequently occur between gloss of source and extended gloss of target
        char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
        // get final relation
        char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
        // get gloss of Immediate descendant of target node
        String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
        char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
        char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
        // Compute final relation
        if (MGFinal == LGFinal) {
            result = MGFinal;
        }
        if (MGFinal == IMappingElement.IDK) {
            result = LGFinal;
        }
        if (LGFinal == IMappingElement.IDK) {
            result = MGFinal;
        }
    } catch (LinguisticOracleException e) {
        throw new ElementMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
    return result;
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:38,代码来源:WNExtendedSemanticGlossComparison.java

示例3: match

import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
/**
 * Computes the relations with WordNet semantic gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return less general, more general, equal, opposite or IDK relation
 */
public char match(ISense source, ISense target) throws ElementMatcherException {
    int Equals = 0;
    int moreGeneral = 0;
    int lessGeneral = 0;
    int Opposite = 0;
    String sSynset = source.getGloss();
    String tSynset = target.getGloss();
    StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'()");
    String lemmaS, lemmaT;
    while (stSource.hasMoreTokens()) {
        StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'()");
        lemmaS = stSource.nextToken();
        if (!meaninglessWords.contains(lemmaS))
            while (stTarget.hasMoreTokens()) {
                lemmaT = stTarget.nextToken();
                if (!meaninglessWords.contains(lemmaT)) {
                    if (isWordLessGeneral(lemmaS, lemmaT))
                        lessGeneral++;
                    else if (isWordMoreGeneral(lemmaS, lemmaT))
                        moreGeneral++;
                    else if (isWordSynonym(lemmaS, lemmaT))
                        Equals++;
                    else if (isWordOpposite(lemmaS, lemmaT))
                        Opposite++;
                }
            }
    }
    return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite);
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:37,代码来源:WNSemanticGlossComparison.java

示例4: match

import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
/**
 * Computes the relation for extended semantic gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return more general, less general or IDK relation
 */
public char match(ISense source, ISense target) throws MatcherLibraryException {
    char result = IMappingElement.IDK;
    try {
        String sSynset = source.getGloss();

        // get gloss of Immediate ancestor of target node
        String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
        // get relation frequently occur between gloss of source and extended gloss of target
        char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
        // get final relation
        char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
        // get gloss of Immediate descendant of target node
        String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
        char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
        char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
        // Compute final relation
        if (MGFinal == LGFinal) {
            result = MGFinal;
        }
        if (MGFinal == IMappingElement.IDK) {
            result = LGFinal;
        }
        if (LGFinal == IMappingElement.IDK) {
            result = MGFinal;
        }
    } catch (LinguisticOracleException e) {
        final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
        log.error(errMessage, e);
        throw new MatcherLibraryException(errMessage, e);
    }
    return result;
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:40,代码来源:WNExtendedSemanticGlossComparison.java

示例5: match

import it.unitn.disi.smatch.data.ling.ISense; //导入方法依赖的package包/类
/**
 * Computes the relations with WordNet semantic gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return less general, more general, equal, opposite or IDK relation
 */
public char match(ISense source, ISense target) throws MatcherLibraryException {
    int Equals = 0;
    int moreGeneral = 0;
    int lessGeneral = 0;
    int Opposite = 0;
    String sSynset = source.getGloss();
    String tSynset = target.getGloss();
    StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'()");
    String lemmaS, lemmaT;
    while (stSource.hasMoreTokens()) {
        StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'()");
        lemmaS = stSource.nextToken();
        if (!meaninglessWords.contains(lemmaS))
            while (stTarget.hasMoreTokens()) {
                lemmaT = stTarget.nextToken();
                if (!meaninglessWords.contains(lemmaT)) {
                    if (isWordLessGeneral(lemmaS, lemmaT))
                        lessGeneral++;
                    else if (isWordMoreGeneral(lemmaS, lemmaT))
                        moreGeneral++;
                    else if (isWordSynonym(lemmaS, lemmaT))
                        Equals++;
                    else if (isWordOpposite(lemmaS, lemmaT))
                        Opposite++;
                }
            }
    }
    return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite);
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:37,代码来源:WNSemanticGlossComparison.java


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