smile.taxonomy
Class Concept
- java.lang.Object
-
- smile.taxonomy.Concept
-
public class Concept extends java.lang.ObjectConcept is a set of synonyms, i.e. group of words that are roughly synonymous in a given context.
-
-
Constructor Summary
Constructors Constructor and Description Concept(Concept parent)Constructor.Concept(Concept parent, java.util.List<java.lang.String> keywords)Constructor.Concept(Concept parent, java.lang.String keyword)Constructor.Concept(Concept parent, java.lang.String[] keywords)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddChild(Concept concept)Add a child to this nodeConceptaddChild(java.lang.String concept)Add a child to this nodevoidaddKeyword(java.lang.String keyword)Add a keyword to the concept synset.voidaddKeywords(java.util.List<java.lang.String> keywords)Add a list of synomym to the concept synset.voidaddKeywords(java.lang.String[] keywords)Add a list of synomym to the concept synset.java.util.List<Concept>getChildren()Get all children concepts.java.util.Set<java.lang.String>getKeywords()Returns the concept synonym set.java.util.List<Concept>getPathFromRoot()Returns the path from root to the given node.java.util.List<Concept>getPathToRoot()Returns the path from the given 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.booleanremoveChild(Concept concept)Remove a child to this nodevoidremoveKeyword(java.lang.String keyword)Remove a keyword from the concept synset.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Concept
public Concept(Concept parent)
Constructor. Create a concept with an empty set of synonyms.- Parameters:
parent- the parent concept
-
Concept
public Concept(Concept parent, java.lang.String keyword)
Constructor.- Parameters:
keyword- a keyword of this conceptparent- the parent concept
-
Concept
public Concept(Concept parent, java.lang.String[] keywords)
Constructor.- Parameters:
keywords- a list of keywords of this conceptparent- the parent concept
-
Concept
public Concept(Concept parent, java.util.List<java.lang.String> keywords)
Constructor.- Parameters:
keywords- a list of keywords of this conceptparent- the parent concept
-
-
Method Detail
-
isLeaf
public boolean isLeaf()
Check if a node is a leaf in the taxonomy tree.
-
getKeywords
public java.util.Set<java.lang.String> getKeywords()
Returns the concept synonym set.- Returns:
- concept synomym set.
-
addKeyword
public void addKeyword(java.lang.String keyword)
Add a keyword to the concept synset.
-
addKeywords
public void addKeywords(java.lang.String[] keywords)
Add a list of synomym to the concept synset.
-
addKeywords
public void addKeywords(java.util.List<java.lang.String> keywords)
Add a list of synomym to the concept synset.
-
removeKeyword
public void removeKeyword(java.lang.String keyword)
Remove a keyword from the concept synset.
-
getChildren
public java.util.List<Concept> getChildren()
Get all children concepts.- Returns:
- a vector of children concepts.
-
addChild
public Concept addChild(java.lang.String concept)
Add a child to this node
-
addChild
public void addChild(Concept concept)
Add a child to this node
-
removeChild
public boolean removeChild(Concept concept)
Remove a child to this node
-
isAncestorOf
public boolean isAncestorOf(Concept concept)
Returns true if this concept is an ancestor of the given concept.
-
getPathFromRoot
public java.util.List<Concept> getPathFromRoot()
Returns the path from root to the given node.
-
getPathToRoot
public java.util.List<Concept> getPathToRoot()
Returns the path from the given node to the root.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG