Dillo v3.1.1-98-g318d1f14
|
#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) |
Given a word, returns a list of the possible hyphenation points. | |
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. | |
virtual bool | equals (Object *other) |
Returns, whether two objects are equal. | |
virtual int | hashValue () |
Return a hash value for the object. | |
virtual Object * | clone () |
Return an exact copy of the object. | |
virtual void | intoStringBuffer (misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. | |
const char * | toString () |
Use object::Object::intoStringBuffer to return a textual representation of the object. | |
virtual size_t | sizeOf () |
Return the number of bytes, this object totally uses. | |
Static Public Member Functions | |
static Hyphenator * | getHyphenator (const char *language) |
static bool | isHyphenationCandidate (const char *word) |
Simple test to avoid much costs. | |
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) |
Hyphenate a single word, which only consists of lowercase characters. | |
bool | isCharPartOfActualWord (char *s) |
Test whether the character on which "s" points (UTF-8) is an actual part of the word. | |
Private Attributes | |
Trie * | trie |
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 |
Definition at line 86 of file hyphenator.hh.
dw::Hyphenator::Hyphenator | ( | const char * | patFile, |
const char * | excFile, | ||
int | pack = 256 |
||
) |
Definition at line 49 of file hyphenator.cc.
References dw::TrieBuilder::createTrie(), exceptions, insertException(), insertPattern(), LEN, dw::Trie::load(), and trie.
dw::Hyphenator::~Hyphenator | ( | ) |
Definition at line 110 of file hyphenator.cc.
References exceptions, and trie.
|
static |
Definition at line 116 of file hyphenator.cc.
References hyphenators.
Referenced by dw::Textblock::hyphenateWord().
|
private |
Hyphenate a single word, which only consists of lowercase characters.
Store break positions + "offset" in "breakPos".
Definition at line 293 of file hyphenator.cc.
References exceptions, lout::misc::SimpleVector< T >::get(), lout::container::typed::Vector< T >::get(), lout::container::typed::HashTable< K, V >::get(), dw::Trie::getData(), lout::misc::SimpleVector< T >::increase(), lout::misc::max(), lout::misc::min(), lout::unicode::nextUtf8Char(), lout::unicode::numUtf8Chars(), dw::Trie::root, lout::misc::SimpleVector< T >::set(), lout::misc::SimpleVector< T >::setSize(), lout::container::typed::Collection< T >::size(), lout::misc::SimpleVector< T >::size(), trie, and dw::Trie::validState().
Referenced by hyphenateWord().
int * dw::Hyphenator::hyphenateWord | ( | core::Platform * | platform, |
const char * | word, | ||
int * | numBreaks | ||
) |
Given a word, returns a list of the possible hyphenation points.
Definition at line 234 of file hyphenator.cc.
References lout::misc::SimpleVector< T >::detachArray(), exceptions, hyphenateSingleWord(), isCharPartOfActualWord(), isHyphenationCandidate(), platform, lout::misc::SimpleVector< T >::size(), and trie.
Referenced by hyph(), and dw::Textblock::hyphenateWord().
|
private |
Definition at line 184 of file hyphenator.cc.
References exceptions, lout::container::typed::HashTable< K, V >::put(), lout::container::typed::Vector< T >::put(), and lout::container::typed::Collection< T >::size().
Referenced by Hyphenator().
|
private |
Definition at line 149 of file hyphenator.cc.
References lout::misc::SimpleVector< T >::getArray(), dw::TrieBuilder::insert(), lout::misc::SimpleVector< T >::set(), and lout::misc::SimpleVector< T >::setSize().
Referenced by Hyphenator().
|
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.)
Definition at line 226 of file hyphenator.cc.
References lout::unicode::decodeUtf8(), and lout::unicode::isAlpha().
Referenced by hyphenateWord().
|
static |
Simple test to avoid much costs.
Passing it does not mean that the word can be hyphenated.
Definition at line 212 of file hyphenator.cc.
Referenced by hyphenateWord(), and dw::Textblock::isHyphenationCandidate().
|
inline |
Definition at line 110 of file hyphenator.hh.
References dw::Trie::save(), and trie.
Referenced by main().
|
private |
Definition at line 94 of file hyphenator.hh.
Referenced by hyphenateSingleWord(), hyphenateWord(), Hyphenator(), insertException(), and ~Hyphenator().
|
staticprivate |
Definition at line 89 of file hyphenator.hh.
Referenced by getHyphenator().
|
private |
Definition at line 90 of file hyphenator.hh.
Referenced by hyphenateSingleWord(), hyphenateWord(), Hyphenator(), saveTrie(), and ~Hyphenator().