|
@@ -44,6 +44,7 @@ public class PatentRightUtils {
|
|
|
if (content.contains("\r\n")) {
|
|
|
content = content.replaceAll("\r\n", "@");
|
|
|
}
|
|
|
+
|
|
|
if (content.contains("\n")) {
|
|
|
content = content.replaceAll("\n", "@");
|
|
|
}
|
|
@@ -51,212 +52,15 @@ public class PatentRightUtils {
|
|
|
|
|
|
//中日韩权要↓
|
|
|
if (country.equals("CN") || country.equals("JP") || country.equals("KR") || content.contains("权利要求")) {
|
|
|
- String regex;
|
|
|
- if (content.contains("@2")) {
|
|
|
- regex = "@[0-9]+";
|
|
|
- } else if (content.contains("@[00")) {
|
|
|
- regex = "@\\[[0-9]+]";
|
|
|
- } else if (content.contains("@請求項")) {
|
|
|
- regex = "@【請求項[0-9]+】";
|
|
|
- } else if (content.contains("@청구항")) {
|
|
|
- regex = "@청구항 [0-9]+";
|
|
|
- } else {
|
|
|
- regex = "";
|
|
|
- }
|
|
|
- String[] strs; //原文数组
|
|
|
- //若以上没有匹配到,则权要直接以句号 "。" 拆分
|
|
|
- if (regex.equals("")) {
|
|
|
- content = content.replaceAll("@", "");
|
|
|
- strs = content.split("(?<=。)");
|
|
|
- //若匹配到,则根据不同情形拆分
|
|
|
- } else {
|
|
|
- Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
- while (matcher.find()) {
|
|
|
- content = content.replaceFirst(matcher.group(), "\n" + matcher.group().substring(matcher.group().indexOf("@") + 1));
|
|
|
- }
|
|
|
-
|
|
|
- content = content.replaceAll("@", "");
|
|
|
- strs = content.split("\n");
|
|
|
- }
|
|
|
- //定义父权要排序号
|
|
|
- String regex1 = "权利要求[0-9]+";
|
|
|
- String regex2 = "权利要求[0-9]+[至或~-]+[0-9]+";
|
|
|
- for (int i = 0; i < strs.length; i++) {
|
|
|
- //之前:if (strs[i].contains("权利要求")) {
|
|
|
- //现在:if(该权要有逗号,并且它第一句话中有"权利要求"4个字 || 该权要没有逗号,并且它有"权利要求"4个字) {
|
|
|
- if ((strs[i].contains(",") && strs[i].substring(0, strs[i].indexOf(",")).contains("权利要求")) || (!strs[i].contains(",") && strs[i].contains("权利要求"))) {
|
|
|
- Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
- Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
- if (matcher2.find()) {
|
|
|
- String parentNum = matcher2.group().substring(matcher2.group().indexOf("求") + 1);
|
|
|
- String[] parentNums;
|
|
|
- if (parentNum.contains("~")) {
|
|
|
- parentNums = parentNum.split("~");
|
|
|
- } else if (parentNum.contains("-")) {
|
|
|
- parentNums = parentNum.split("-");
|
|
|
- } else if (parentNum.contains("至")) {
|
|
|
- parentNums = parentNum.split("至");
|
|
|
- } else if (parentNum.contains("或")) {
|
|
|
- parentNums = parentNum.split("或");
|
|
|
- } else {
|
|
|
- parentNums = new String[0];
|
|
|
- }
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
- if ((builder + "").equals("")) {
|
|
|
- builder.append(j);
|
|
|
- } else {
|
|
|
- builder.append(",").append(j);
|
|
|
- }
|
|
|
- }
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort(builder + "");
|
|
|
-
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else if (matcher1.find()) {
|
|
|
- String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(1)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort("-1");
|
|
|
-
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
- }
|
|
|
+ getChinaRights(content, params.getPatentNo(), patentRights);
|
|
|
//英文专利的权要拆分 ↓
|
|
|
- } else {
|
|
|
- if (!content.equals("") && content.contains("[1]")) {
|
|
|
- content = content.substring(content.indexOf("["));
|
|
|
- } else if (!content.equals("") && content.contains("1")) {
|
|
|
- content = content.substring(content.indexOf("1"));
|
|
|
- }
|
|
|
-
|
|
|
- String regex;
|
|
|
- if (content.contains("@2")) {
|
|
|
- regex = "\\.@[0-9]+";
|
|
|
- } else if (content.contains("[001]") || content.contains("[1]")) {
|
|
|
- regex = "\\[[0-9]+]";
|
|
|
- } else {
|
|
|
- regex = "";
|
|
|
- }
|
|
|
-
|
|
|
- Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
-
|
|
|
- while (matcher.find()) {
|
|
|
- String splitMe = matcher.group();
|
|
|
- if (splitMe.contains("[")) {
|
|
|
- splitMe = "\\" + splitMe;
|
|
|
- }
|
|
|
- String p = "\n" + splitMe;
|
|
|
- if (splitMe.contains(".")) {
|
|
|
- String t = splitMe.replace(".", "");
|
|
|
- p = "." + "\n" + t;
|
|
|
- }
|
|
|
- content = content.replaceFirst(splitMe, p);
|
|
|
- }
|
|
|
+ }
|
|
|
+ else if(country.equals("FR")){
|
|
|
+ getFRRight(content, params.getPatentNo(), patentRights);
|
|
|
+ }
|
|
|
|
|
|
- content = content.replaceAll("@", "");
|
|
|
- if (content.startsWith("\n")) {
|
|
|
- content = content.replaceFirst("\n", "");
|
|
|
- }
|
|
|
- String[] strs = content.split("\n");
|
|
|
-
|
|
|
- //定义父权要排序号
|
|
|
- String regex1 = "claim [0-9]+";
|
|
|
- String regex2 = "claims [0-9]+ or [0-9]+";
|
|
|
- String regex3 = "any preceding claim";
|
|
|
- String regex5 = "(Anspruch [0-9]+ oder [0-9]+)|(Ansprüche [0-9]+ bis [0-9]+)";
|
|
|
- String regex4 = "Anspruch [0-9]+";
|
|
|
- for (int i = 0; i < strs.length; i++) {
|
|
|
-
|
|
|
- Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
- Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
- Matcher matcher3 = Pattern.compile(regex3).matcher(strs[i]);
|
|
|
- Matcher matcher4 = Pattern.compile(regex4).matcher(strs[i]);
|
|
|
- Matcher matcher5 = Pattern.compile(regex5).matcher(strs[i]);
|
|
|
- Boolean flag1 = matcher1.find();
|
|
|
- Boolean flag2 = matcher2.find();
|
|
|
- Boolean flag3 = matcher3.find();
|
|
|
- Boolean flag4 = matcher4.find();
|
|
|
- Boolean flag5 = matcher5.find();
|
|
|
-
|
|
|
- if (flag2 || flag5) {
|
|
|
- List<String> parentNums = new ArrayList<>();
|
|
|
- if (flag2) {
|
|
|
- parentNums = getNums(matcher2.group());
|
|
|
- } else if (flag5) {
|
|
|
- parentNums = getNums(matcher5.group());
|
|
|
- }
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- for (int j = Integer.parseInt(parentNums.get(0)) - 1; j < Integer.parseInt(parentNums.get(parentNums.size() - 1)); j++) {
|
|
|
- if ((builder + "").equals("")) {
|
|
|
- builder.append(j);
|
|
|
- } else {
|
|
|
- builder.append(",").append(j);
|
|
|
- }
|
|
|
- }
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort(builder + "");
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else if (flag1 || flag4) {
|
|
|
- String parentNum = null;
|
|
|
- if (flag1) {
|
|
|
- parentNum = getNums(matcher1.group()).get(0);
|
|
|
- } else if (flag4) {
|
|
|
- parentNum = getNums(matcher4.group()).get(0);
|
|
|
- }
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else if (flag3) {
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- for (int sort = 0; sort < strs.length; sort++) {
|
|
|
- if (sort == i) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- builder.append(i).append(",");
|
|
|
- }
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort(builder.substring(0, builder.lastIndexOf(",")));
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else {
|
|
|
- RePatentClaim patentRight = new RePatentClaim()
|
|
|
- .setPatentNo(params.getPatentNo())
|
|
|
- .setType(1)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort("-1");
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
- }
|
|
|
+ else {
|
|
|
+ getForeignRights(content, params.getPatentNo(), patentRights);
|
|
|
}
|
|
|
|
|
|
return patentRights;
|
|
@@ -295,4 +99,355 @@ public class PatentRightUtils {
|
|
|
}
|
|
|
return nums;
|
|
|
}
|
|
|
+
|
|
|
+ private static void getChinaRights(String content, String patentNo, ArrayList<RePatentClaim> patentRights) {
|
|
|
+ String regex;
|
|
|
+ if (content.contains("@2")) {
|
|
|
+ regex = "@[0-9]+";
|
|
|
+ } else if (content.contains("@[00")) {
|
|
|
+ regex = "@\\[[0-9]+]";
|
|
|
+ } else if (content.contains("@請求項")) {
|
|
|
+ regex = "@【請求項[0-9]+】";
|
|
|
+ } else if (content.contains("@청구항")) {
|
|
|
+ regex = "@청구항 [0-9]+";
|
|
|
+ } else {
|
|
|
+ regex = "";
|
|
|
+ }
|
|
|
+ String[] strs; //原文数组
|
|
|
+ //若以上没有匹配到,则权要直接以句号 "。" 拆分
|
|
|
+ if (regex.equals("")) {
|
|
|
+ content = content.replaceAll("@", "");
|
|
|
+ strs = content.split("(?<=。)");
|
|
|
+ //若匹配到,则根据不同情形拆分
|
|
|
+ } else {
|
|
|
+ Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+ while (matcher.find()) {
|
|
|
+ content = content.replaceFirst(matcher.group(), "\n" + matcher.group().substring(matcher.group().indexOf("@") + 1));
|
|
|
+ }
|
|
|
+
|
|
|
+ content = content.replaceAll("@", "");
|
|
|
+ strs = content.split("\n");
|
|
|
+ }
|
|
|
+ //定义父权要排序号
|
|
|
+ String regex1 = "权利要求[0-9]+";
|
|
|
+ String regex2 = "权利要求[0-9]+[至或~-]+[0-9]+";
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
+ //之前:if (strs[i].contains("权利要求")) {
|
|
|
+ //现在:if(该权要有逗号,并且它第一句话中有"权利要求"4个字 || 该权要没有逗号,并且它有"权利要求"4个字) {
|
|
|
+ if ((strs[i].contains(",") && strs[i].substring(0, strs[i].indexOf(",")).contains("权利要求")) || (!strs[i].contains(",") && strs[i].contains("权利要求"))) {
|
|
|
+ Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
+ Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
+ if (matcher2.find()) {
|
|
|
+ String parentNum = matcher2.group().substring(matcher2.group().indexOf("求") + 1);
|
|
|
+ String[] parentNums;
|
|
|
+ if (parentNum.contains("~")) {
|
|
|
+ parentNums = parentNum.split("~");
|
|
|
+ } else if (parentNum.contains("-")) {
|
|
|
+ parentNums = parentNum.split("-");
|
|
|
+ } else if (parentNum.contains("至")) {
|
|
|
+ parentNums = parentNum.split("至");
|
|
|
+ } else if (parentNum.contains("或")) {
|
|
|
+ parentNums = parentNum.split("或");
|
|
|
+ } else {
|
|
|
+ parentNums = new String[0];
|
|
|
+ }
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
+ if ((builder + "").equals("")) {
|
|
|
+ builder.append(j);
|
|
|
+ } else {
|
|
|
+ builder.append(",").append(j);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder + "");
|
|
|
+
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (matcher1.find()) {
|
|
|
+ String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(1)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort("-1");
|
|
|
+
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void getForeignRights(String content, String patentNo, ArrayList<RePatentClaim> patentRights) {
|
|
|
+
|
|
|
+ if (!content.equals("") && content.contains("[1]")) {
|
|
|
+ content = content.substring(content.indexOf("["));
|
|
|
+ } else if (!content.equals("") && content.contains("1")) {
|
|
|
+ content = content.substring(content.indexOf("1"));
|
|
|
+ }
|
|
|
+
|
|
|
+ String regex;
|
|
|
+ if (content.contains("@2")) {
|
|
|
+ regex = "\\.@[0-9]+";
|
|
|
+ } else if (content.contains("[001]") || content.contains("[1]")) {
|
|
|
+ regex = "\\[[0-9]+]";
|
|
|
+ } else {
|
|
|
+ regex = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+
|
|
|
+ while (matcher.find()) {
|
|
|
+ String splitMe = matcher.group();
|
|
|
+ if (splitMe.contains("[")) {
|
|
|
+ splitMe = "\\" + splitMe;
|
|
|
+ }
|
|
|
+ String p = "\n" + splitMe;
|
|
|
+ if (splitMe.contains(".")) {
|
|
|
+ String t = splitMe.replace(".", "");
|
|
|
+ p = "." + "\n" + t;
|
|
|
+ }
|
|
|
+ content = content.replaceFirst(splitMe, p);
|
|
|
+ }
|
|
|
+
|
|
|
+ content = content.replaceAll("@", "");
|
|
|
+ if (content.startsWith("\n")) {
|
|
|
+ content = content.replaceFirst("\n", "");
|
|
|
+ }
|
|
|
+ String[] strs = content.split("\n");
|
|
|
+
|
|
|
+ //定义父权要排序号
|
|
|
+ String regex1 = "claim [0-9]+";
|
|
|
+ String regex2 = "claims [0-9]+ or [0-9]+";
|
|
|
+ String regex3 = "any preceding claim";
|
|
|
+ String regex5 = "(Anspruch [0-9]+ oder [0-9]+)|(Ansprüche [0-9]+ bis [0-9]+)";
|
|
|
+ String regex4 = "Anspruch [0-9]+";
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
+
|
|
|
+ Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
+ Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
+ Matcher matcher3 = Pattern.compile(regex3).matcher(strs[i]);
|
|
|
+ Matcher matcher4 = Pattern.compile(regex4).matcher(strs[i]);
|
|
|
+ Matcher matcher5 = Pattern.compile(regex5).matcher(strs[i]);
|
|
|
+ Boolean flag1 = matcher1.find();
|
|
|
+ Boolean flag2 = matcher2.find();
|
|
|
+ Boolean flag3 = matcher3.find();
|
|
|
+ Boolean flag4 = matcher4.find();
|
|
|
+ Boolean flag5 = matcher5.find();
|
|
|
+
|
|
|
+ if (flag2 || flag5) {
|
|
|
+ List<String> parentNums = new ArrayList<>();
|
|
|
+ if (flag2) {
|
|
|
+ parentNums = getNums(matcher2.group());
|
|
|
+ } else if (flag5) {
|
|
|
+ parentNums = getNums(matcher5.group());
|
|
|
+ }
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int j = Integer.parseInt(parentNums.get(0)) - 1; j < Integer.parseInt(parentNums.get(parentNums.size() - 1)); j++) {
|
|
|
+ if ((builder + "").equals("")) {
|
|
|
+ builder.append(j);
|
|
|
+ } else {
|
|
|
+ builder.append(",").append(j);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder + "");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (flag1 || flag4) {
|
|
|
+ String parentNum = null;
|
|
|
+ if (flag1) {
|
|
|
+ parentNum = getNums(matcher1.group()).get(0);
|
|
|
+ } else if (flag4) {
|
|
|
+ parentNum = getNums(matcher4.group()).get(0);
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (flag3) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int sort = 0; sort < strs.length; sort++) {
|
|
|
+ if (sort == i) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ builder.append(i).append(",");
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder.substring(0, builder.lastIndexOf(",")));
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else {
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(1)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort("-1");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static void getFRRight(String content, String patentNo, ArrayList<RePatentClaim> patentRights) {
|
|
|
+
|
|
|
+ if (!content.equals("") && content.contains("[1]")) {
|
|
|
+ content = content.substring(content.indexOf("["));
|
|
|
+ } else if (!content.equals("") && content.contains("1.")) {
|
|
|
+ content = content.substring(content.indexOf("1."));
|
|
|
+ }
|
|
|
+ else if(!content.equals("") && content.contains("[Revendication 1]"))
|
|
|
+ { content = content.substring(content.indexOf("[Revendication 1]"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String regex;
|
|
|
+ if (content.contains("@2")) {
|
|
|
+ regex = "\\.@[0-9]+";
|
|
|
+ } else if (content.contains("[001]") || content.contains("[1]")) {
|
|
|
+ regex = "\\[[0-9]+]";
|
|
|
+ } else if (content.contains("[Revendication 1]")) {
|
|
|
+ regex = "\\[Revendication [0-9]+(]|\\))";
|
|
|
+ } else {
|
|
|
+ regex = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+
|
|
|
+ while (matcher.find()) {
|
|
|
+ String splitMe = matcher.group();
|
|
|
+ if (splitMe.contains("[")) {
|
|
|
+ splitMe = "\\" + splitMe;
|
|
|
+ }
|
|
|
+ if(splitMe.contains(")"))
|
|
|
+ {
|
|
|
+ splitMe= splitMe.replaceFirst("\\)","\\\\)");
|
|
|
+ }
|
|
|
+ String p = "\n" + splitMe;
|
|
|
+ if (splitMe.contains(".")) {
|
|
|
+ String t = splitMe.replace(".", "");
|
|
|
+ p = "." + "\n" + t;
|
|
|
+ }
|
|
|
+ content = content.replaceFirst(splitMe, p);
|
|
|
+ }
|
|
|
+
|
|
|
+ content = content.replaceAll("@", "");
|
|
|
+ if (content.startsWith("\n")) {
|
|
|
+ content = content.replaceFirst("\n", "");
|
|
|
+ }
|
|
|
+ String[] strs = content.split("\n");
|
|
|
+
|
|
|
+ //定义父权要排序号
|
|
|
+ String regex1 = "revendications là [0-9]+";
|
|
|
+ String regex2 = "(revendication [0-9]+ ou [0-9]+)|(revendication [0-9]+ et [0-9]+)";
|
|
|
+ String regex3 = "des revendications précédentes";
|
|
|
+ String regex4 = "revendication précédente";
|
|
|
+
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
+
|
|
|
+ Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
+ Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
+ Matcher matcher3 = Pattern.compile(regex3).matcher(strs[i]);
|
|
|
+ Matcher matcher4 = Pattern.compile(regex4).matcher(strs[i]);
|
|
|
+ Boolean flag1 = matcher1.find();
|
|
|
+ Boolean flag2 = matcher2.find();
|
|
|
+ Boolean flag3 = matcher3.find();
|
|
|
+ Boolean flag4 = matcher4.find();
|
|
|
+
|
|
|
+ if (flag2) {
|
|
|
+ List<String> parentNums = new ArrayList<>();
|
|
|
+ if (flag2) {
|
|
|
+ parentNums = getNums(matcher2.group());
|
|
|
+ }
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int j = Integer.parseInt(parentNums.get(0)) - 1; j < Integer.parseInt(parentNums.get(parentNums.size() - 1)); j++) {
|
|
|
+ if ((builder + "").equals("")) {
|
|
|
+ builder.append(j);
|
|
|
+ } else {
|
|
|
+ builder.append(",").append(j);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder + "");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (flag1 ) {
|
|
|
+ String parentNum = null;
|
|
|
+ if (flag1) {
|
|
|
+ parentNum = getNums(matcher1.group()).get(0);
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (flag3) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ for (int sort = 0; sort < strs.length; sort++) {
|
|
|
+ if (sort == i) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ builder.append(i).append(",");
|
|
|
+ }
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder.substring(0, builder.lastIndexOf(",")));
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else if (flag4) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+
|
|
|
+ builder.append(i - 1);
|
|
|
+
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(0)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort(builder.toString());
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ } else {
|
|
|
+ RePatentClaim patentRight = new RePatentClaim()
|
|
|
+ .setPatentNo(patentNo)
|
|
|
+ .setType(1)
|
|
|
+ .setContent(strs[i])
|
|
|
+ .setSort(i)
|
|
|
+ .setParentSort("-1");
|
|
|
+ patentRights.add(patentRight);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|