|
| Vocabulary (ResourceManager *resMan, bool foreign) |
|
void | reset () |
|
const char * | getAnyWordFromGroup (int group) |
|
void | lookupWord (ResultWordList &retval, const char *word, int word_len) |
|
void | lookupWordPrefix (ResultWordListList &parent_retval, ResultWordList &retval, const char *word, int word_len) |
|
bool | lookupSpecificPrefixWithMeaning (ResultWordListList &parent_retval, ResultWordList &retval, const char *word, int word_len, unsigned char prefix, const char *meaning) |
|
bool | lookupVerbPrefix (ResultWordListList &parent_retval, ResultWordList &retval, Common::String word, int word_len, Common::String prefix) |
|
bool | tokenizeString (ResultWordListList &retval, const char *sentence, char **error) |
|
int | parseGNF (const ResultWordListList &words, bool verbose=false) |
|
bool | storePronounReference () |
|
void | replacePronouns (ResultWordListList &words) |
|
ParseRuleList * | buildGNF (bool verbose=false) |
|
void | debugDecipherSaidBlock (const SciSpan< const byte > &data) |
|
void | printSuffixes () const |
|
void | printParserWords () const |
|
uint | getParserBranchesSize () const |
|
const parse_tree_branch_t & | getParseTreeBranch (int number) const |
|
void | addSynonym (synonym_t syn) |
|
void | clearSynonyms () |
|
void | synonymizeTokens (ResultWordListList &words) |
|
void | printParserNodes (int num) |
|
void | dumpParseTree () |
|
int | parseNodes (int *i, int *pos, int type, int nr, int argc, const char **argv) |
|
bool | checkAltInput (Common::String &text, uint16 &cursorPos) |
|
void | saveLoadWithSerializer (Common::Serializer &ser) |
|
◆ getAnyWordFromGroup()
const char* Sci::Vocabulary::getAnyWordFromGroup |
( |
int |
group | ) |
|
Gets any word from the specified group. For debugging only.
- Parameters
-
◆ lookupWord()
void Sci::Vocabulary::lookupWord |
( |
ResultWordList & |
retval, |
|
|
const char * |
word, |
|
|
int |
word_len |
|
) |
| |
Looks up a single word in the words and suffixes list.
- Parameters
-
retval | the list of matches |
word | pointer to the word to look up |
word_len | length of the word to look up |
◆ lookupWordPrefix()
Looks up a single word in the words list, taking into account suffixes, and updating parent_retval if a matching prefix is found Note: there is no equivalent in Sierra SCI, added to support specific languages translations For other languages, it does nothing
- Parameters
-
parent_retval | parent's function list of matches |
retval | the list of matches |
word | pointer to the word to look up |
word_len | length of the word to look up |
◆ lookupSpecificPrefixWithMeaning()
bool Sci::Vocabulary::lookupSpecificPrefixWithMeaning |
( |
ResultWordListList & |
parent_retval, |
|
|
ResultWordList & |
retval, |
|
|
const char * |
word, |
|
|
int |
word_len, |
|
|
unsigned char |
prefix, |
|
|
const char * |
meaning |
|
) |
| |
Helper function for lookupWordPrefix, checking specific prefix for match Intended for nouns and prepositions, and the prefix has meaning as another word
- Parameters
-
parent_retval | lookupWordPrefix's parent's function list of matches |
retval | lookupWordPrefix's list of matches |
word | pointer to the word to look up |
word_len | length of the word to look up |
prefix | the prefix to look for in the word |
meaning | the meaning of that prefix |
- Returns
- true on prefix match, false on prefix not matching
◆ lookupVerbPrefix()
Helper function for lookupWordPrefix, checking specific prefix for match Intended for verbs, and the prefix doesn't have any meaning
- Parameters
-
parent_retval | lookupWordPrefix's parent's function list of matches |
retval | lookupWordPrefix's list of matches |
word | pointer to the word to look up |
word_len | length of the word to look up |
prefix | the prefix to look for in the word |
- Returns
- true on prefix match, false on prefix not matching
◆ tokenizeString()
bool Sci::Vocabulary::tokenizeString |
( |
ResultWordListList & |
retval, |
|
|
const char * |
sentence, |
|
|
char ** |
error |
|
) |
| |
Tokenizes a string and compiles it into word_ts.
- Parameters
-
[in] | retval | A list of words which will be set to the result |
[out] | sentence | The sentence to examine |
[out] | error | Points to a malloc'd copy of the offending text or to NULL on error |
- Returns
- true on success, false on failure
On error, false is returned. If *error is NULL, the sentence did not contain any useful words; if not, *error points to a malloc'd copy of the offending word. The returned list may contain anywords.
◆ parseGNF()
Builds a parse tree from a list of words, using a set of Greibach Normal Form rules.
- Parameters
-
words | The words to build the tree from |
verbose | Set to true for debugging |
- Returns
- 0 on success, 1 if the tree couldn't be built in VOCAB_TREE_NODES nodes or if the sentence structure in 'words' is not part of the language described by the grammar passed in 'rules'.
◆ storePronounReference()
bool Sci::Vocabulary::storePronounReference |
( |
| ) |
|
Find and store reference for future pronouns
◆ replacePronouns()
Replace pronouns by stored reference
◆ buildGNF()
ParseRuleList* Sci::Vocabulary::buildGNF |
( |
bool |
verbose = false | ) |
|
Constructs the Greibach Normal Form of the grammar supplied in 'branches'.
- Parameters
-
verbose | Set to true for debugging. If true, the list is freed before the function ends |
- Returns
- Pointer to a list of singly linked GNF rules describing the same language that was described by 'branches'
The original SCI rules are in almost-CNF (Chomsky Normal Form). Note that branch[0] is used only for a few magical incantations, as it is treated specially by the SCI parser.
◆ debugDecipherSaidBlock()
void Sci::Vocabulary::debugDecipherSaidBlock |
( |
const SciSpan< const byte > & |
data | ) |
|
Deciphers a said block and dumps its content via debugN. For debugging only.
- Parameters
-
pos | pointer to the data to dump |
◆ printSuffixes()
void Sci::Vocabulary::printSuffixes |
( |
| ) |
const |
Prints the parser suffixes to the debug console.
◆ printParserWords()
void Sci::Vocabulary::printParserWords |
( |
| ) |
const |
Prints the parser words to the debug console.
◆ addSynonym()
void Sci::Vocabulary::addSynonym |
( |
synonym_t |
syn | ) |
|
|
inline |
Adds a new synonym to the list
◆ clearSynonyms()
void Sci::Vocabulary::clearSynonyms |
( |
| ) |
|
|
inline |
Clears the list of synonyms
◆ synonymizeTokens()
Synonymizes a token list Parameters: (ResultWordListList &) words: The word list to synonymize
◆ checkAltInput()
bool Sci::Vocabulary::checkAltInput |
( |
Common::String & |
text, |
|
|
uint16 & |
cursorPos |
|
) |
| |
Check text input against alternative inputs.
- Parameters
-
text | The text to process. It will be modified in-place |
cursorPos | The cursor position |
- Returns
- true if anything changed
◆ saveLoadWithSerializer()
Save/load vocabulary data
◆ _parserNodes
◆ parser_event
reg_t Sci::Vocabulary::parser_event |
The event passed to Parse() and later used by Said()
◆ parserIsValid
bool Sci::Vocabulary::parserIsValid |
If something has been correctly parsed
The documentation for this class was generated from the following file: