am 692cd00e: Small cleanups

* commit '692cd00ea3178cfe2c9f331150682ec78d8e6cd1':
  Small cleanups
This commit is contained in:
Ken Wakasa 2012-12-11 17:56:41 -08:00 committed by Android Git Automerger
commit bda6214523
5 changed files with 5 additions and 14 deletions

View file

@ -14,11 +14,6 @@
* limitations under the License.
*/
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#define LOG_TAG "LatinIME: correction.cpp"
#include "char_utils.h"
@ -1002,7 +997,7 @@ int Correction::RankingAlgorithm::editDistance(const int *before, const int befo
float Correction::RankingAlgorithm::calcNormalizedScore(const int *before, const int beforeLength,
const int *after, const int afterLength, const int score) {
if (0 == beforeLength || 0 == afterLength) {
return 0;
return 0.0f;
}
const int distance = editDistance(before, beforeLength, after, afterLength);
int spaceCount = 0;
@ -1013,7 +1008,7 @@ float Correction::RankingAlgorithm::calcNormalizedScore(const int *before, const
}
if (spaceCount == afterLength) {
return 0;
return 0.0f;
}
const float maxScore = score >= S_INT_MAX ? static_cast<float>(S_INT_MAX)

View file

@ -19,7 +19,6 @@
#include <cassert>
#include <cstring> // for memset()
#include <stdint.h>
#include "correction_state.h"
#include "defines.h"
@ -237,7 +236,7 @@ class Correction {
int mTerminalOutputIndex;
int mMaxErrors;
uint8_t mTotalTraverseCount;
int mTotalTraverseCount;
// The following arrays are state buffer.
int mWord[MAX_WORD_LENGTH_INTERNAL];
@ -352,7 +351,7 @@ AK_FORCE_INLINE static void calcEditDistanceOneStep(int *editDistanceTable, cons
const int prevCO = outputLength >= 2 ? toBaseLowerCase(output[outputLength - 2]) : 0;
for (int i = 1; i <= inputSize; ++i) {
const int ci = toBaseLowerCase(input[i - 1]);
const uint16_t cost = (ci == co) ? 0 : 1;
const int cost = (ci == co) ? 0 : 1;
current[i] = min(current[i - 1] + 1, min(prev[i] + 1, prev[i - 1] + cost));
if (i >= 2 && prevprev && ci == prevCO && co == toBaseLowerCase(input[i - 2])) {
current[i] = min(current[i], prevprev[i - 2] + 1);

View file

@ -237,9 +237,6 @@ static inline void prof_out(void) {
#endif // FLAG_DBG
#ifndef U_SHORT_MAX
#define U_SHORT_MAX 65535 // ((1 << 16) - 1)
#endif
#ifndef S_INT_MAX
#define S_INT_MAX 2147483647 // ((1 << 31) - 1)
#endif

View file

@ -15,7 +15,6 @@
*/
#include <cassert>
#include <cmath>
#include <cstring>
#define LOG_TAG "LatinIME: proximity_info.cpp"

View file

@ -17,6 +17,7 @@
#ifndef LATINIME_TERMINAL_ATTRIBUTES_H
#define LATINIME_TERMINAL_ATTRIBUTES_H
#include <stdint.h>
#include "binary_format.h"
namespace latinime {