Remove DicNodeUtils::appendTwoWords().
Change-Id: I7402793b3f71ef5d786abea2f97bd4b624e4405f
This commit is contained in:
parent
90f6411899
commit
a83b013eec
3 changed files with 3 additions and 38 deletions
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#include "suggest/core/dicnode/dic_node_utils.h"
|
#include "suggest/core/dicnode/dic_node_utils.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "suggest/core/dicnode/dic_node.h"
|
#include "suggest/core/dicnode/dic_node.h"
|
||||||
#include "suggest/core/dicnode/dic_node_vector.h"
|
#include "suggest/core/dicnode/dic_node_vector.h"
|
||||||
#include "suggest/core/dictionary/multi_bigram_map.h"
|
#include "suggest/core/dictionary/multi_bigram_map.h"
|
||||||
|
@ -103,34 +101,4 @@ namespace latinime {
|
||||||
NOT_A_PROBABILITY);
|
NOT_A_PROBABILITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////
|
|
||||||
// Char utils //
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
// TODO: Move to char_utils?
|
|
||||||
/* static */ int DicNodeUtils::appendTwoWords(const int *const src0, const int16_t length0,
|
|
||||||
const int *const src1, const int16_t length1, int *const dest) {
|
|
||||||
int actualLength0 = 0;
|
|
||||||
for (int i = 0; i < length0; ++i) {
|
|
||||||
if (src0[i] == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
actualLength0 = i + 1;
|
|
||||||
}
|
|
||||||
actualLength0 = std::min(actualLength0, MAX_WORD_LENGTH);
|
|
||||||
memmove(dest, src0, actualLength0 * sizeof(dest[0]));
|
|
||||||
if (!src1 || length1 == 0) {
|
|
||||||
return actualLength0;
|
|
||||||
}
|
|
||||||
int actualLength1 = 0;
|
|
||||||
for (int i = 0; i < length1; ++i) {
|
|
||||||
if (src1[i] == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
actualLength1 = i + 1;
|
|
||||||
}
|
|
||||||
actualLength1 = std::min(actualLength1, MAX_WORD_LENGTH - actualLength0);
|
|
||||||
memmove(&dest[actualLength0], src1, actualLength1 * sizeof(dest[0]));
|
|
||||||
return actualLength0 + actualLength1;
|
|
||||||
}
|
|
||||||
} // namespace latinime
|
} // namespace latinime
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef LATINIME_DIC_NODE_UTILS_H
|
#ifndef LATINIME_DIC_NODE_UTILS_H
|
||||||
#define LATINIME_DIC_NODE_UTILS_H
|
#define LATINIME_DIC_NODE_UTILS_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
@ -30,8 +28,6 @@ class MultiBigramMap;
|
||||||
|
|
||||||
class DicNodeUtils {
|
class DicNodeUtils {
|
||||||
public:
|
public:
|
||||||
static int appendTwoWords(const int *src0, const int16_t length0, const int *src1,
|
|
||||||
const int16_t length1, int *const dest);
|
|
||||||
static void initAsRoot(
|
static void initAsRoot(
|
||||||
const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy,
|
const DictionaryStructureWithBufferPolicy *const dictionaryStructurePolicy,
|
||||||
const int prevWordPtNodePos, DicNode *const newRootDicNode);
|
const int prevWordPtNodePos, DicNode *const newRootDicNode);
|
||||||
|
|
|
@ -254,8 +254,9 @@ const int SuggestionsOutputUtils::MIN_LEN_FOR_MULTI_WORD_AUTOCORRECT = 16;
|
||||||
outputScores[outputWordIndex] = shortcutScore;
|
outputScores[outputWordIndex] = shortcutScore;
|
||||||
outputScores[outputWordIndex] = std::max(S_INT_MIN + 1, shortcutScore) - 1;
|
outputScores[outputWordIndex] = std::max(S_INT_MIN + 1, shortcutScore) - 1;
|
||||||
const int startIndex2 = outputWordIndex * MAX_WORD_LENGTH;
|
const int startIndex2 = outputWordIndex * MAX_WORD_LENGTH;
|
||||||
DicNodeUtils::appendTwoWords(0, 0, shortcutTarget, shortcutTargetStringLength,
|
// Copy shortcut target code points to the output buffer.
|
||||||
&outputCodePoints[startIndex2]);
|
memmove(&outputCodePoints[startIndex2], shortcutTarget,
|
||||||
|
shortcutTargetStringLength * sizeof(shortcutTarget[0]));
|
||||||
++outputWordIndex;
|
++outputWordIndex;
|
||||||
}
|
}
|
||||||
return outputWordIndex;
|
return outputWordIndex;
|
||||||
|
|
Loading…
Reference in a new issue