Main Page | Class List | File List | Class Members

SxRel Class Reference

This class represents a syntactic relation between tokens in a syntactic analysis produced by Syntex. More...

#include <fg_sxrel.h>

List of all members.

Public Types

typedef map< string, SxTokenRel,
less< string > > 
SxRelMap
 Map of strings to enum SxRel::SxTokenRel.

typedef map< SxTokenRel, string > SxInvRelMap
 Map of enum SxRel::SxTokenRel to strings.

enum  SxTokenRel {
  SxR_NONE = 0, SxR_ADJ, SxR_ADV, SxR_ATT,
  SxR_CC, SxR_DET, SxR_EPI, SxR_NN,
  SxR_NNPR, SxR_NOMPREP, SxR_OBJ, SxR_PRDE,
  SxR_PREP, SxR_REL, SxR_SUJ, SxR_VBATT
}
 Relation type.


Public Member Functions

 SxRel ()
 Default constructor.

 SxRel (const string &relStr, unsigned int recteur, unsigned int regi)
 Constructor.

virtual ~SxRel ()
 Destructor.

const string & getRelTypeText () const
 Returns the relation type for this relation in the form of a string that is recognized by the parser.

bool setRelType (const string &relTypeText)
 Sets the relation type for this relation.

SxTokenRel getRelType () const
 Returns the relation type for this relation.

void setRelType (SxTokenRel relType)
 Sets the relation type for this relation.

unsigned int getRegi () const
 Gets the token code for the regi.

void setRegi (unsigned int regi)
 Sets the token code for the regi.

unsigned int getRecteur () const
 Gets the token code for the recteur.

void setRecteur (unsigned int recteur)
 Sets the token code for the recteur.


Static Public Member Functions

SxTokenRel stringToRel (const string &relTxt)
 Maps a string describing a relation type to the corresponding enum.

const string & relToString (SxTokenRel rel)
 Maps an enum describing a relation type to the corresponding string.


Friends

ostream & operator<< (ostream &os, const SxRel &rel)
 Output function.


Detailed Description

This class represents a syntactic relation between tokens in a syntactic analysis produced by Syntex.

For each relation, a recteur and a list of regi are defined. To find the token corresponding to this recteur / regi, use the function SxSent::getToken( unsigned int ) to get the token corresponding to the code returned by getRecteur() or getRegi().

The class also contains a mapping mechanism between a relation code (ADJ, ADV,etc. and the corresponding enum.

Author:
(c) 2005 RALI - Université de Montréal
Version:
1.0


Constructor & Destructor Documentation

SxRel::SxRel const string &  relStr,
unsigned int  recteur,
unsigned int  regi
 

Constructor.

Creates a relation from the string describing its type and the codes for the recteur and regi. If relStr doesn't correspond to any known relation type, a error message is printed and the program halts.

Parameters:
relStr The string describing the relation type.
recteur The code for the recteur.
regi The code for the regi.


Member Function Documentation

unsigned int SxRel::getRecteur  )  const [inline]
 

Gets the token code for the recteur.

Returns:
The token code for the recteur

unsigned int SxRel::getRegi  )  const [inline]
 

Gets the token code for the regi.

Returns:
The token code for the regi.

SxRel::SxTokenRel SxRel::getRelType  )  const [inline]
 

Returns the relation type for this relation.

Returns:
The relation type for this relation.

const string & SxRel::getRelTypeText  )  const [inline]
 

Returns the relation type for this relation in the form of a string that is recognized by the parser.

Returns:
String for the relation type.

const string & SxRel::relToString SxTokenRel  rel  )  [static]
 

Maps an enum describing a relation type to the corresponding string.

If the rel is not found, the empty string "" is returned.

Parameters:
rel The relation type.
Returns:
The corresponding string value.
See also:
SxRel::SxTokenRel

void SxRel::setRecteur unsigned int  recteur  )  [inline]
 

Sets the token code for the recteur.

Parameters:
recteur The token code for the recteur.

void SxRel::setRegi unsigned int  regi  )  [inline]
 

Sets the token code for the regi.

Parameters:
regi The token code for the regi.

void SxRel::setRelType SxTokenRel  relType  ) 
 

Sets the relation type for this relation.

Parameters:
relType The relation type for this relation.

bool SxRel::setRelType const string &  relTypeText  ) 
 

Sets the relation type for this relation.

If the relation type string is not recognized, the operation fails.

Parameters:
relTypeText The relation type string for this relation.
Returns:
true if the relation type string corresponds to a known relation type, false otherwise.

SxRel::SxTokenRel SxRel::stringToRel const string &  relTxt  )  [static]
 

Maps a string describing a relation type to the corresponding enum.

If the parameter is not recognized, SxReL::SxR_NONE will be returned.

Parameters:
relTxt The relation type.
Returns:
The corresponding enum value.
See also:
SxRel::SxTokenRel


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const SxRel rel
[friend]
 

Output function.

Use this operator to write a relation onto a stream. The output format of this function cannot be parsed by the parsing function of the class SxSent.

Parameters:
os The output stream.
rel The relation to output.
Returns:
The output stream.


The documentation for this class was generated from the following files:
Generated on Mon Feb 21 08:53:16 2005 by doxygen 1.3.6