Quellcode durchsuchen

关系抽取算法对接方法定义

louhr vor 6 Jahren
Ursprung
Commit
20d4938012

+ 1 - 1
algorithm/src/main/java/org/algorithm/core/cnn/AlgorithmCNNExecutor.java

@@ -13,7 +13,7 @@ import java.util.List;
  * @Version 1.0
  **/
 public class AlgorithmCNNExecutor {
-    public List<Triad> execute(String content) {
+    public List<Triad> execute(String content, String json_content) {
         List<Triad> triads = new ArrayList<>();
         triads.add(new Triad());
         return triads;

+ 5 - 3
nlp/src/main/java/org/diagbot/nlp/relation/RelationAnalyze.java

@@ -1,5 +1,6 @@
 package org.diagbot.nlp.relation;
 
+import com.alibaba.fastjson.JSON;
 import org.algorithm.core.cnn.AlgorithmCNNExecutor;
 import org.algorithm.core.cnn.model.Triad;
 import org.diagbot.nlp.feature.FeatureType;
@@ -18,9 +19,10 @@ import java.util.List;
  **/
 public class RelationAnalyze {
     public void analyze(String content, FeatureType featureType) throws Exception {
-        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content);
-
+        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content, true);
         AlgorithmCNNExecutor executor = new AlgorithmCNNExecutor();
-        List<Triad> triads = executor.execute(content);
+
+        String json_content = JSON.toJSONString(lexemes);
+        List<Triad> triads = executor.execute(content, json_content);
     }
 }