Main Page | Class List | File List | Class Members

SxToken Class Reference

This class represents a part of the analysis Syntex produces for a sentence corresponding more or less to a word. More...

#include <fg_sxtoken.h>

List of all members.

Public Types

typedef map< string, SxTokenCat,
less< string > > 
SxCatMap
 Map of strings to enum SxToken::SxTokenCat.

typedef map< SxTokenCat, string > SxInvCatMap
 Map of enum SxToken::SxTokenCat to strings.

enum  SxTokenCat {
  SxC_NONE = 0, SxC_Adj, SxC_Adj11, SxC_Adj1P,
  SxC_Adj1S, SxC_AdjFP, SxC_AdjFS, SxC_AdjIng,
  SxC_AdjMP, SxC_AdjMS, SxC_AdjNum, SxC_Adv,
  SxC_AdvGP, SxC_Advp, SxC_CCoord, SxC_CSub,
  SxC_Det, SxC_Det11, SxC_Det1P, SxC_Det1S,
  SxC_DetFP, SxC_DetFS, SxC_DetMP, SxC_DetMS,
  SxC_DetNum, SxC_Elim, SxC_Nom1P, SxC_Nom1Pp,
  SxC_Nom1S, SxC_Nom1Sp, SxC_NomFP, SxC_NomFS,
  SxC_NomInc, SxC_NomIng, SxC_NomMP, SxC_NomMS,
  SxC_NomPr, SxC_NomPrXXInc, SxC_NomPrXXPrenom, SxC_NomXXAdr,
  SxC_NomXXDate, SxC_NomXXMes, SxC_NomXXMon, SxC_NomXXNum,
  SxC_NomXXTitre, SxC_NomXXUrl, SxC_Num, SxC_POS,
  SxC_Ppa, SxC_PpaFP, SxC_PpaFS, SxC_PpaMP,
  SxC_PpaMS, SxC_Ppap, SxC_Ppr, SxC_PprIng,
  SxC_PprIngp, SxC_Pprp, SxC_Prep, SxC_Pro,
  SxC_ProRel, SxC_RP, SxC_SENT, SxC_Typo,
  SxC_VCONJ, SxC_VCONJP, SxC_VCONJPp, SxC_VCONJS,
  SxC_VCONJSp, SxC_VCONJp, SxC_VINF, SxC_VINFp
}
 Grammatical category. More...


Public Member Functions

 SxToken ()
 Default constructor.

virtual ~SxToken ()
 Default destructor.

SxTokenCat getCat () const
 Gets the grammatical category for this token.

bool setCat (const string &catStr)
 Sets the grammatical category for this token.

void setCat (SxTokenCat cat)
 Sets the grammatical category for this token.

const string & getLemma () const
 Get the token's lemma.

void setLemma (const string &lemma)
 Set the token's lemma.

const string & getTokenText () const
 Gets the token text from the original analysis.

void setTokenText (const string &tokenText)
 Sets the token text from the original analysis.

unsigned int getId () const
 Gets the unique sequential identifier for this token.

void setId (unsigned int id)
 Sets the unique sequential identifier for this token.

const list< SxRel > & getRegiRelList () const
 Returns the relation list where this token acts as a regi.

void addRegiRel (const SxRel regiRel)
 Adds a relation to the relation list where this token acts as a regi.

const list< SxRel > & getRecteurRelList () const
 Returns the relation list where this token acts as a recteur.

void addRecteurRel (const SxRel recteurRel)
 Adds a relation to the relation list where this token acts as a recteur.


Static Public Member Functions

SxTokenCat stringToCat (const string &catStr)
 Maps a string describing a grammatical cat.

const string & catToString (SxTokenCat cat)
 Maps an enum describing a grammatical cat.


Friends

ostream & operator<< (ostream &os, const SxToken &token)
 Output function.


Detailed Description

This class represents a part of the analysis Syntex produces for a sentence corresponding more or less to a word.

Each of these tokens is associated with a grammatical category, a token sequence number beginning with 1, a lemma and a list of relations where this token is either a recteur or a regi

This class also provides a mapping mechanism between the textual representation a grammatical category (e.g. Adj, Adj?P, etc.) and the corresponding enum value.

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


Member Enumeration Documentation

enum SxToken::SxTokenCat
 

Grammatical category.

Note that the '?'s in the original strings are replaced with '1's to respect C++'s syntax.


Member Function Documentation

void SxToken::addRecteurRel const SxRel  recteurRel  )  [inline]
 

Adds a relation to the relation list where this token acts as a recteur.

Parameters:
recteurRel The relation where this token is the recteur.

void SxToken::addRegiRel const SxRel  regiRel  )  [inline]
 

Adds a relation to the relation list where this token acts as a regi.

Parameters:
regiRel The relation where this token is the regi.

const string & SxToken::catToString SxTokenCat  cat  )  [static]
 

Maps an enum describing a grammatical cat.

to the corresponding string. If the category is not recognized, the empty string "" is returned.

Parameters:
cat The grammatical category.
Returns:
The corresponding string value.
See also:
SxToken::SxTokenCat

SxToken::SxTokenCat SxToken::getCat  )  const [inline]
 

Gets the grammatical category for this token.

Returns:
The grammatical category for this token.

unsigned int SxToken::getId  )  const [inline]
 

Gets the unique sequential identifier for this token.

The sequence starts from the number 1.

Returns:
The identifier.

const string & SxToken::getLemma  )  const [inline]
 

Get the token's lemma.

This may be multiple words (e.g. for verbs).

Returns:
the token's lemma.

const list< SxRel > & SxToken::getRecteurRelList  )  const [inline]
 

Returns the relation list where this token acts as a recteur.

This list can be empty.

Returns:
The relation list.

const list< SxRel > & SxToken::getRegiRelList  )  const [inline]
 

Returns the relation list where this token acts as a regi.

This list can be empty.

Returns:
The relation list.

const string & SxToken::getTokenText  )  const [inline]
 

Gets the token text from the original analysis.

Returns:
The token text from the original analysis.

void SxToken::setCat SxTokenCat  cat  )  [inline]
 

Sets the grammatical category for this token.

Parameters:
cat The the grammatical category for this token.

bool SxToken::setCat const string &  catStr  ) 
 

Sets the grammatical category for this token.

If the category string is not recognized, the operation fails.

Parameters:
catStr The string describing the grammatical category for this token.
Returns:
true if catStr is known, false otherwise.

void SxToken::setId unsigned int  id  )  [inline]
 

Sets the unique sequential identifier for this token.

The sequence starts from the number 1.

Parameters:
id The identifier.

void SxToken::setLemma const string &  lemma  )  [inline]
 

Set the token's lemma.

Parameters:
lemma The token's lemma.

void SxToken::setTokenText const string &  tokenText  )  [inline]
 

Sets the token text from the original analysis.

Parameters:
tokenText The token text from the original analysis.

SxToken::SxTokenCat SxToken::stringToCat const string &  catStr  )  [static]
 

Maps a string describing a grammatical cat.

to the corresponding enum. If the string is not recognized, SxToken::SxR_NONE is returned.

Parameters:
catStr The grammatical category.
Returns:
The corresponding enum value.
See also:
SxToken::SxTokenCat


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const SxToken token
[friend]
 

Output function.

Use this operator to write a token onto a stream. The output format is exactly the same as the input format. However, there may be some differences for a few tokens between the input read and the output from this function, since the output format of Syntex is buggy at times and this output function corrects any problem encountered during the parsing phase.

Parameters:
os The output stream.
token The token 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