|
|
|
@ -1,23 +1,23 @@
|
|
|
|
|
package com.supervision.pdfqaserver;
|
|
|
|
|
|
|
|
|
|
import com.supervision.pdfqaserver.constant.DocumentContentTypeEnum;
|
|
|
|
|
import com.supervision.pdfqaserver.domain.PdfAnalysisOutput;
|
|
|
|
|
import com.supervision.pdfqaserver.dto.CypherSchemaDTO;
|
|
|
|
|
import com.supervision.pdfqaserver.dto.EREDTO;
|
|
|
|
|
import com.supervision.pdfqaserver.dto.IntentDTO;
|
|
|
|
|
import com.supervision.pdfqaserver.dto.TruncateDTO;
|
|
|
|
|
import com.supervision.pdfqaserver.service.ChinesEsToEnglishGenerator;
|
|
|
|
|
import com.supervision.pdfqaserver.service.KnowledgeGraphService;
|
|
|
|
|
import com.supervision.pdfqaserver.service.TripleConversionPipeline;
|
|
|
|
|
import com.supervision.pdfqaserver.service.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.neo4j.driver.*;
|
|
|
|
|
import org.neo4j.driver.Record;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import static org.neo4j.driver.Values.parameters;
|
|
|
|
|
import org.commonmark.node.*;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@SpringBootTest
|
|
|
|
@ -27,15 +27,15 @@ class PdfQaServerApplicationTests {
|
|
|
|
|
private KnowledgeGraphService knowledgeGraphService;
|
|
|
|
|
@Test
|
|
|
|
|
void generateGraphTest() {
|
|
|
|
|
knowledgeGraphService.generateGraph("40");
|
|
|
|
|
knowledgeGraphService.generateGraph("15");
|
|
|
|
|
log.info("finish...");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void testGenerateGraph2() {
|
|
|
|
|
List<EREDTO> eredtos = knowledgeGraphService.listPdfEREDTO("17");
|
|
|
|
|
List<EREDTO> eredtos = knowledgeGraphService.listPdfEREDTO("16");
|
|
|
|
|
|
|
|
|
|
knowledgeGraphService.generateGraph(eredtos);
|
|
|
|
|
knowledgeGraphService.generateGraphSimple(eredtos);
|
|
|
|
|
log.info("finish...");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -160,8 +160,54 @@ class PdfQaServerApplicationTests {
|
|
|
|
|
@Test
|
|
|
|
|
void generateGraphBaseTrainTest() {
|
|
|
|
|
|
|
|
|
|
knowledgeGraphService.generateGraphBaseTrain(14);
|
|
|
|
|
knowledgeGraphService.generateGraphBaseTrain(15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AiCallService aiCallService;
|
|
|
|
|
@Test
|
|
|
|
|
void aiCallServiceCallTest() {
|
|
|
|
|
|
|
|
|
|
String call = aiCallService.call("你好");
|
|
|
|
|
System.out.println(call);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void resetGraphDataTest() {
|
|
|
|
|
knowledgeGraphService.resetGraphData("15");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PdfAnalysisOutputService pdfAnalysisOutputService;
|
|
|
|
|
@Test
|
|
|
|
|
void queryGraphTest() {
|
|
|
|
|
List<PdfAnalysisOutput> pdfAnalysisOutputs = pdfAnalysisOutputService.queryByPdfId(15);
|
|
|
|
|
List<PdfAnalysisOutput> newPdfAnalysisOutputs = new ArrayList<>();
|
|
|
|
|
for (PdfAnalysisOutput pdfAnalysisOutput : pdfAnalysisOutputs) {
|
|
|
|
|
PdfAnalysisOutput pdf = new PdfAnalysisOutput();
|
|
|
|
|
pdf.setContent(pdfAnalysisOutput.getContent());
|
|
|
|
|
pdf.setPageNo(pdfAnalysisOutput.getPageNo());
|
|
|
|
|
pdf.setDisplayOrder(pdfAnalysisOutput.getDisplayOrder());
|
|
|
|
|
pdf.setTableTitle(pdfAnalysisOutput.getTableTitle());
|
|
|
|
|
pdf.setLayoutType(pdfAnalysisOutput.getLayoutType());
|
|
|
|
|
pdf.setPdfId(16);
|
|
|
|
|
newPdfAnalysisOutputs.add(pdf);
|
|
|
|
|
}
|
|
|
|
|
pdfAnalysisOutputService.saveBatch(newPdfAnalysisOutputs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TripleToCypherExecutor tripleToCypherExecutor;
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryGraph() {
|
|
|
|
|
CypherSchemaDTO schemaDTO = tripleToCypherExecutor.loadGraphSchema();
|
|
|
|
|
System.out.println(schemaDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryGraph2() {
|
|
|
|
|
aiCallService.embedding("");
|
|
|
|
|
System.out.println("done");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|