|
@@ -1,6 +1,7 @@
|
|
package org.algorithm.core;
|
|
package org.algorithm.core;
|
|
|
|
|
|
import org.algorithm.core.cnn.entity.Lemma;
|
|
import org.algorithm.core.cnn.entity.Lemma;
|
|
|
|
+import org.algorithm.core.cnn.entity.RelationTreeInfo;
|
|
import org.algorithm.core.cnn.entity.Triad;
|
|
import org.algorithm.core.cnn.entity.Triad;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -79,7 +80,7 @@ public class RelationTreeUtils {
|
|
* @param projectName 项目名称,如:核磁共振
|
|
* @param projectName 项目名称,如:核磁共振
|
|
* @param triads 有关系,并且设置了父子节点关系的三元组
|
|
* @param triads 有关系,并且设置了父子节点关系的三元组
|
|
*/
|
|
*/
|
|
- public static Object[] getRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
|
|
|
|
+ public static RelationTreeInfo getRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
List<Lemma> hasNoChildrenLemmas = new ArrayList<>();
|
|
List<Lemma> hasNoChildrenLemmas = new ArrayList<>();
|
|
for (Triad triad : triads) {
|
|
for (Triad triad : triads) {
|
|
if (!triad.getL_1().isHasChildren())
|
|
if (!triad.getL_1().isHasChildren())
|
|
@@ -99,9 +100,11 @@ public class RelationTreeUtils {
|
|
branches.addAll(permute(aBranch)); // 排列
|
|
branches.addAll(permute(aBranch)); // 排列
|
|
}
|
|
}
|
|
|
|
|
|
- Object[] obj = {projectName, branches};
|
|
|
|
|
|
+ RelationTreeInfo info = new RelationTreeInfo();
|
|
|
|
+ info.setBranches(branches);
|
|
|
|
+ info.setProjectName(projectName);
|
|
|
|
|
|
- return obj;
|
|
|
|
|
|
+ return info;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -111,11 +114,11 @@ public class RelationTreeUtils {
|
|
* @param triads
|
|
* @param triads
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public static Object[] triadsToRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
|
|
|
|
+ public static RelationTreeInfo triadsToRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
sameTextLemmaMerge(triads);
|
|
sameTextLemmaMerge(triads);
|
|
buildRelationTree(triads);
|
|
buildRelationTree(triads);
|
|
- Object[] obj = getRelationTreeBranches("胃造影", triads);
|
|
|
|
- return obj;
|
|
|
|
|
|
+ RelationTreeInfo info = getRelationTreeBranches("胃造影", triads);
|
|
|
|
+ return info;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -202,10 +205,10 @@ public class RelationTreeUtils {
|
|
|
|
|
|
sameTextLemmaMerge(triads);
|
|
sameTextLemmaMerge(triads);
|
|
buildRelationTree(triads);
|
|
buildRelationTree(triads);
|
|
- Object[] obj = getRelationTreeBranches("胃造影", triads);
|
|
|
|
|
|
+ RelationTreeInfo info = getRelationTreeBranches("胃造影", triads);
|
|
|
|
|
|
- System.out.println(obj[0]);
|
|
|
|
- System.out.println(obj[1]);
|
|
|
|
|
|
+ System.out.println(info.getProjectName());
|
|
|
|
+ System.out.println(info.getBranches());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|