|
@@ -28,19 +28,19 @@ public class PatentRightUtils {
|
|
|
//译文
|
|
|
String contentOut = params.getContentOut();
|
|
|
|
|
|
- //创建一个权要集合用于返回结果
|
|
|
+ //创建一个权要集合
|
|
|
ArrayList<PatentRight> patentRights = new ArrayList<>();
|
|
|
|
|
|
- //若原文为null或空串,则直接结束并返回空集合;
|
|
|
+ //若原文为null或空串,则直接结束并返回空集合;若译文为null,则置为空串
|
|
|
if (content == null || content.equals("")) {
|
|
|
return patentRights;
|
|
|
}
|
|
|
- //若译文为null,则置为空串
|
|
|
+
|
|
|
if (contentOut == null) {
|
|
|
contentOut = "";
|
|
|
}
|
|
|
|
|
|
- //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@"(先使得全文连在一起,再根据特殊符号@拆分权要)
|
|
|
+ //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@",这样首先可以使得全文连在一起,其次再根据特殊符号@拆分权要
|
|
|
if (content.contains("\r\n")) {
|
|
|
content = content.replaceAll("\r\n", "@");
|
|
|
}
|
|
@@ -62,13 +62,13 @@ public class PatentRightUtils {
|
|
|
if (country.equals("CN") || country.equals("JP") || country.equals("KR") || content.contains("权利要求")) {
|
|
|
String regex;
|
|
|
if (content.contains("@2")) {
|
|
|
- regex = "@[1-9]+";
|
|
|
+ regex = "@[0-9]+";
|
|
|
} else if (content.contains("@[00")) {
|
|
|
regex = "@\\[[0-9]+]";
|
|
|
} else if (content.contains("@請求項")) {
|
|
|
- regex = "@【請求項[1-9]+】";
|
|
|
+ regex = "@【請求項[0-9]+】";
|
|
|
} else if (content.contains("@청구항")) {
|
|
|
- regex = "@청구항 [1-9]+";
|
|
|
+ regex = "@청구항 [0-9]+";
|
|
|
} else {
|
|
|
regex = "";
|
|
|
}
|
|
@@ -183,8 +183,8 @@ public class PatentRightUtils {
|
|
|
}
|
|
|
|
|
|
String regex;
|
|
|
- if (content.contains("@")) {
|
|
|
- regex = "@[1-9]+";
|
|
|
+ if (content.contains("@2")) {
|
|
|
+ regex = "@[0-9]+";
|
|
|
} else if (content.contains("[001]")) {
|
|
|
regex = "\\[[0-9]+]";
|
|
|
} else {
|
|
@@ -192,7 +192,7 @@ public class PatentRightUtils {
|
|
|
}
|
|
|
|
|
|
Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
- Matcher matcherOut = Pattern.compile("@[0-9]+").matcher(contentOut);
|
|
|
+ Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
|
|
|
while (matcher.find()) {
|
|
|
content = content.replaceFirst(matcher.group(), "\n" + matcher.group().substring(matcher.group().indexOf("@") + 1));
|
|
|
}
|
|
@@ -258,11 +258,13 @@ public class PatentRightUtils {
|
|
|
.setContent(strs[i])
|
|
|
.setSort(i)
|
|
|
.setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
- //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
- if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
- patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
- } else {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
+ if (strsOut.length - 1 >= i) {
|
|
|
+ //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
+ if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
+ patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
+ } else {
|
|
|
+ patentRight.setContentOut(strsOut[i]);
|
|
|
+ }
|
|
|
}
|
|
|
patentRights.add(patentRight);
|
|
|
} else if (matcher3.find()) {
|
|
@@ -279,11 +281,13 @@ public class PatentRightUtils {
|
|
|
.setContent(strs[i])
|
|
|
.setSort(i)
|
|
|
.setParentSort(builder.substring(0, builder.lastIndexOf(",")));
|
|
|
- //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
- if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
- patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
- } else {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
+ if (strsOut.length - 1 >= i) {
|
|
|
+ //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
+ if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
+ patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
+ } else {
|
|
|
+ patentRight.setContentOut(strsOut[i]);
|
|
|
+ }
|
|
|
}
|
|
|
patentRights.add(patentRight);
|
|
|
}
|
|
@@ -295,11 +299,13 @@ public class PatentRightUtils {
|
|
|
.setContent(strs[i])
|
|
|
.setSort(i)
|
|
|
.setParentSort("-1");
|
|
|
- //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
- if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
- patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
- } else {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
+ if (strsOut.length - 1 >= i) {
|
|
|
+ //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
|
|
|
+ if (strsOut.length > strs.length && strs.length == (i + 1)) {
|
|
|
+ patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
|
|
|
+ } else {
|
|
|
+ patentRight.setContentOut(strsOut[i]);
|
|
|
+ }
|
|
|
}
|
|
|
patentRights.add(patentRight);
|
|
|
}
|