瀏覽代碼

更新分词显示效果,更新对程度的处理

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

+ 19 - 17
nlp/src/main/java/org/diagbot/nlp/relation/analyze/StructureAnalyze.java

@@ -282,16 +282,16 @@ public class StructureAnalyze {
                         ((Pacs) current).setBodypart(((Pacs)current).getBodypart()+lexeme.getText());
                         updated = true;
                     }
-                    else if (current instanceof Symptom) {
-                        PD pd = new PD();
-                        pd.setValue(lexeme.getText());
-                        pd.setUnit("");
-                        if (((Symptom)current).getPds() == null) {
-                            ((Symptom)current).setPds(new ArrayList<>());
-                        }
-                        ((Symptom)current).getPds().add(pd);
-                        updated = true;
-                    }
+//                    else if (current instanceof Symptom) {
+//                        PD pd = new PD();
+//                        pd.setValue(lexeme.getText());
+//                        pd.setUnit("");
+//                        if (((Symptom)current).getPds() == null) {
+//                            ((Symptom)current).setPds(new ArrayList<>());
+//                        }
+//                        ((Symptom)current).getPds().add(pd);
+//                        updated = true;
+//                    }
                     else {
                         direct = lexeme.getText();
                     }
@@ -611,22 +611,24 @@ public class StructureAnalyze {
                 Degree degree = new Degree();
                 degree.setDegreeName(name);
 
-//                if (current instanceof Symptom) {
+                if (current instanceof Vital) {
+                    ((Vital)current).setDegree(degree);
+                    obj = current;
 //                    symptom = (Symptom)current;
 //                }
 //                else {
-                    symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
-//                }
+//                    symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
+                }
 
-                if (symptom.getDegree() != null) {
+                else if (symptom.getDegree() != null) {
                     if (!outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).getSymptomName().equals(symptom.getSymptomName())) {
                         outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1).setSymptomName(symptom.getSymptomName());
                         symptom = outputInfo.getSymptoms().get(outputInfo.getSymptoms().size() - 1);
                     }
-                }
-                symptom.setDegree(degree);
+                    symptom.setDegree(degree);
 
-                obj = symptom;
+                    obj = symptom;
+                }
                 break;
             case Constants.word_property_prop:
                 Property property = new Property();