Package smile.taxonomy
Class Taxonomy
java.lang.Object
smile.taxonomy.Taxonomy
A taxonomy is a tree of terms (aka concept) where leaves
must be named but intermediary nodes can be anonymous.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetConcept
(String keyword) Returns the concept node which synset contains the keyword.Returns all named concepts in the taxonomy.getRoot()
Returns the root node of taxonomy tree.lowestCommonAncestor
(String v, String w) Returns the lowest common ancestor (LCA) of concepts v and w.Returns the lowest common ancestor (LCA) of concepts v and w.
-
Constructor Details
-
Taxonomy
Constructor.- Parameters:
rootConcept
- the keyword of root concept.
-
-
Method Details
-
getRoot
Returns the root node of taxonomy tree.- Returns:
- root node.
-
getConcept
Returns the concept node which synset contains the keyword.- Parameters:
keyword
- the keyword.- Returns:
- the concept node which synset contains the keyword.
-
getConcepts
Returns all named concepts in the taxonomy.- Returns:
- all named concepts.
-
lowestCommonAncestor
Returns the lowest common ancestor (LCA) of concepts v and w. The lowest common ancestor is defined between two nodes v and w as the lowest node that has both v and w as descendants (where we allow a node to be a descendant of itself).- Parameters:
v
- a concept.w
- the other concept.- Returns:
- the lowest common ancestor.
-
lowestCommonAncestor
Returns the lowest common ancestor (LCA) of concepts v and w. The lowest common ancestor is defined between two nodes v and w as the lowest node that has both v and w as descendants (where we allow a node to be a descendant of itself).- Parameters:
v
- a concept.w
- the other concept.- Returns:
- the lowest common ancestor.
-