Search in sources :

Example 1 with TranslationUnitAnalysisResults

use of net.heartsome.cat.database.bean.TranslationUnitAnalysisResults in project translationstudio8 by heartsome.

the class TmMatcher method translationUnitAnalysis.

public List<TranslationUnitAnalysisResult> translationUnitAnalysis() {
    int maxMatchSize = transParameters.getMaxMatchSize();
    int contextSize = transParameters.getContextSize();
    int minSimilarity = transParameters.getMinSimilarity();
    int tagPelanty = transParameters.getTagPenalty();
    boolean isCaseSensitive = transParameters.isCaseSensitive();
    boolean isIgnoreTag = transParameters.isIgnoreTag();
    TranslationUnitAnalysisResults results = new TranslationUnitAnalysisResults(tmDbOperatorManager.getDefaultDbName(), transParameters.getMatchSortStrategry(), maxMatchSize);
    List<DBOperator> dbList = tmDbOperatorManager.getDbOperatorList();
    if (dbList.size() == 0) {
        return results.getAnaylysisResults();
    }
    String pureText = tuInfoBean.getSrcPureText();
    String fullText = tuInfoBean.getSrcFullText();
    String srcLang = Utils.convertLangCode(tuInfoBean.getSrcLanguage());
    String tgtLang = Utils.convertLangCode(tuInfoBean.getTgtLangugage());
    String preContext = tuInfoBean.getPreContext();
    String nextContext = tuInfoBean.getNextContext();
    if (pureText == null || pureText.equals("") || srcLang == null || srcLang.equals("") || tgtLang == null || tgtLang.equals("")) {
        return results.getAnaylysisResults();
    }
    for (int i = 0; i < dbList.size(); i++) {
        try {
            dbList.get(i).translationUnitAnalysis(pureText, fullText, srcLang, tgtLang, minSimilarity, isCaseSensitive, maxMatchSize, contextSize, preContext, nextContext, isIgnoreTag, results, tagPelanty);
            results.sort();
            results.clearResults();
        } catch (SQLException e) {
            logger.error(Messages.getString("match.TmMatcher.logger1"), e);
            continue;
        }
    }
    results.sort();
    results.clearResults();
    return results.getAnaylysisResults();
}
Also used : SQLException(java.sql.SQLException) DBOperator(net.heartsome.cat.database.DBOperator) TranslationUnitAnalysisResults(net.heartsome.cat.database.bean.TranslationUnitAnalysisResults)

Aggregations

SQLException (java.sql.SQLException)1 DBOperator (net.heartsome.cat.database.DBOperator)1 TranslationUnitAnalysisResults (net.heartsome.cat.database.bean.TranslationUnitAnalysisResults)1