Dillo
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
dw::Hyphenator Class Reference

#include <hyphenator.hh>

Public Member Functions

 Hyphenator (const char *patFile, const char *excFile, int pack=256)
 
 ~Hyphenator ()
 
int * hyphenateWord (core::Platform *platform, const char *word, int *numBreaks)
 
void saveTrie (FILE *fp)
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. More...
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal. More...
 
virtual int hashValue ()
 Return a hash value for the object. More...
 
virtual Objectclone ()
 Return an exact copy of the object. More...
 
virtual void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer. More...
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object. More...
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses. More...
 

Static Public Member Functions

static HyphenatorgetHyphenator (const char *language)
 
static bool isHyphenationCandidate (const char *word)
 

Private Member Functions

void insertPattern (TrieBuilder *trieBuilder, char *s)
 
void insertException (char *s)
 
void hyphenateSingleWord (core::Platform *platform, char *wordLc, int offset, lout::misc::SimpleVector< int > *breakPos)
 
bool isCharPartOfActualWord (char *s)
 

Private Attributes

Trietrie
 
lout::container::typed::HashTable
< lout::object::ConstString,
lout::container::typed::Vector
< lout::object::Integer > > * 
exceptions
 

Static Private Attributes

static
lout::container::typed::HashTable
< lout::object::String,
Hyphenator > * 
hyphenators
 

Constructor & Destructor Documentation

dw::Hyphenator::Hyphenator ( const char *  patFile,
const char *  excFile,
int  pack = 256 
)
dw::Hyphenator::~Hyphenator ( )

Member Function Documentation

Hyphenator * dw::Hyphenator::getHyphenator ( const char *  language)
static

Referenced by hyphenateWord().

void dw::Hyphenator::hyphenateSingleWord ( core::Platform platform,
char *  wordLc,
int  offset,
lout::misc::SimpleVector< int > *  breakPos 
)
private
int * dw::Hyphenator::hyphenateWord ( core::Platform platform,
const char *  word,
int *  numBreaks 
)
void dw::Hyphenator::insertException ( char *  s)
private
void dw::Hyphenator::insertPattern ( TrieBuilder trieBuilder,
char *  s 
)
private
bool dw::Hyphenator::isCharPartOfActualWord ( char *  s)
private

Test whether the character on which "s" points (UTF-8) is an actual part of the word. Other characters at the beginning and end are ignored.

TODO Currently only suitable for English and German. TODO Only lowercase. (Uppercase not needed.)

References lout::unicode::decodeUtf8(), and lout::unicode::isAlpha().

bool dw::Hyphenator::isHyphenationCandidate ( const char *  word)
static

Simple test to avoid much costs. Passing it does not mean that the word can be hyphenated.

void dw::Hyphenator::saveTrie ( FILE *  fp)
inline

References dw::Trie::save().

Referenced by main().

Member Data Documentation

HashTable< String, Hyphenator > * dw::Hyphenator::hyphenators
staticprivate
Initial value:
=
new HashTable <String, Hyphenator> (true, true)
Trie* dw::Hyphenator::trie
private

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