Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
aa5a3e84
Commit
aa5a3e84
authored
12 years ago
by
Ken Wakasa
Browse files
Options
Downloads
Patches
Plain Diff
Clean up int types in the Dictionary class
Change-Id: I49821c00186ce2a282bb23f369eb140b47d6c455
parent
1d516fb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
native/jni/src/bigram_dictionary.cpp
+4
-4
4 additions, 4 deletions
native/jni/src/bigram_dictionary.cpp
native/jni/src/dictionary.cpp
+3
-5
3 additions, 5 deletions
native/jni/src/dictionary.cpp
native/jni/src/dictionary.h
+3
-3
3 additions, 3 deletions
native/jni/src/dictionary.h
with
10 additions
and
12 deletions
native/jni/src/bigram_dictionary.cpp
+
4
−
4
View file @
aa5a3e84
...
...
@@ -146,8 +146,8 @@ int BigramDictionary::getBigrams(const int *prevWord, int prevWordLength, int *i
// Returns a pointer to the start of the bigram list.
// If the word is not found or has no bigrams, this function returns 0.
int
BigramDictionary
::
getBigramListPositionForWord
(
const
int
32_t
*
prevWord
,
const
int
prevWordLength
,
const
bool
forceLowerCaseSearch
)
const
{
int
BigramDictionary
::
getBigramListPositionForWord
(
const
int
*
prevWord
,
const
int
prevWordLength
,
const
bool
forceLowerCaseSearch
)
const
{
if
(
0
>=
prevWordLength
)
return
0
;
const
uint8_t
*
const
root
=
DICT
;
int
pos
=
BinaryFormat
::
getTerminalPosition
(
root
,
prevWord
,
prevWordLength
,
...
...
@@ -167,7 +167,7 @@ int BigramDictionary::getBigramListPositionForWord(const int32_t *prevWord,
return
pos
;
}
void
BigramDictionary
::
fillBigramAddressToFrequencyMapAndFilter
(
const
int
32_t
*
prevWord
,
void
BigramDictionary
::
fillBigramAddressToFrequencyMapAndFilter
(
const
int
*
prevWord
,
const
int
prevWordLength
,
std
::
map
<
int
,
int
>
*
map
,
uint8_t
*
filter
)
const
{
memset
(
filter
,
0
,
BIGRAM_FILTER_BYTE_SIZE
);
const
uint8_t
*
const
root
=
DICT
;
...
...
@@ -207,7 +207,7 @@ bool BigramDictionary::checkFirstCharacter(int *word, int *inputCodes) const {
return
false
;
}
bool
BigramDictionary
::
isValidBigram
(
const
int
32_t
*
word1
,
int
length1
,
const
int
32_t
*
word2
,
bool
BigramDictionary
::
isValidBigram
(
const
int
*
word1
,
int
length1
,
const
int
*
word2
,
int
length2
)
const
{
const
uint8_t
*
const
root
=
DICT
;
int
pos
=
getBigramListPositionForWord
(
word1
,
length1
,
false
/* forceLowerCaseSearch */
);
...
...
This diff is collapsed.
Click to expand it.
native/jni/src/dictionary.cpp
+
3
−
5
View file @
aa5a3e84
...
...
@@ -28,7 +28,6 @@
namespace
latinime
{
// TODO: Change the type of all keyCodes to uint32_t
Dictionary
::
Dictionary
(
void
*
dict
,
int
dictSize
,
int
mmapFd
,
int
dictBufAdjust
,
int
maxWordLength
,
int
maxWords
,
int
maxPredictions
)
:
mDict
(
static_cast
<
unsigned
char
*>
(
dict
)),
...
...
@@ -81,19 +80,18 @@ int Dictionary::getSuggestions(ProximityInfo *proximityInfo, void *traverseSessi
}
}
int
Dictionary
::
getBigrams
(
const
int
32_t
*
word
,
int
length
,
int
*
codes
,
int
codesSize
,
int
Dictionary
::
getBigrams
(
const
int
*
word
,
int
length
,
int
*
codes
,
int
codesSize
,
int
*
outWords
,
int
*
frequencies
,
int
*
outputTypes
)
const
{
if
(
length
<=
0
)
return
0
;
return
mBigramDictionary
->
getBigrams
(
word
,
length
,
codes
,
codesSize
,
outWords
,
frequencies
,
outputTypes
);
}
int
Dictionary
::
getFrequency
(
const
int
32_t
*
word
,
int
length
)
const
{
int
Dictionary
::
getFrequency
(
const
int
*
word
,
int
length
)
const
{
return
mUnigramDictionary
->
getFrequency
(
word
,
length
);
}
bool
Dictionary
::
isValidBigram
(
const
int32_t
*
word1
,
int
length1
,
const
int32_t
*
word2
,
int
length2
)
const
{
bool
Dictionary
::
isValidBigram
(
const
int
*
word1
,
int
length1
,
const
int
*
word2
,
int
length2
)
const
{
return
mBigramDictionary
->
isValidBigram
(
word1
,
length1
,
word2
,
length2
);
}
}
// namespace latinime
This diff is collapsed.
Click to expand it.
native/jni/src/dictionary.h
+
3
−
3
View file @
aa5a3e84
...
...
@@ -50,11 +50,11 @@ class Dictionary {
bool
useFullEditDistance
,
int
*
outWords
,
int
*
frequencies
,
int
*
spaceIndices
,
int
*
outputTypes
)
const
;
int
getBigrams
(
const
int
32_t
*
word
,
int
length
,
int
*
codes
,
int
codesSize
,
int
*
outWords
,
int
getBigrams
(
const
int
*
word
,
int
length
,
int
*
codes
,
int
codesSize
,
int
*
outWords
,
int
*
frequencies
,
int
*
outputTypes
)
const
;
int
getFrequency
(
const
int
32_t
*
word
,
int
length
)
const
;
bool
isValidBigram
(
const
int
32_t
*
word1
,
int
length1
,
const
int
32_t
*
word2
,
int
length2
)
const
;
int
getFrequency
(
const
int
*
word
,
int
length
)
const
;
bool
isValidBigram
(
const
int
*
word1
,
int
length1
,
const
int
*
word2
,
int
length2
)
const
;
const
uint8_t
*
getDict
()
const
{
// required to release dictionary buffer
return
mDict
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment