|
@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
|
|
|
public class ClaimSplitUtils {
|
|
|
private static final List<String> CNRegix = Arrays.asList("[0-9]+\\.[^0-9]+?", "\\[[0-9]+]");
|
|
|
private static final List<String> JPRegix = Arrays.asList("【請求項[0-9]+】");
|
|
|
- private static final List<String> KORRegix = Arrays.asList("청구항 [0-9]+","\\[[0-9]+]");
|
|
|
+ private static final List<String> KORRegix = Arrays.asList("청구항 [0-9]+", "\\[[0-9]+]");
|
|
|
private static final List<String> ENReginx = Arrays.asList("[0-9]+\\.[^0-9]+?", "\\[[0-9]+]");
|
|
|
|
|
|
|
|
@@ -33,7 +33,7 @@ public class ClaimSplitUtils {
|
|
|
String country = params.getCountry();
|
|
|
String patentNo = params.getPatentNo();
|
|
|
if (country == null) {
|
|
|
- country = params.getPatentNo().substring(0,2);
|
|
|
+ country = params.getPatentNo().substring(0, 2);
|
|
|
}
|
|
|
//原文
|
|
|
String content = params.getContent();
|
|
@@ -47,7 +47,7 @@ public class ClaimSplitUtils {
|
|
|
}
|
|
|
String regex = ClaimSplitUtils.getRegex(country, content);
|
|
|
if (regex == null) {
|
|
|
- reDefaultPatentClaim(patentRights,content);
|
|
|
+ reDefaultPatentClaim(patentRights, content);
|
|
|
return patentRights;
|
|
|
}
|
|
|
patentRights = splitPatentRight(regex, content);
|
|
@@ -63,7 +63,7 @@ public class ClaimSplitUtils {
|
|
|
loadENPatentClaim(patentNo, patentRights);
|
|
|
break;
|
|
|
}
|
|
|
- return patentRights;
|
|
|
+ return patentRights;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
ArrayList<RePatentClaim> patentRights = new ArrayList<>();
|
|
@@ -74,6 +74,64 @@ public class ClaimSplitUtils {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// private static final ArrayList<RePatentClaim> splitPatentRight(String regex, String content) {
|
|
|
+// //获取拆分信息
|
|
|
+// List<ClaimSplitVO> claimSplitVOS = ClaimSplitUtils.getClaimSpitVO(regex, content);
|
|
|
+//
|
|
|
+// String regexNum = "[1-9][0-9]*";
|
|
|
+// Integer num = 1;
|
|
|
+// ArrayList<RePatentClaim> patentRights = new ArrayList<>();
|
|
|
+// Boolean flag = true;
|
|
|
+// Integer start =0;
|
|
|
+// Integer end =0;
|
|
|
+// for (int i = 0; i < claimSplitVOS.size(); i++) {
|
|
|
+//// Integer start = claimSplitVOS.get(i).getPosition();
|
|
|
+//// Integer end = content.length();
|
|
|
+// String cont = claimSplitVOS.get(i).getContent();
|
|
|
+// Matcher matcherNum = Pattern.compile(regexNum).matcher(cont);
|
|
|
+//
|
|
|
+// //查询当前序号
|
|
|
+// if (matcherNum.find()) {
|
|
|
+// String a = matcherNum.group();
|
|
|
+// Integer num2 = Integer.parseInt(a);
|
|
|
+// if (num2 != num) {
|
|
|
+// if (i == 0 && num2.equals(2)) {
|
|
|
+// start =claimSplitVOS.get(i).getPosition();
|
|
|
+// String str = content.substring(0, start);
|
|
|
+// RePatentClaim rePatentClaim = new RePatentClaim();
|
|
|
+// rePatentClaim.setSort(num - 1);
|
|
|
+// rePatentClaim.setContent(str);
|
|
|
+// patentRights.add(rePatentClaim);
|
|
|
+// num++;
|
|
|
+// } else {
|
|
|
+// flag = false;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// start =claimSplitVOS.get(i).getPosition();
|
|
|
+// if (i + 1 < claimSplitVOS.size()) {
|
|
|
+// end = claimSplitVOS.get(i + 1).getPosition();
|
|
|
+// }
|
|
|
+//
|
|
|
+// String str = content.substring(start, end);
|
|
|
+// RePatentClaim rePatentClaim = new RePatentClaim();
|
|
|
+// rePatentClaim.setSort(num - 1);
|
|
|
+// rePatentClaim.setContent(str);
|
|
|
+// patentRights.add(rePatentClaim);
|
|
|
+// num++;
|
|
|
+// } else {
|
|
|
+// flag = false;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (flag.equals(false) || patentRights.size() == 1) {
|
|
|
+// reDefaultPatentClaim(patentRights, content);
|
|
|
+// }
|
|
|
+// return patentRights;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
private static final ArrayList<RePatentClaim> splitPatentRight(String regex, String content) {
|
|
|
//获取拆分信息
|
|
|
List<ClaimSplitVO> claimSplitVOS = ClaimSplitUtils.getClaimSpitVO(regex, content);
|
|
@@ -82,39 +140,55 @@ public class ClaimSplitUtils {
|
|
|
Integer num = 1;
|
|
|
ArrayList<RePatentClaim> patentRights = new ArrayList<>();
|
|
|
Boolean flag = true;
|
|
|
-
|
|
|
+ Integer start = 0;
|
|
|
+ Integer end = 0;
|
|
|
for (int i = 0; i < claimSplitVOS.size(); i++) {
|
|
|
- Integer start = claimSplitVOS.get(i).getPosition();
|
|
|
- Integer end = content.length();
|
|
|
String cont = claimSplitVOS.get(i).getContent();
|
|
|
Matcher matcherNum = Pattern.compile(regexNum).matcher(cont);
|
|
|
-
|
|
|
//查询当前序号
|
|
|
if (matcherNum.find()) {
|
|
|
String a = matcherNum.group();
|
|
|
Integer num2 = Integer.parseInt(a);
|
|
|
- if (num2 != num) {
|
|
|
+ if (num2 == num) {
|
|
|
+ if (num == 1) {
|
|
|
+ start = claimSplitVOS.get(i).getPosition();
|
|
|
+ num++;
|
|
|
+ } else {
|
|
|
+ end = claimSplitVOS.get(i).getPosition();
|
|
|
+ String str = content.substring(start, end);
|
|
|
+ RePatentClaim rePatentClaim = new RePatentClaim();
|
|
|
+ rePatentClaim.setSort(num - 2);
|
|
|
+ rePatentClaim.setContent(str);
|
|
|
+ patentRights.add(rePatentClaim);
|
|
|
+ start = claimSplitVOS.get(i).getPosition();
|
|
|
+ num++;
|
|
|
+
|
|
|
+ //最后一个的处理逻辑
|
|
|
+ if(i+1==claimSplitVOS.size()){
|
|
|
+ end=content.length();
|
|
|
+ String str1 = content.substring(start, end);
|
|
|
+ RePatentClaim rePatentClaim1 = new RePatentClaim();
|
|
|
+ rePatentClaim1.setSort(num - 1);
|
|
|
+ rePatentClaim1.setContent(str1);
|
|
|
+ patentRights.add(rePatentClaim1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
if (i == 0 && num2.equals(2)) {
|
|
|
- String str = content.substring(0, start);
|
|
|
+ end =claimSplitVOS.get(i).getPosition();
|
|
|
+ String str = content.substring(0, end);
|
|
|
RePatentClaim rePatentClaim = new RePatentClaim();
|
|
|
rePatentClaim.setSort(num - 1);
|
|
|
rePatentClaim.setContent(str);
|
|
|
patentRights.add(rePatentClaim);
|
|
|
- num++;
|
|
|
- } else {
|
|
|
- flag = false;
|
|
|
- break;
|
|
|
+ start =claimSplitVOS.get(i).getPosition();
|
|
|
+ num+=2;
|
|
|
}
|
|
|
+ continue;
|
|
|
}
|
|
|
- if (i + 1 < claimSplitVOS.size()) {
|
|
|
- end = claimSplitVOS.get(i + 1).getPosition();
|
|
|
- }
|
|
|
- String str = content.substring(start, end);
|
|
|
- RePatentClaim rePatentClaim = new RePatentClaim();
|
|
|
- rePatentClaim.setSort(num - 1);
|
|
|
- rePatentClaim.setContent(str);
|
|
|
- patentRights.add(rePatentClaim);
|
|
|
- num++;
|
|
|
+
|
|
|
} else {
|
|
|
flag = false;
|
|
|
break;
|