|
@@ -236,6 +236,28 @@ public final class ReportParseUtils {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 分级基金名称
|
|
|
+ *
|
|
|
+ * @param text 文本内容
|
|
|
+ * @return /
|
|
|
+ */
|
|
|
+ public static String matchFundLevel(String text) {
|
|
|
+ // 使用正则表达式查找匹配项
|
|
|
+ Pattern pattern = Pattern.compile("[A-F]级|基金[A-F]");
|
|
|
+ Matcher matcher = pattern.matcher(text);
|
|
|
+ String result = null;
|
|
|
+ while (matcher.find()) {
|
|
|
+ result = matcher.group();
|
|
|
+ }
|
|
|
+ if (StrUtil.isBlank(result)) {
|
|
|
+ result = "母基金";
|
|
|
+ } else {
|
|
|
+ result = result.replaceAll("[^A-F]", "") + "级";
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 匹配报告日期
|
|
|
*
|
|
|
* @param string 文本内容
|
|
@@ -303,10 +325,10 @@ public final class ReportParseUtils {
|
|
|
reportType = ReportType.ANNUALLY;
|
|
|
} else if (StrUtil.containsAny(string, ReportType.MONTHLY.getPatterns())) {
|
|
|
reportType = ReportType.MONTHLY;
|
|
|
-// } else if (StrUtil.containsAny(string, ReportType.WEEKLY.getPatterns())) {
|
|
|
-// reportType = ReportType.WEEKLY;
|
|
|
} else if (StrUtil.containsAny(string, ReportType.LETTER.getPatterns())) {
|
|
|
reportType = ReportType.LETTER;
|
|
|
+ } else if (StrUtil.containsAny(string, ReportType.OTHER.getPatterns())) {
|
|
|
+ reportType = ReportType.OTHER;
|
|
|
}
|
|
|
return reportType;
|
|
|
}
|
|
@@ -322,65 +344,6 @@ public final class ReportParseUtils {
|
|
|
return String.format("%02d", Integer.parseInt(number));
|
|
|
}
|
|
|
|
|
|
-// public static GenerationResult callWithMessage() throws ApiException, NoApiKeyException, InputRequiredException {
|
|
|
-// Generation gen = new Generation();
|
|
|
-// Message systemMsg = Message.builder()
|
|
|
-// .role(Role.SYSTEM.getValue())
|
|
|
-// .content("You are a helpful assistant.")
|
|
|
-// .build();
|
|
|
-// Message userMsg = Message.builder()
|
|
|
-// .role(Role.USER.getValue())
|
|
|
-// .content("你是谁?")
|
|
|
-// .build();
|
|
|
-// GenerationParam param = GenerationParam.builder()
|
|
|
-// // 若没有配置环境变量,请用百炼API Key将下行替换为:.apiKey("sk-xxx")
|
|
|
-// .apiKey(System.getenv("DASHSCOPE_API_KEY"))
|
|
|
-// // 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
|
|
|
-// .model("qwen-plus")
|
|
|
-// .messages(Arrays.asList(systemMsg, userMsg))
|
|
|
-// .resultFormat(GenerationParam.ResultFormat.MESSAGE)
|
|
|
-// .build();
|
|
|
-// return gen.call(param);
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void simpleMultiModalConversationCall()
|
|
|
-// throws ApiException, NoApiKeyException, UploadFileException {
|
|
|
-// MultiModalConversation conv = new MultiModalConversation();
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
-// map.put("image", "./流水1.jpg");
|
|
|
-// map.put("max_pixels", "1003520");
|
|
|
-// map.put("min_pixels", "3136");
|
|
|
-// MultiModalMessage userMessage = MultiModalMessage.builder().role(Role.USER.getValue())
|
|
|
-// .content(Arrays.asList(
|
|
|
-// map,
|
|
|
-// // 目前为保证模型效果,模型内部会统一使用"Read all the text in the image."作为text的值,用户输入的文本不会生效。
|
|
|
-// Collections.singletonMap("text", "Read all the text in the image."))).build();
|
|
|
-// MultiModalConversationParam param = MultiModalConversationParam.builder()
|
|
|
-// // 若没有配置环境变量,请用百炼API Key将下行替换为:.apiKey("sk-xxx")
|
|
|
-// .apiKey(System.getenv("DASHSCOPE_API_KEY"))
|
|
|
-// // 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
|
|
|
-// .model("qwen-vl-ocr")
|
|
|
-// .message(userMessage)
|
|
|
-// .build();
|
|
|
-// MultiModalConversationResult result = conv.call(param);
|
|
|
-// System.out.println(JsonUtils.toJson(result));
|
|
|
-// }
|
|
|
-//
|
|
|
-// public static void main(String[] args) throws IOException {
|
|
|
-//// try {
|
|
|
-//// GenerationResult result = callWithMessage();
|
|
|
-//// System.out.println(result.getOutput().getChoices().get(0).getMessage().getContent());
|
|
|
-//// } catch (ApiException | NoApiKeyException | InputRequiredException e) {
|
|
|
-//// System.err.println("错误信息:"+e.getMessage());
|
|
|
-//// System.out.println("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code");
|
|
|
-//// }
|
|
|
-// try {
|
|
|
-// simpleMultiModalConversationCall();
|
|
|
-// } catch (ApiException | NoApiKeyException | UploadFileException e) {
|
|
|
-// System.out.println(e.getMessage());
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
public static void main(String[] args) throws IOException, ReportParseException {
|
|
|
// String filepath = "C:\\Users\\Administrator\\Desktop\\tmp\\(1)投资者交易确认函【申购】_【SZF635】佳岳国债增强私募证券投资基金_20250217_任军.pdf";
|
|
|
// String filepath = "C:\\Users\\Administrator\\Desktop\\tmp\\CP080A_优美利赢胜价值1号私募投资基金A_20250217_邓辉_申购确认_20250217131352.pdf";
|