瀏覽代碼

更新分词准确性

MarkHuang 6 年之前
父節點
當前提交
aa32f72ed1
共有 1 個文件被更改,包括 20 次插入7 次删除
  1. 20 7
      nlp/src/main/java/org/diagbot/nlp/relation/analyze/StructureAnalyze.java

+ 20 - 7
nlp/src/main/java/org/diagbot/nlp/relation/analyze/StructureAnalyze.java

@@ -38,6 +38,7 @@ public class StructureAnalyze {
     private static String current_diag = "";
     private static BodyPart bodyPart = null;
     private static Negative negative = null;
+    private static String direct = "";
     private static String num = "";
     private static String pacs_content = "";
     private static List<String> diag_con = Arrays.asList("门诊","诊断","入院","拟");
@@ -121,6 +122,9 @@ public class StructureAnalyze {
         }
 
         bodyPart = null;
+        direct = "";
+        negative = null;
+
         if (pacs_content.length() > 0) {
             current = outputInfo.getPacses().get(outputInfo.getPacses().size()-1);
             String[] arr = pacs_content.split(colon);
@@ -288,11 +292,14 @@ public class StructureAnalyze {
                         ((Symptom)current).getPds().add(pd);
                         updated = true;
                     }
+                    else {
+                        direct = lexeme.getText();
+                    }
                     break;
                 case Constants.word_property_neg:
                     negative = new Negative();
                     negative.setNegaName(lexeme.getText());
-//                    symptom.setNegative(negative);
+
                     updated = true;
                     break;
                 case Constants.word_property_timestamp:
@@ -509,6 +516,17 @@ public class StructureAnalyze {
                     negative = null;
                 }
 
+                if (direct.length() > 0) {
+                    if (symptom.getPds() == null) {
+                        symptom.setPds(new ArrayList());
+                        symptom.getPds().add(new PD());
+                    }
+                    PD pd = symptom.getPds().get(symptom.getPds().size()-1);
+                    pd.setValue(direct);
+                    pd.setUnit("");
+                    direct = "";
+                }
+
                 obj = symptom;
                 break;
             case Constants.word_property_vital_idx:
@@ -619,12 +637,7 @@ public class StructureAnalyze {
                     negative = null;
                 }
 
-//                if (current instanceof Symptom) {
-//                    symptom = (Symptom)current;
-//                }
-//                else {
-                    symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
-//                }
+                symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
 
                 if (symptom.getProperty() != null) {
                     if (!outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).getSymptomName().equals(symptom.getSymptomName())) {