|
@@ -73,6 +73,7 @@ public class GenerateInstructionService {
|
|
|
|
|
|
|
|
|
public String getClaimContent(String claim) {
|
|
|
+ claim= claim.replaceAll("所述","");
|
|
|
// 正则表达式模式(注意 Java 中需要双反斜杠转义)
|
|
|
String regex = "其特征在于[,。;!?、]+(.+)";
|
|
|
Pattern pattern = Pattern.compile(regex);
|
|
@@ -81,22 +82,18 @@ public class GenerateInstructionService {
|
|
|
// 提取第一个捕获组的内容(即括号内的部分)
|
|
|
return matcher.group(1).trim();
|
|
|
}
|
|
|
- return "其中," + claim; // 未找到匹配时返回空字符串
|
|
|
+
|
|
|
+ return claim; // 未找到匹配时返回空字符串
|
|
|
|
|
|
}
|
|
|
|
|
|
public String getMainClaimContent(String claim) {
|
|
|
+ claim= claim.replaceAll("所述","");
|
|
|
// 正则表达式模式(注意 Java 中需要双反斜杠转义)
|
|
|
-// String regex1 = "^[0-9]+\\.";
|
|
|
-// String regex2 = "^\\[[0-9]+]";
|
|
|
-// String regex3 = "^[0-9]+、";
|
|
|
-// String outPut1 = claim.replaceAll(regex1, "");
|
|
|
-// String outPut2 = outPut1.replaceAll(regex2, "");
|
|
|
-// String outPut3 =outPut2.replaceAll(regex3,"");
|
|
|
- String combinedRegex = "^(\\d+[.、]|\\[[0-9]+])";
|
|
|
- String output = claim.replaceAll(combinedRegex, "").replaceAll("[\\n\\r]+$", "");
|
|
|
+ claim= claim.replaceAll("^(\\d+[.、]|\\[[0-9]+])","");
|
|
|
+ claim =claim.replaceAll("其特征在于[,。;!?、]","");
|
|
|
+ return claim; // 未找到匹配时返回空字符串
|
|
|
|
|
|
- return output; // 未找到匹配时返回空字符串
|
|
|
|
|
|
}
|
|
|
public String getClaimText(String claim) {
|
|
@@ -317,12 +314,13 @@ public class GenerateInstructionService {
|
|
|
|
|
|
|
|
|
for (int i = 0; i < rePatentClaims.size(); i++) {
|
|
|
+ RePatentClaim rePatentClaim = rePatentClaims.get(i);
|
|
|
ClaimExplainVO claimExplainVO = null;
|
|
|
if (i == 0) {
|
|
|
claimExplainVO = firstClaimExplainVO;
|
|
|
} else {
|
|
|
try {
|
|
|
- RePatentClaim rePatentClaim = rePatentClaims.get(i);
|
|
|
+
|
|
|
String claimContent = rePatentClaim.getContent();
|
|
|
GenerateInstructAnswerVO generateInstructAnswerVO = this.getAnswerFromAI(claimContent, background, i, "g&implementation", conversationId);
|
|
|
String answer = generateInstructAnswerVO.getAnswer();
|
|
@@ -340,7 +338,7 @@ public class GenerateInstructionService {
|
|
|
String message = "";
|
|
|
String reStr = null;
|
|
|
if (claimExplainVO != null) {
|
|
|
- List<String> contents = this.formatImplementation(claimExplainVO);
|
|
|
+ List<String> contents = this.formatImplementation(claimExplainVO,rePatentClaim);
|
|
|
if(contents.size()>0){
|
|
|
reContents.addAll(contents);
|
|
|
reStr = StringUtils.join(contents, "\n");
|
|
@@ -370,14 +368,20 @@ public class GenerateInstructionService {
|
|
|
* @param claimExplainVO
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<String> formatImplementation(ClaimExplainVO claimExplainVO) {
|
|
|
+ private List<String> formatImplementation(ClaimExplainVO claimExplainVO,RePatentClaim rePatentClaim) {
|
|
|
String reStr = null;
|
|
|
List<String> contents = new ArrayList<>();
|
|
|
String explainVOClaim = claimExplainVO.getClaim();
|
|
|
String effect = claimExplainVO.getEffects();
|
|
|
String explain = claimExplainVO.getExplain();
|
|
|
if (explainVOClaim != null && !explainVOClaim.trim().equals("")) {
|
|
|
- String tem= this.getClaimText(explainVOClaim);
|
|
|
+ String tem="";
|
|
|
+ if (rePatentClaim != null && rePatentClaim.getType() != null && rePatentClaim.getType().equals(1)) {
|
|
|
+ tem = this.getMainClaimContent(rePatentClaim.getContent());
|
|
|
+ } else {
|
|
|
+ tem = "在一实施方式中,"+this.getClaimContent(rePatentClaim.getContent());
|
|
|
+ }
|
|
|
+
|
|
|
contents.add(tem);
|
|
|
}
|
|
|
if (effect != null && !effect.trim().equals("")) {
|
|
@@ -457,9 +461,9 @@ public class GenerateInstructionService {
|
|
|
String claimContent = rePatentClaim.getContent();
|
|
|
String temContent = "";
|
|
|
if (rePatentClaim != null && rePatentClaim.getType() != null && rePatentClaim.getType().equals(1)) {
|
|
|
- temContent = "为解决上述问题,本申请提出"+ this.getClaimText(claimContent);
|
|
|
+ temContent = this.getMainClaimContent(claimContent);
|
|
|
} else {
|
|
|
- temContent = this.getClaimContent(claimContent);
|
|
|
+ temContent = "其中,"+this.getClaimContent(claimContent);
|
|
|
}
|
|
|
contentStrs.add(temContent);
|
|
|
}
|