use of net.heartsome.cat.ts.core.qa.ParaConsisDataBean in project translationstudio8 by heartsome.
the class ParagraphConsistenceQA method compareNext.
/**
* 与其他文本段进行比较,获取相关值
* @param rowId
*/
private void compareNext(String rowId) {
// 先比较相同源文不同译文的情况
String sameSrcQaTypeText = Messages.getString("qa.ParagraphConsistenceQA.name1");
String mergeRowId = CommonFunction.createUUID();
for (int i = 0; i < srcRowIdList.size(); i++) {
// 如果该文本段存在与其他文本段的相同源文不同译文,那么就进行处理
List<String> curList = srcRowIdList.get(i);
if (curList.contains(rowId)) {
// 循环比较,找出源文相同,译文不同的文本段
List<Integer> sameSourceData = new LinkedList<Integer>();
for (String rowId_1 : curList) {
sameSourceData.clear();
ParaConsisDataBean bean_1 = dataMap.get(rowId_1);
String tgtText_1 = srcIgnoreTag ? bean_1.getTgtPureText() : bean_1.getTgtContent();
for (String rowId_2 : curList) {
if (rowId_2.equals(rowId_1)) {
continue;
}
ParaConsisDataBean bean_2 = dataMap.get(rowId_2);
String tgtText_2 = srcIgnoreTag ? bean_2.getTgtPureText() : bean_2.getTgtContent();
if (!checkEquals(tgtText_2, tgtText_1, srcIgnoreCase)) {
sameSourceData.add(bean_2.getLineNumber());
}
}
if (sameSourceData.size() > 0) {
int lineNum = bean_1.getLineNumber();
// String notSameTip = "";
// for (int k = 0; k < sameSourceData.size(); k++) {
// int k_lineNum = sameSourceData.get(k);
// notSameTip += MessageFormat.format(Messages.getString("qa.ParagraphConsistenceQA.tip1"), k_lineNum);
// }
// notSameTip = notSameTip.length() > 0 ? notSameTip.substring(0, notSameTip.length() - 1): notSameTip;
//
// String errorTip = Messages.getString("qa.ParagraphConsistenceQA.tip2");
// errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip3");
// errorTip += notSameTip;
// errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip4");
super.printQAResult(new QAResultBean(level, QAConstant.QA_PARAGRAPH, sameSrcQaTypeText, mergeRowId, new File(RowIdUtil.getFileNameByRowId(rowId_1)).getName(), lineNum + "", bean_1.getSrcContent(), bean_1.getTgtContent(), rowId_1));
}
}
srcRowIdList.remove(curList);
i--;
}
}
// 再比较相同译文不同源文的情况
mergeRowId = CommonFunction.createUUID();
String sameTgtQaTypeText = Messages.getString("qa.ParagraphConsistenceQA.name2");
for (int i = 0; i < tgtRowIdList.size(); i++) {
// 如果该文本段存在与其他文本段的相同源文不同译文,那么就进行处理
List<String> curList = tgtRowIdList.get(i);
if (curList.contains(rowId)) {
// 循环比较,找出源文相同,译文不同的文本段
List<Integer> sameTargetData = new LinkedList<Integer>();
for (String rowId_1 : curList) {
sameTargetData.clear();
ParaConsisDataBean bean_1 = dataMap.get(rowId_1);
String srcText_1 = tgtIgnoreTag ? bean_1.getSrcPureText() : bean_1.getSrcContent();
for (String rowId_2 : curList) {
if (rowId_2.equals(rowId_1)) {
continue;
}
ParaConsisDataBean bean_2 = dataMap.get(rowId_2);
String srcText_2 = tgtIgnoreTag ? bean_2.getSrcPureText() : bean_2.getSrcContent();
if (!checkEquals(srcText_2, srcText_1, tgtIgnoreCase)) {
sameTargetData.add(bean_2.getLineNumber());
}
}
if (sameTargetData.size() > 0) {
int lineNum = bean_1.getLineNumber();
// String notSameTip = "";
// for (int k = 0; k < sameTargetData.size(); k++) {
// int k_lineNum = sameTargetData.get(k);
// notSameTip += MessageFormat.format(Messages.getString("qa.ParagraphConsistenceQA.tip1"), k_lineNum);
// }
// notSameTip = notSameTip.length() > 0 ? notSameTip.substring(0, notSameTip.length() - 1): notSameTip;
//
// String errorTip = Messages.getString("qa.ParagraphConsistenceQA.tip2");
// errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip3");
// errorTip += notSameTip;
// errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip5");
super.printQAResult(new QAResultBean(level, QAConstant.QA_PARAGRAPH, sameTgtQaTypeText, mergeRowId, new File(RowIdUtil.getFileNameByRowId(rowId_1)).getName(), "" + lineNum, bean_1.getSrcContent(), bean_1.getTgtContent(), rowId_1));
}
}
tgtRowIdList.remove(curList);
i--;
}
}
}
Aggregations