diff options
author | 2010-12-07 13:08:39 +0900 | |
---|---|---|
committer | 2010-12-07 16:45:32 +0900 | |
commit | d29979236807a412f5fd87112d51c775b9ff25df (patch) | |
tree | 5b10453d8dc541bb9203cb46d402c2ae88639712 /native/src/unigram_dictionary.h | |
parent | e00b7c5f7bb4058a67487b6bec664d319cf25f08 (diff) | |
download | latinime-d29979236807a412f5fd87112d51c775b9ff25df.tar.gz latinime-d29979236807a412f5fd87112d51c775b9ff25df.tar.xz latinime-d29979236807a412f5fd87112d51c775b9ff25df.zip |
Make no-recursive getWordRec
Change-Id: Id90f3ca86ef490834cefa92f0d6958b1289fc633
Diffstat (limited to 'native/src/unigram_dictionary.h')
-rw-r--r-- | native/src/unigram_dictionary.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/native/src/unigram_dictionary.h b/native/src/unigram_dictionary.h index c02d366de..c53e77c0d 100644 --- a/native/src/unigram_dictionary.h +++ b/native/src/unigram_dictionary.h @@ -44,8 +44,11 @@ private: void getWordsRec(const int childrenCount, const int pos, const int depth, const int maxDepth, const bool traverseAllNodes, const int snr, const int inputIndex, const int diffs, const int skipPos, int *nextLetters, const int nextLettersSize); - void getWords(const int initialPos, const int inputLength, const int skipPos, int *nextLetters, - const int nextLettersSize); + void getWords(const int rootPos, const int inputLength, const int skipPos, + int *nextLetters, const int nextLettersSize); + // Keep getWordsOld for comparing performance between getWords and getWordsOld + void getWordsOld(const int initialPos, const int inputLength, const int skipPos, + int *nextLetters, const int nextLettersSize); void registerNextLetter(unsigned short c, int *nextLetters, int nextLettersSize); void onTerminalWhenUserTypedLengthIsGreaterThanInputLength(unsigned short *word, const int mInputLength, const int depth, const int snr, int *nextLetters, @@ -58,7 +61,7 @@ private: bool processCurrentNode(const int pos, const int depth, const int maxDepth, const bool traverseAllNodes, const int snr, const int inputIndex, const int diffs, const int skipPos, int *nextLetters, const int nextLettersSize, - int *newCount, int *newChildPosition, int *newDepth, bool *newTraverseAllNodes, + int *newCount, int *newChildPosition, bool *newTraverseAllNodes, int *newSnr, int*newInputIndex, int *newDiffs, int *nextSiblingPosition); const unsigned char *DICT; const int MAX_WORDS; @@ -75,6 +78,13 @@ private: // MAX_WORD_LENGTH_INTERNAL must be bigger than MAX_WORD_LENGTH unsigned short mWord[MAX_WORD_LENGTH_INTERNAL]; int mMaxEditDistance; + + int mStackChildCount[MAX_WORD_LENGTH_INTERNAL]; + bool mStackTraverseAll[MAX_WORD_LENGTH_INTERNAL]; + int mStackNodeFreq[MAX_WORD_LENGTH_INTERNAL]; + int mStackInputIndex[MAX_WORD_LENGTH_INTERNAL]; + int mStackDiffs[MAX_WORD_LENGTH_INTERNAL]; + int mStackSiblingPos[MAX_WORD_LENGTH_INTERNAL]; }; // ---------------------------------------------------------------------------- |