|
@@ -1,7 +1,6 @@
|
|
|
package org.algorithm.core;
|
|
|
|
|
|
import org.algorithm.core.cnn.entity.Lemma;
|
|
|
-import org.algorithm.core.cnn.entity.RelationTreeInfo;
|
|
|
import org.algorithm.core.cnn.entity.Triad;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -77,10 +76,9 @@ public class RelationTreeUtils {
|
|
|
/**
|
|
|
* 获取关系树的分枝
|
|
|
*
|
|
|
- * @param projectName 项目名称,如:核磁共振
|
|
|
* @param triads 有关系,并且设置了父子节点关系的三元组
|
|
|
*/
|
|
|
- public static RelationTreeInfo getRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
|
+ public static List<List<String>> getRelationTreeBranches(List<Triad> triads) {
|
|
|
List<Lemma> hasNoChildrenLemmas = new ArrayList<>();
|
|
|
for (Triad triad : triads) {
|
|
|
if (!triad.getL_1().isHasChildren())
|
|
@@ -100,25 +98,20 @@ public class RelationTreeUtils {
|
|
|
branches.addAll(permute(aBranch)); // 排列
|
|
|
}
|
|
|
|
|
|
- RelationTreeInfo info = new RelationTreeInfo();
|
|
|
- info.setBranches(branches);
|
|
|
- info.setProjectName(projectName);
|
|
|
|
|
|
- return info;
|
|
|
+ return branches;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 从三元组列表到关系树分枝
|
|
|
*
|
|
|
- * @param projectName
|
|
|
* @param triads
|
|
|
* @return
|
|
|
*/
|
|
|
- public static RelationTreeInfo triadsToRelationTreeBranches(String projectName, List<Triad> triads) {
|
|
|
+ public static List<List<String>> triadsToRelationTreeBranches(List<Triad> triads) {
|
|
|
sameTextLemmaMerge(triads);
|
|
|
buildRelationTree(triads);
|
|
|
- RelationTreeInfo info = getRelationTreeBranches("胃造影", triads);
|
|
|
- return info;
|
|
|
+ return getRelationTreeBranches(triads);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -205,10 +198,9 @@ public class RelationTreeUtils {
|
|
|
|
|
|
sameTextLemmaMerge(triads);
|
|
|
buildRelationTree(triads);
|
|
|
- RelationTreeInfo info = getRelationTreeBranches("胃造影", triads);
|
|
|
+ List<List<String>> info = getRelationTreeBranches(triads);
|
|
|
|
|
|
- System.out.println(info.getProjectName());
|
|
|
- System.out.println(info.getBranches());
|
|
|
+ System.out.println(info);
|
|
|
}
|
|
|
|
|
|
}
|