Package smile.taxonomy
Class Concept
java.lang.Object
smile.taxonomy.Concept
Concept is a set of synonyms, i.e. group of words that are roughly
synonymous in a given context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a child to this node.voidAdds a child to this node.voidaddKeywords(String... keywords) Adds a list of synomym to the concept synset.children()Gets all children concepts.Returns the path from root to this node.Returns the path from this node to the root.booleanisAncestorOf(Concept concept) Returns true if this concept is an ancestor of the given concept.booleanisLeaf()Check if a node is a leaf in the taxonomy tree.keywords()Returns the concept synonym set.booleanremoveChild(Concept concept) Removes a child to this node.voidremoveKeyword(String keyword) Removes a keyword from the concept synset.toString()
-
Constructor Details
-
Concept
Constructor.- Parameters:
parent- the parent conceptkeywords- a list of keywords of this concept
-
-
Method Details
-
isLeaf
public boolean isLeaf()Check if a node is a leaf in the taxonomy tree.- Returns:
- true if a node is a leaf.
-
keywords
Returns the concept synonym set.- Returns:
- concept synomym set.
-
addKeywords
Adds a list of synomym to the concept synset.- Parameters:
keywords- the synomyms.
-
removeKeyword
Removes a keyword from the concept synset.- Parameters:
keyword- the keyword.
-
children
Gets all children concepts.- Returns:
- a vector of children concepts.
-
addChild
Adds a child to this node.- Parameters:
concept- the concept.- Returns:
- the child node.
-
addChild
Adds a child to this node.- Parameters:
concept- the concept.
-
removeChild
Removes a child to this node.- Parameters:
concept- the concept.- Returns:
- true if the given concept is a child.
-
isAncestorOf
Returns true if this concept is an ancestor of the given concept.- Parameters:
concept- the concept.- Returns:
- true if this concept is an ancestor of the given concept.
-
getPathFromRoot
Returns the path from root to this node.- Returns:
- the path from root to this node.
-
getPathToRoot
Returns the path from this node to the root.- Returns:
- the path from this node to the root.
-
toString
-