Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a10b1a88 authored by Ken Wakasa's avatar Ken Wakasa
Browse files

Misc small cleanups

Change-Id: Iea61e6c76a9a0437a1b2e8143f6ab5b09a8e211e
parent 8873b5ae
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2011, The Android Open Source Project
 * Copyright (C) 2011 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@
#include "jni.h"
#include "jni.h"


namespace latinime {
namespace latinime {

int register_ProximityInfo(JNIEnv *env);
int register_ProximityInfo(JNIEnv *env);

} // namespace latinime
} // namespace latinime
#endif // _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
#endif // _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
+1 −3
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2011, The Android Open Source Project
 * Copyright (C) 2011 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@
#include "jni.h"
#include "jni.h"


namespace latinime {
namespace latinime {

int register_BinaryDictionary(JNIEnv *env);
int register_BinaryDictionary(JNIEnv *env);

} // namespace latinime
} // namespace latinime
#endif // _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
#endif // _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
+1 −2
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2012, The Android Open Source Project
 * Copyright (C) 2012 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
#ifndef _COM_ANDROID_INPUTMETHOD_LATIN_DICTRAVERSESESSION_H
#ifndef _COM_ANDROID_INPUTMETHOD_LATIN_DICTRAVERSESESSION_H
#define _COM_ANDROID_INPUTMETHOD_LATIN_DICTRAVERSESESSION_H
#define _COM_ANDROID_INPUTMETHOD_LATIN_DICTRAVERSESESSION_H


#include "defines.h"
#include "jni.h"
#include "jni.h"


namespace latinime {
namespace latinime {
+1 −3
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2011, The Android Open Source Project
 * Copyright (C) 2011 The Android Open Source Project
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -20,9 +20,7 @@
#include "jni.h"
#include "jni.h"


namespace latinime {
namespace latinime {

int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods,
int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods,
        int numMethods);
        int numMethods);

} // namespace latinime
} // namespace latinime
#endif // LATINIME_JNI_COMMON_H
#endif // LATINIME_JNI_COMMON_H
+10 −15
Original line number Original line Diff line number Diff line
@@ -71,8 +71,7 @@ void Correction::resetCorrection() {
    mTotalTraverseCount = 0;
    mTotalTraverseCount = 0;
}
}


void Correction::initCorrection(const ProximityInfo *pi, const int inputSize,
void Correction::initCorrection(const ProximityInfo *pi, const int inputSize, const int maxDepth) {
        const int maxDepth) {
    mProximityInfo = pi;
    mProximityInfo = pi;
    mInputSize = inputSize;
    mInputSize = inputSize;
    mMaxDepth = maxDepth;
    mMaxDepth = maxDepth;
@@ -168,8 +167,7 @@ bool Correction::initProcessState(const int outputIndex) {
    return true;
    return true;
}
}


int Correction::goDownTree(
int Correction::goDownTree(const int parentIndex, const int childCount, const int firstChildPos) {
        const int parentIndex, const int childCount, const int firstChildPos) {
    mCorrectionStates[mOutputIndex].mParentIndex = parentIndex;
    mCorrectionStates[mOutputIndex].mParentIndex = parentIndex;
    mCorrectionStates[mOutputIndex].mChildCount = childCount;
    mCorrectionStates[mOutputIndex].mChildCount = childCount;
    mCorrectionStates[mOutputIndex].mSiblingPos = firstChildPos;
    mCorrectionStates[mOutputIndex].mSiblingPos = firstChildPos;
@@ -532,8 +530,7 @@ inline static bool isUpperCase(unsigned short c) {
// RankingAlgorithm //
// RankingAlgorithm //
//////////////////////
//////////////////////


/* static */
/* static */ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex,
int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex,
        const int outputIndex, const int freq, int *editDistanceTable, const Correction *correction,
        const int outputIndex, const int freq, int *editDistanceTable, const Correction *correction,
        const int inputSize) {
        const int inputSize) {
    const int excessivePos = correction->getExcessivePos();
    const int excessivePos = correction->getExcessivePos();
@@ -794,10 +791,9 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
    return finalFreq;
    return finalFreq;
}
}


/* static */
/* static */ int Correction::RankingAlgorithm::calcFreqForSplitMultipleWords(const int *freqArray,
int Correction::RankingAlgorithm::calcFreqForSplitMultipleWords(
        const int *wordLengthArray, const int wordCount, const Correction *correction,
        const int *freqArray, const int *wordLengthArray, const int wordCount,
        const bool isSpaceProximity, const int *word) {
        const Correction *correction, const bool isSpaceProximity, const int *word) {
    const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
    const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;


    bool firstCapitalizedWordDemotion = false;
    bool firstCapitalizedWordDemotion = false;
@@ -965,8 +961,8 @@ inline static int editDistanceInternal(int *editDistanceTable, const int *before
    return dp[li * lo - 1];
    return dp[li * lo - 1];
}
}


int Correction::RankingAlgorithm::editDistance(const int *before, const int beforeLength,
/* static */ int Correction::RankingAlgorithm::editDistance(const int *before,
        const int *after, const int afterLength) {
        const int beforeLength, const int *after, const int afterLength) {
    int table[(beforeLength + 1) * (afterLength + 1)];
    int table[(beforeLength + 1) * (afterLength + 1)];
    return editDistanceInternal(table, before, beforeLength, after, afterLength);
    return editDistanceInternal(table, before, beforeLength, after, afterLength);
}
}
@@ -993,9 +989,8 @@ int Correction::RankingAlgorithm::editDistance(const int *before, const int befo
// the result.
// the result.
// So, we can normalize original score by dividing powf(2, min(b.l(),a.l())) * 255 * 2.
// So, we can normalize original score by dividing powf(2, min(b.l(),a.l())) * 255 * 2.


/* static */
/* static */ float Correction::RankingAlgorithm::calcNormalizedScore(const int *before,
float Correction::RankingAlgorithm::calcNormalizedScore(const int *before, const int beforeLength,
        const int beforeLength, const int *after, const int afterLength, const int score) {
        const int *after, const int afterLength, const int score) {
    if (0 == beforeLength || 0 == afterLength) {
    if (0 == beforeLength || 0 == afterLength) {
        return 0.0f;
        return 0.0f;
    }
    }
Loading