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


Java LinguisticOracleException.getMessage方法代码示例

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


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

示例1: extendedIndexOf

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * An extension of the list indexOf method which uses approximate comparison of the words as
 * elements of the List.
 *
 * @param vec      list of strings
 * @param str      string to search
 * @param init_pos start position
 * @return position
 * @throws ContextPreprocessorException ContextPreprocessorException
 */
private int extendedIndexOf(List<String> vec, String str, int init_pos) throws ContextPreprocessorException {
    try {
        // for all words in the input list starting from init_pos
        for (int i = init_pos; i < vec.size(); i++) {
            String vel = vec.get(i);
            // try syntactic
            if (vel.equals(str)) {
                return i;
            } else if (vel.indexOf(str) == 0) {
                // and semantic comparison
                if (linguisticOracle.isEqual(vel, str)) {
                    vec.add(i, str);
                    vec.remove(i + 1);
                    return i;
                }
            }
        }
        return -1;
    } catch (LinguisticOracleException e) {
        throw new ContextPreprocessorException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:33,代码来源:DefaultContextPreprocessor.java

示例2: checkMW

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
private List<ISense> checkMW(String source, String target) throws ContextPreprocessorException {
    try {
        ArrayList<ArrayList<String>> mwEnds = linguisticOracle.getMultiwords(source);
        if (mwEnds != null) {
            for (ArrayList<String> strings : mwEnds) {
                if (extendedIndexOf(strings, target, 0) > 0) {
                    return linguisticOracle.getSenses(source + " " + target);
                }
            }
        }
        return new ArrayList<ISense>();
    } catch (LinguisticOracleException e) {
        final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
        log.error(errMessage, e);
        throw new ContextPreprocessorException(errMessage, e);
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:18,代码来源:DefaultContextPreprocessor.java

示例3: extendedIndexOf

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * An extension of the list indexOf method which uses approximate comparison of the words as
 * elements of the List.
 *
 * @param vec      list of strings
 * @param str      string to search
 * @param init_pos start position
 * @return position
 * @throws ContextPreprocessorException ContextPreprocessorException
 */
private int extendedIndexOf(List<String> vec, String str, int init_pos) throws ContextPreprocessorException {
    try {
        // for all words in the input list starting from init_pos
        for (int i = init_pos; i < vec.size(); i++) {
            String vel = vec.get(i);
            // try syntactic
            if (vel.equals(str)) {
                return i;
            } else if (vel.indexOf(str) == 0) {
                // and semantic comparison
                if (linguisticOracle.isEqual(vel, str)) {
                    vec.add(i, str);
                    vec.remove(i + 1);
                    return i;
                }
            }
        }
        return -1;
    } catch (LinguisticOracleException e) {
        final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
        log.error(errMessage, e);
        throw new ContextPreprocessorException(errMessage, e);
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:35,代码来源:DefaultContextPreprocessor.java

示例4: getAncestors

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
private List<ISense> getAncestors(ISense node, int depth) throws ElementMatcherException {
    try {
        return node.getParents(depth);
    } catch (LinguisticOracleException e) {
        throw new ElementMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:8,代码来源:WNHierarchy.java

示例5: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的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

示例6: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * Computes the relation for extended gloss matcher.
 *
 * @param source1 the gloss of source
 * @param target1 the gloss of target
 * @return synonym or IDK relation
 */
public char match(ISense source1, ISense target1) throws ElementMatcherException {
    char result = IMappingElement.IDK;
    try {
        String tExtendedGloss = getExtendedGloss(target1, 1, IMappingElement.LESS_GENERAL);
        String sExtendedGloss = getExtendedGloss(source1, 1, IMappingElement.LESS_GENERAL);
        //variations of this matcher
        StringTokenizer stSource = new StringTokenizer(tExtendedGloss, " ,.\"'();");
        String lemmaS, lemmaT;
        int counter = 0;
        while (stSource.hasMoreTokens()) {
            StringTokenizer stTarget = new StringTokenizer(sExtendedGloss, " ,.\"'();");
            lemmaS = stSource.nextToken();
            if (!meaninglessWords.contains(lemmaS))
                while (stTarget.hasMoreTokens()) {
                    lemmaT = stTarget.nextToken();
                    if (!meaninglessWords.contains(lemmaT))
                        if (lemmaS.equalsIgnoreCase(lemmaT))
                            counter++;
                }
        }
        if (counter > threshold) {
            result = IMappingElement.EQUIVALENCE;
        }
    } catch (LinguisticOracleException e) {
        throw new ElementMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
    return result;
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:36,代码来源:WNExtendedGlossComparison.java

示例7: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * Computes the relation for extended gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return synonym or IDK relation
 */
public char match(ISense source, ISense target) throws ElementMatcherException {
    char result = IMappingElement.IDK;
    try {
        String tExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
        List<String> sourceLemmas = source.getLemmas();
        //variations of this matcher
        //StringTokenizer stSource = new StringTokenizer(tExtendedGloss, " ,.\"'();");
        String lemmaT;
        int counter = 0;
        for (String sourceLemma : sourceLemmas) {
            StringTokenizer stTarget = new StringTokenizer(tExtendedGloss, " ,.\"'();");
            if (!meaninglessWords.contains(sourceLemma))
                while (stTarget.hasMoreTokens()) {
                    lemmaT = stTarget.nextToken();
                    if (!meaninglessWords.contains(lemmaT)) {
                        if (sourceLemma.equalsIgnoreCase(lemmaT)) {
                            counter++;
                        }
                    }
                }
        }
        if (counter > threshold) {
            result = IMappingElement.EQUIVALENCE;
        }
    } catch (LinguisticOracleException e) {
        throw new ElementMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
    return result;
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:37,代码来源:WNExtendedGloss.java

示例8: checkMW

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
private List<ISense> checkMW(String source, String target) throws ContextPreprocessorException {
    try {
        List<List<String>> mwEnds = linguisticOracle.getMultiwords(source);
        if (mwEnds != null) {
            for (List<String> strings : mwEnds) {
                if (extendedIndexOf(strings, target, 0) > 0) {
                    return linguisticOracle.getSenses(source + " " + target);
                }
            }
        }
        return new ArrayList<>();
    } catch (LinguisticOracleException e) {
        throw new ContextPreprocessorException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
}
 
开发者ID:s-match,项目名称:s-match-core,代码行数:16,代码来源:DefaultContextPreprocessor.java

示例9: getAncestors

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
private List<ISense> getAncestors(ISense node, int depth) throws MatcherLibraryException {
    try {
        return node.getParents(depth);
    } catch (LinguisticOracleException e) {
        final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
        log.error(errMessage, e);
        throw new MatcherLibraryException(errMessage, e);
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:10,代码来源:WNHierarchy.java

示例10: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的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

示例11: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * Computes the relation for extended gloss matcher.
 *
 * @param source1 the gloss of source
 * @param target1 the gloss of target
 * @return synonym or IDK relation
 */
public char match(ISense source1, ISense target1) throws MatcherLibraryException {
    char result = IMappingElement.IDK;
    try {
        String tExtendedGloss = getExtendedGloss(target1, 1, IMappingElement.LESS_GENERAL);
        String sExtendedGloss = getExtendedGloss(source1, 1, IMappingElement.LESS_GENERAL);
        //variations of this matcher
        StringTokenizer stSource = new StringTokenizer(tExtendedGloss, " ,.\"'();");
        String lemmaS, lemmaT;
        int counter = 0;
        while (stSource.hasMoreTokens()) {
            StringTokenizer stTarget = new StringTokenizer(sExtendedGloss, " ,.\"'();");
            lemmaS = stSource.nextToken();
            if (!meaninglessWords.contains(lemmaS))
                while (stTarget.hasMoreTokens()) {
                    lemmaT = stTarget.nextToken();
                    if (!meaninglessWords.contains(lemmaT))
                        if (lemmaS.equalsIgnoreCase(lemmaT))
                            counter++;
                }
        }
        if (counter > threshold) {
            result = IMappingElement.EQUIVALENCE;
        }
    } 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,代码行数:38,代码来源:WNExtendedGlossComparison.java

示例12: match

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
/**
 * Computes the relation for extended gloss matcher.
 *
 * @param source the gloss of source
 * @param target the gloss of target
 * @return synonym or IDK relation
 */
public char match(ISense source, ISense target) throws MatcherLibraryException {
    char result = IMappingElement.IDK;
    try {
        String tExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
        List<String> sourceLemmas = source.getLemmas();
        //variations of this matcher
        //StringTokenizer stSource = new StringTokenizer(tExtendedGloss, " ,.\"'();");
        String lemmaT;
        int counter = 0;
        for (String sourceLemma : sourceLemmas) {
            StringTokenizer stTarget = new StringTokenizer(tExtendedGloss, " ,.\"'();");
            if (!meaninglessWords.contains(sourceLemma))
                while (stTarget.hasMoreTokens()) {
                    lemmaT = stTarget.nextToken();
                    if (!meaninglessWords.contains(lemmaT)) {
                        if (sourceLemma.equalsIgnoreCase(lemmaT)) {
                            counter++;
                        }
                    }
                }
        }
        if (counter > threshold) {
            result = IMappingElement.EQUIVALENCE;
        }
    } 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,代码行数:39,代码来源:WNExtendedGloss.java

示例13: endElement

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
public void endElement(String uri, String localName, String qName) {
    if (0 < content.length()) {
        if ("logicalFormulaRepresentation".equals(localName)) {
            node.getNodeData().setcNodeFormula(content.toString().trim());
        } else if ("cLabFormula".equals(localName)) {
            node.getNodeData().setcLabFormula(content.toString().trim());
        } else if ("idToken".equals(localName)) {
            sense.setId(Integer.parseInt(content.toString()));
        } else if ("token".equals(localName)) {
            sense.setToken(content.toString());
        } else if ("lemma".equals(localName)) {
            sense.setLemma(content.toString());
        } else if ("wSenses".equals(localName)) {
            if (-1 < content.indexOf("#") && null != oracle) {
                String[] senses = content.toString().trim().split(" ");
                for (String s : senses) {
                    try {
                        sense.addSense(oracle.createSense(s));
                    } catch (LinguisticOracleException e) {
                        throw new RuntimeException(e.getMessage(), e);
                    }
                }
            }
        }
        content = new StringBuilder();
    }
    if ("sense".equals(localName)) {
        node.getNodeData().addACoL(sense);
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:31,代码来源:CTXMLContextLoader.java

示例14: tagSenses

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
private void tagSenses(List<? extends IToken> tokens) throws PipelineComponentException {
    for (IToken token : tokens) {
        try {
            List<ISense> senses = oracle.getSenses(token.getText());
            if (0 < senses.size()) {//to save memory with default empty lists already there
                token.setSenses(senses);
            }
        } catch (LinguisticOracleException e) {
            throw new PipelineComponentException(e.getMessage(), e);
        }
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:13,代码来源:LinguisticOracleSenseTagger.java

示例15: process

import it.unitn.disi.smatch.oracles.LinguisticOracleException; //导入方法依赖的package包/类
public void process(ILabel instance) throws PipelineComponentException {
    for (IToken token : instance.getTokens()) {
        try {
            List<String> lemmas = oracle.getBaseForms(token.getText());
            if (0 < lemmas.size()) {
                token.setLemma(lemmas.get(0));//lemma is supposed to be that of an "active" sense
            }
        } catch (LinguisticOracleException e) {
            throw new PipelineComponentException(e.getMessage(), e);
        }
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:13,代码来源:LinguisticOracleLemmatizer.java


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