Natural Language Processing  0.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | List of all members
SyntaxTree Class Reference

The SyntaxTree class The Tree specialized for holding syntax and words INHERITS: from Tree. More...

#include <syntaxtree.h>

Inheritance diagram for SyntaxTree:
Tree< GtSpair >

Public Member Functions

 SyntaxTree ()
 SyntaxTree::SyntaxTree Default Constructor.
 
 SyntaxTree (TNpair *root)
 SyntaxTree::SyntaxTree Constructor. More...
 
 SyntaxTree (const SyntaxTree &S)
 SyntaxTree::SyntaxTree Copy Constructor. More...
 
SyntaxTreeoperator= (const SyntaxTree &S)
 SyntaxTree::operator = assignment operator. More...
 
 ~SyntaxTree ()
 SyntaxTree::~SyntaxTree Destructor.
 
void assignHeads ()
 SyntaxTree::assignHeads assigns the head words to each node.
 
void assignObjects ()
 SyntaxTree::assignObjects assigns the syntax to each node.
 
void determineType ()
 SyntaxTree::determineType Determines sentence type.
 
void addDef (GPlist def)
 SyntaxTree::addDef Adds the Definition to the current node (the children) More...
 
void removeDef ()
 SyntaxTree::removeDef Removes the definition of current_exception() NOTE: It will remove all of the children of the definitions.
 
GPlist getDef ()
 SyntaxTree::getDef Returns the definition as a vector of grammar phrases of current.
 
GrammarPhrase getPhrase ()
 SyntaxTree::getPhrase Returns the phrase at current. More...
 
bool atLeaf ()
 SyntaxTree::atLeaf Checks if current is a leaf. More...
 
TNpairgetLastLeaf ()
 SyntaxTree::getLastLeaf Returns the Rightmost bottom leaf. More...
 
TNpairgetFirstLeaf ()
 SyntaxTree::getFirstLeaf Returns the leftmost bottom leaf. More...
 
TNpairgetChildAt (std::size_t i)
 SyntaxTree::getChildAt gets the child at index of current. More...
 
bool atLastLeaf ()
 SyntaxTree::atLastLeaf Checks if current is at the last leaf. More...
 
bool atFirstLeaf ()
 SyntaxTree::atFirstLeaf Checks if current is at the first leaf. More...
 
std::size_t leavesBefore ()
 SyntaxTree::leavesBefore Calculates the number of leaves before current. More...
 
std::size_t childIndex (TNpair *parent, TNpair *child)
 SyntaxTree::childIndex Calculates which child is the child (from 0) More...
 
std::vector< SyntaxWordgetAll () const
 SyntaxTree::getAll Gets all of the syntax words. More...
 
std::vector< SyntaxWordgetObj (SyntaxObject S) const
 SyntaxTree::getObj Gets all of the instances of the syntax object. More...
 
SentenceType getSentenceType () const
 SyntaxTree::getSentenceType gets the sentence type. More...
 
SyntaxObject askingFor () const
 SyntaxTree::askingFor Gets the syntaxobject the question is asking for, if it is a question. More...
 
- Public Member Functions inherited from Tree< GtSpair >
 Tree ()
 Tree Default Constructor.
 
 Tree (TreeNode< GtSpair > *root)
 Tree Constructor. More...
 
 Tree (const Tree< GtSpair > &T)
 Tree Copy Constructor. More...
 
 ~Tree ()
 ~Tree Destructor
 
Tree< GtSpair > & operator= (const Tree< GtSpair > &T)
 operator = assignment operator More...
 
void addHere (const GtSpair &item)
 addHere Adds an item as a child to the current node More...
 
void addNode (TreeNode< GtSpair > *parent, const GtSpair &item)
 addNode Adds an item as a child to the parent More...
 
TreeNode< GtSpair > * search (const GtSpair &item)
 search searches for a specific item More...
 
bool inTree (TreeNode< GtSpair > *node)
 inTree Checks if the node is part of the tree More...
 
bool empty () const
 empty Checks if the tree is empty More...
 
void clear ()
 clear Clears the tree
 
std::size_t leafNum ()
 leafNum Counts the number of leaves in the tree More...
 
TreeNode< GtSpair > * getParent (TreeNode< GtSpair > *branch)
 getParent Gets the parent of the branch More...
 
TreeNode< GtSpair > * getCurrent ()
 getCurrent Returns the current node pointer More...
 
void set (const GtSpair &item)
 set Set the item of the current node More...
 
void shiftToRoot ()
 shiftToRoot shift the current to the root
 
void shiftUp ()
 shiftUp Shift the current to its parent
 
void shiftDown (std::size_t child)
 shiftDown Shift the current to one of its children More...
 
void shiftTo (TreeNode< GtSpair > *target)
 shiftTo Shift the current to the specified target More...
 
bool hasParent ()
 hasParent Checks if current has a parent More...
 
bool hasChild ()
 hasChild Checks if current has children More...
 
std::size_t childNum ()
 childNum Finds the number of children of current More...
 
GtSpairget ()
 get Returns the item of current More...
 
std::size_t size () const
 size Returns the size of the tree More...
 
std::vector< TreeNode< GtSpair > * > getLeaves ()
 getLeaves Returns a vector of the leaves of the tree More...
 

Static Public Member Functions

static string getSyntaxEncoding (const vector< SyntaxWord > &SWord)
 SyntaxTree::getSyntaxEncoding External function that should be part of SyntaxTree, function does not use any of member variales. More...
 

Additional Inherited Members

- Protected Attributes inherited from Tree< GtSpair >
TreeNode< GtSpair > * _root
 _root the root of the tree
 
TreeNode< GtSpair > * _current
 _current the treenode in which many operations are performed. Can be changed via shift functions
 

Detailed Description

The SyntaxTree class The Tree specialized for holding syntax and words INHERITS: from Tree.

Constructor & Destructor Documentation

SyntaxTree::SyntaxTree ( TNpair root)

SyntaxTree::SyntaxTree Constructor.

Parameters
rootthe root
SyntaxTree::SyntaxTree ( const SyntaxTree S)

SyntaxTree::SyntaxTree Copy Constructor.

Parameters
SSyntaxTree

Member Function Documentation

void SyntaxTree::addDef ( GPlist  def)

SyntaxTree::addDef Adds the Definition to the current node (the children)

Parameters
defthe definition (children)
SyntaxObject SyntaxTree::askingFor ( ) const

SyntaxTree::askingFor Gets the syntaxobject the question is asking for, if it is a question.

Returns
syntax object
bool SyntaxTree::atFirstLeaf ( )

SyntaxTree::atFirstLeaf Checks if current is at the first leaf.

Returns
True if it is, False otherwise
bool SyntaxTree::atLastLeaf ( )

SyntaxTree::atLastLeaf Checks if current is at the last leaf.

Returns
True if it is, False otherwise
bool SyntaxTree::atLeaf ( )

SyntaxTree::atLeaf Checks if current is a leaf.

Returns
True if it is, False otherwise
size_t SyntaxTree::childIndex ( TNpair parent,
TNpair child 
)

SyntaxTree::childIndex Calculates which child is the child (from 0)

Parameters
parentthe parent
childthe child
Returns
the index of the child vector of parent
std::vector< SyntaxWord > SyntaxTree::getAll ( ) const

SyntaxTree::getAll Gets all of the syntax words.

Returns
the vector
TNpair * SyntaxTree::getChildAt ( std::size_t  i)

SyntaxTree::getChildAt gets the child at index of current.

Parameters
ithe index
Returns
the child
TNpair * SyntaxTree::getFirstLeaf ( )

SyntaxTree::getFirstLeaf Returns the leftmost bottom leaf.

Returns
the first leaf
TNpair * SyntaxTree::getLastLeaf ( )

SyntaxTree::getLastLeaf Returns the Rightmost bottom leaf.

Returns
the last leaf
std::vector< SyntaxWord > SyntaxTree::getObj ( SyntaxObject  S) const

SyntaxTree::getObj Gets all of the instances of the syntax object.

Parameters
Sthe syntax object
Returns
the vector
GrammarPhrase SyntaxTree::getPhrase ( )

SyntaxTree::getPhrase Returns the phrase at current.

Returns
the phrase
SentenceType SyntaxTree::getSentenceType ( ) const

SyntaxTree::getSentenceType gets the sentence type.

Returns
sentence type
string SyntaxTree::getSyntaxEncoding ( const vector< SyntaxWord > &  SWord)
static

SyntaxTree::getSyntaxEncoding External function that should be part of SyntaxTree, function does not use any of member variales.

Parameters
SWord
Returns
std::size_t SyntaxTree::leavesBefore ( )

SyntaxTree::leavesBefore Calculates the number of leaves before current.

Returns
the number of leaves before current
SyntaxTree & SyntaxTree::operator= ( const SyntaxTree S)

SyntaxTree::operator = assignment operator.

Parameters
SSyntax Tree
Returns
this

The documentation for this class was generated from the following files: