|
@@ -53,7 +53,7 @@ public class PatentRightUtils {
|
|
|
contentOut = contentOut.replaceAll(" +", "");
|
|
|
|
|
|
//中日韩专利↓
|
|
|
- if (country.equals("CN") || country.equals("JP") || country.equals("KR")) {
|
|
|
+ if (country.equals("CN") || country.equals("JP") || country.equals("KR") || content.contains("权利要求")) {
|
|
|
String regex;
|
|
|
if (content.contains("。2.")) {
|
|
|
regex = "。[0-9]+\\.";
|
|
@@ -68,33 +68,40 @@ public class PatentRightUtils {
|
|
|
} else {
|
|
|
regex = "";
|
|
|
}
|
|
|
- Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
- Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
|
|
|
- while (matcher.find()) {
|
|
|
- if (matcher.group().contains(".청구항")) {
|
|
|
- //".청구항 2" -> "\\.청구항 2"
|
|
|
- String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
- //".청구항 2" -> ".\n청구항 2"
|
|
|
- content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1));
|
|
|
- } else if (matcher.group().contains(".")) {
|
|
|
- //"。2." -> "。2\\."
|
|
|
- String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
- //"。2." -> "。\n2."
|
|
|
- content = content.replaceFirst(matcherGroup, "。\n" + matcherGroup.substring(matcherGroup.indexOf("。") + 1, matcherGroup.indexOf("\\")) + ".");
|
|
|
- } else if (matcher.group().contains("、") || matcher.group().contains("請求項")) {
|
|
|
- content = content.replaceFirst(matcher.group(), "。\n" + matcher.group().substring(matcher.group().indexOf("。") + 1));
|
|
|
+ String[] strs;
|
|
|
+ String[] strsOut;
|
|
|
+ if (regex.equals("")) {
|
|
|
+ strs = content.split("。");
|
|
|
+ strsOut = contentOut.split("。");
|
|
|
+ } else {
|
|
|
+ Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+ Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
|
|
|
+ while (matcher.find()) {
|
|
|
+ if (matcher.group().contains(".청구항")) {
|
|
|
+ //".청구항 2" -> "\\.청구항 2"
|
|
|
+ String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
+ //".청구항 2" -> ".\n청구항 2"
|
|
|
+ content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1));
|
|
|
+ } else if (matcher.group().contains(".")) {
|
|
|
+ //"。2." -> "。2\\."
|
|
|
+ String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
+ //"。2." -> "。\n2."
|
|
|
+ content = content.replaceFirst(matcherGroup, "。\n" + matcherGroup.substring(matcherGroup.indexOf("。") + 1, matcherGroup.indexOf("\\")) + ".");
|
|
|
+ } else if (matcher.group().contains("、") || matcher.group().contains("請求項")) {
|
|
|
+ content = content.replaceFirst(matcher.group(), "。\n" + matcher.group().substring(matcher.group().indexOf("。") + 1));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- String[] strs = content.split("\n");
|
|
|
- while (matcherOut.find()) {
|
|
|
- if (matcherOut.group().contains(".")) {
|
|
|
- String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
- contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
- } else if (matcherOut.group().contains("、")) {
|
|
|
- contentOut = contentOut.replaceFirst(matcherOut.group(), "。\n" + matcherOut.group().substring(matcherOut.group().indexOf("。") + 1));
|
|
|
+ strs = content.split("\n");
|
|
|
+ while (matcherOut.find()) {
|
|
|
+ if (matcherOut.group().contains(".")) {
|
|
|
+ String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
+ contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
+ } else if (matcherOut.group().contains("、")) {
|
|
|
+ contentOut = contentOut.replaceFirst(matcherOut.group(), "。\n" + matcherOut.group().substring(matcherOut.group().indexOf("。") + 1));
|
|
|
+ }
|
|
|
}
|
|
|
+ strsOut = contentOut.split("\n");
|
|
|
}
|
|
|
- String[] strsOut = contentOut.split("\n");
|
|
|
|
|
|
//定义父权要排序号
|
|
|
String regex1 = "权利要求[0-9]+";
|
|
@@ -168,10 +175,9 @@ public class PatentRightUtils {
|
|
|
//英文专利的权要拆分 ↓
|
|
|
} else {
|
|
|
content = content.substring(content.indexOf("1."));
|
|
|
- if(contentOut.equals("")){
|
|
|
- contentOut="";
|
|
|
- }
|
|
|
- else if (contentOut.contains("1.")) {
|
|
|
+ if (contentOut.equals("")) {
|
|
|
+ contentOut = "";
|
|
|
+ } else if (contentOut.contains("1.")) {
|
|
|
contentOut = contentOut.substring(contentOut.indexOf("1."));
|
|
|
} else {
|
|
|
contentOut = contentOut.substring(contentOut.indexOf("1、"));
|