Projects >> packages_input_LatinIME >>b9c57e6540502ef3b2941235bbbede4dedfdcfb7

Chunk
Conflicting content
                len++;
            }
            if (len > 0) {
<<<<<<< HEAD
                callback.addWord(mOutputChars, start, len, mFrequencies[j], mDicTypeId);
=======
                callback.addWord(mOutputChars, start, len, mFrequencies[j], DataType.UNIGRAM);
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
            }
        }
    }
Solution content
                len++;
            }
            if (len > 0) {
                callback.addWord(mOutputChars, start, len, mFrequencies[j], mDicTypeId, DataType.UNIGRAM);
            }
        }
    }
File
BinaryDictionary.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
         * @param wordLength length of valid characters in the character array
         * @param frequency the frequency of occurence. This is normalized between 1 and 255, but
         * can exceed those limits
<<<<<<< HEAD
         * @param dicTypeId of the dictionary where word was from
         * @return true if the word was added, false if no more words are required
         */
        boolean addWord(char[] word, int wordOffset, int wordLength, int frequency, int dicTypeId);
=======
         * @param dataType tells type of this data
         * @return true if the word was added, false if no more words are required
         */
        boolean addWord(char[] word, int wordOffset, int wordLength, int frequency,
                DataType dataType);
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
    }

    /**
Solution content
         * @param wordLength length of valid characters in the character array
         * @param frequency the frequency of occurence. This is normalized between 1 and 255, but
         * can exceed those limits
         * @param dicTypeId of the dictionary where word was from
         * @param dataType tells type of this data
         * @return true if the word was added, false if no more words are required
         */
        boolean addWord(char[] word, int wordOffset, int wordLength, int frequency, int dicTypeId,
                DataType dataType);
    }

    /**
File
Dictionary.java
Developer's decision
Manual
Kind of conflict
Comment
Method interface
Chunk
Conflicting content
            if (completion) {
                word[depth] = c;
                if (terminal) {
<<<<<<< HEAD
                    if (!callback.addWord(word, 0, depth + 1, freq * snr, mDicTypeId)) {
=======
                    if (!callback.addWord(word, 0, depth + 1, freq * snr, DataType.UNIGRAM)) {
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
                        return;
                    }
                    // Add to frequency of next letters for predictive correction
Solution content
            if (completion) {
                word[depth] = c;
                if (terminal) {
                    if (!callback.addWord(word, 0, depth + 1, freq * snr, mDicTypeId,
                                DataType.UNIGRAM)) {
                        return;
                    }
                    // Add to frequency of next letters for predictive correction
File
ExpandableDictionary.java
Developer's decision
Manual
Kind of conflict
If statement
Chunk
Conflicting content
                                        || !same(word, depth + 1, codes.getTypedWord())) {
                                    int finalFreq = freq * snr * addedAttenuation;
                                    if (skipPos < 0) finalFreq *= FULL_WORD_FREQ_MULTIPLIER;
<<<<<<< HEAD
                                    callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId);
=======
                                    callback.addWord(word, 0, depth + 1, finalFreq,
                                            DataType.UNIGRAM);
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
                                }
                            }
                            if (children != null) {
Solution content
                                        || !same(word, depth + 1, codes.getTypedWord())) {
                                    int finalFreq = freq * snr * addedAttenuation;
                                    if (skipPos < 0) finalFreq *= FULL_WORD_FREQ_MULTIPLIER;
                                    callback.addWord(word, 0, depth + 1, finalFreq, mDicTypeId,
                                            DataType.UNIGRAM);
                                }
                            }
                            if (children != null) {
File
ExpandableDictionary.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
        // TODO: Uncomment this block when we enable re-editing feature
        // If a word is selected
<<<<<<< HEAD
        /*if ((candidatesStart == candidatesEnd || newSelStart != oldSelStart)
=======
        if (isPredictionOn() && mJustRevertedSeparator == null
                && (candidatesStart == candidatesEnd || newSelStart != oldSelStart)
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
                && (newSelStart < newSelEnd - 1 || (!mPredicting))
                && !mVoiceInputHighlighted) {
            if (isCursorTouchingWord() || mLastSelectionStart < mLastSelectionEnd) {
Solution content
        // TODO: Uncomment this block when we enable re-editing feature
        // If a word is selected
        /*if (isPredictionOn() && mJustRevertedSeparator == null
                && (candidatesStart == candidatesEnd || newSelStart != oldSelStart)
                && (newSelStart < newSelEnd - 1 || (!mPredicting))
                && !mVoiceInputHighlighted) {
            if (isCursorTouchingWord() || mLastSelectionStart < mLastSelectionEnd) {
File
LatinIME.java
Developer's decision
Manual
Kind of conflict
Comment
If statement
Chunk
Conflicting content
    }

    private List getTypedSuggestions(WordComposer word) {
<<<<<<< HEAD
        List stringList = mSuggest.getSuggestions(
                mKeyboardSwitcher.getInputView(), word, false);
=======
        List stringList = mSuggest.getSuggestions(mInputView, word, false, null);
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
        return stringList;
    }
Solution content
    }

    private List getTypedSuggestions(WordComposer word) {
        List stringList = mSuggest.getSuggestions(mKeyboardSwitcher.getInputView(), word, false, null);
        return stringList;
    }
File
LatinIME.java
Developer's decision
Manual
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    }

    private void showSuggestions(WordComposer word) {
<<<<<<< HEAD
        List stringList = mSuggest.getSuggestions(
                mKeyboardSwitcher.getInputView(), word, false);
=======
        //long startTime = System.currentTimeMillis(); // TIME MEASUREMENT!
        // TODO Maybe need better way of retrieving previous word
        CharSequence prevWord = EditingUtil.getPreviousWord(getCurrentInputConnection());
        List stringList = mSuggest.getSuggestions(mInputView, word, false,
                prevWord);
        //long stopTime = System.currentTimeMillis(); // TIME MEASUREMENT!
        //Log.d("LatinIME","Suggest Total Time - " + (stopTime - startTime));

>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
        int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies();

        ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters(
Solution content
    }

    private void showSuggestions(WordComposer word) {
        //long startTime = System.currentTimeMillis(); // TIME MEASUREMENT!
        // TODO Maybe need better way of retrieving previous word
        CharSequence prevWord = EditingUtil.getPreviousWord(getCurrentInputConnection());
        List stringList = mSuggest.getSuggestions(mKeyboardSwitcher.getInputView(), word, false,
                prevWord);
        //long stopTime = System.currentTimeMillis(); // TIME MEASUREMENT!
        //Log.d("LatinIME","Suggest Total Time - " + (stopTime - startTime));

        int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies();

        ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters(
File
LatinIME.java
Developer's decision
Manual
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
     * @return list of suggestions.
     */
    public List getSuggestions(View view, WordComposer wordComposer, 
<<<<<<< HEAD
            boolean includeTypedWordIfValid) {
        LatinImeLogger.onStartSuggestion();
=======
            boolean includeTypedWordIfValid, CharSequence prevWordForBigram) {
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
        mHaveCorrection = false;
        mCapitalize = wordComposer.isCapitalized();
        collectGarbage(mSuggestions, mPrefMaxSuggestions);
Solution content
     * @return list of suggestions.
     */
    public List getSuggestions(View view, WordComposer wordComposer, 
            boolean includeTypedWordIfValid, CharSequence prevWordForBigram) {
        LatinImeLogger.onStartSuggestion();
        mHaveCorrection = false;
        mCapitalize = wordComposer.isCapitalized();
        collectGarbage(mSuggestions, mPrefMaxSuggestions);
File
Suggest.java
Developer's decision
Combination
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
            mLowerOriginalWord = "";
        }

<<<<<<< HEAD
        // Search the dictionary only if there are at least 2 characters
        if (wordComposer.size() > 1) {
=======
        if (wordComposer.size() == 1 && (mCorrectionMode == CORRECTION_FULL_BIGRAM
                || mCorrectionMode == CORRECTION_BASIC)) {
            // At first character, just get the bigrams
            Arrays.fill(mBigramPriorities, 0);
            collectGarbage(mBigramSuggestions, mPrefMaxBigrams);

            if (!TextUtils.isEmpty(prevWordForBigram)) {
                CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
                if (mMainDict.isValidWord(lowerPrevWord)) {
                    prevWordForBigram = lowerPrevWord;
                }
                mMainDict.getBigrams(wordComposer, prevWordForBigram, this,
                        mNextLettersFrequencies);
                char currentChar = wordComposer.getTypedWord().charAt(0);
                int count = 0;
                int bigramSuggestionSize = mBigramSuggestions.size();
                for (int i = 0; i < bigramSuggestionSize; i++) {
                    if (mBigramSuggestions.get(i).charAt(0) == currentChar) {
                        int poolSize = mStringPool.size();
                        StringBuilder sb = poolSize > 0 ?
                                (StringBuilder) mStringPool.remove(poolSize - 1)
                                : new StringBuilder(Dictionary.MAX_WORD_LENGTH);
                        sb.setLength(0);
                        sb.append(mBigramSuggestions.get(i));
                        mSuggestions.add(count++, sb);
                        if (count > mPrefMaxSuggestions) break;
                    }
                }
            }

        } else if (wordComposer.size() > 1) {
            // Search the dictionary only if there are at least 2 characters
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
            if (mUserDictionary != null || mContactsDictionary != null) {
                if (mUserDictionary != null) {
                    mUserDictionary.getWords(wordComposer, this, mNextLettersFrequencies);
Solution content
            mLowerOriginalWord = "";
        }

        // Search the dictionary only if there are at least 2 characters
        if (wordComposer.size() == 1 && (mCorrectionMode == CORRECTION_FULL_BIGRAM
                || mCorrectionMode == CORRECTION_BASIC)) {
            // At first character, just get the bigrams
            Arrays.fill(mBigramPriorities, 0);
            collectGarbage(mBigramSuggestions, mPrefMaxBigrams);

            if (!TextUtils.isEmpty(prevWordForBigram)) {
                CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
                if (mMainDict.isValidWord(lowerPrevWord)) {
                    prevWordForBigram = lowerPrevWord;
                }
                mMainDict.getBigrams(wordComposer, prevWordForBigram, this,
                        mNextLettersFrequencies);
                char currentChar = wordComposer.getTypedWord().charAt(0);
                int count = 0;
                int bigramSuggestionSize = mBigramSuggestions.size();
                for (int i = 0; i < bigramSuggestionSize; i++) {
                    if (mBigramSuggestions.get(i).charAt(0) == currentChar) {
                        int poolSize = mStringPool.size();
                        StringBuilder sb = poolSize > 0 ?
                                (StringBuilder) mStringPool.remove(poolSize - 1)
                                : new StringBuilder(Dictionary.MAX_WORD_LENGTH);
                        sb.setLength(0);
                        sb.append(mBigramSuggestions.get(i));
                        mSuggestions.add(count++, sb);
                        if (count > mPrefMaxSuggestions) break;
                    }
                }
            }

        } else if (wordComposer.size() > 1) {
            // Search the dictionary only if there are at least 2 characters
            if (mUserDictionary != null || mContactsDictionary != null) {
                if (mUserDictionary != null) {
                    mUserDictionary.getWords(wordComposer, this, mNextLettersFrequencies);
File
Suggest.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Method invocation
Chunk
Conflicting content
        return false;
    }

<<<<<<< HEAD
    public boolean addWord(final char[] word, final int offset, final int length,
            final int freq, final int dicTypeId) {
=======
    public boolean addWord(final char[] word, final int offset, final int length, int freq,
            final Dictionary.DataType dataType) {
        ArrayList suggestions;
        int[] priorities;
        int prefMaxSuggestions;
        if(dataType == Dictionary.DataType.BIGRAM) {
            suggestions = mBigramSuggestions;
            priorities = mBigramPriorities;
            prefMaxSuggestions = mPrefMaxBigrams;
        } else {
            suggestions = mSuggestions;
            priorities = mPriorities;
            prefMaxSuggestions = mPrefMaxSuggestions;
        }

>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
        int pos = 0;

        // Check if it's the same word, only caps are different
Solution content
        return false;
    }

    public boolean addWord(final char[] word, final int offset, final int length, int freq,
            final int dicTypeId, final Dictionary.DataType dataType) {
        ArrayList suggestions;
        int[] priorities;
        int prefMaxSuggestions;
        if(dataType == Dictionary.DataType.BIGRAM) {
            suggestions = mBigramSuggestions;
            priorities = mBigramPriorities;
            prefMaxSuggestions = mPrefMaxBigrams;
        } else {
            suggestions = mSuggestions;
            priorities = mPriorities;
            prefMaxSuggestions = mPrefMaxSuggestions;
        }

        int pos = 0;

        // Check if it's the same word, only caps are different
File
Suggest.java
Developer's decision
Manual
Kind of conflict
If statement
Method signature
Variable
Chunk
Conflicting content
     * Are accented forms of words suggested as corrections?
     */
    public void testAccents() {
<<<<<<< HEAD
        // nio
        assertTrue(isDefaultCorrection("nino", "ni\u00F1o"));
        // nio
        assertTrue(isDefaultCorrection("nimo", "ni\u00F1o"));
        // Mara
        assertTrue(isDefaultCorrection("maria", "Mar\u00EDa"));
=======
        assertTrue(isDefaultCorrection("nino", "ni\u00F1o")); // niño
        assertTrue(isDefaultCorrection("nimo", "ni\u00F1o")); // niño
        assertTrue(isDefaultCorrection("maria", "Mar\u00EDa")); // María
    }

    /**
     * Make sure bigrams are showing when first character is typed
     *  and don't show any when there aren't any
     */
    public void testBigramsAtFirstChar() {
        assertTrue(isDefaultNextCorrection("about", "p", "part"));
        assertTrue(isDefaultNextCorrection("I'm", "a", "about"));
        assertTrue(isDefaultNextCorrection("about", "b", "business"));
        assertTrue(isASuggestion("about", "b", "being"));
        assertFalse(isDefaultNextSuggestion("about", "p", "business"));
    }

    /**
     * Make sure bigrams score affects the original score
     */
    public void testBigramsScoreEffect() {
       assertTrue(isDefaultCorrection("pa", "page"));
       assertTrue(isDefaultNextCorrection("about", "pa", "part"));
       assertTrue(isDefaultCorrection("sa", "said"));
       assertTrue(isDefaultNextCorrection("from", "sa", "same"));
>>>>>>> 2a118d844e0b7dd3e01f25e937b02b05711768a6
    }
}
Solution content
     * Are accented forms of words suggested as corrections?
     */
    public void testAccents() {
        // nio
        assertTrue(isDefaultCorrection("nino", "ni\u00F1o"));
        // nio
        assertTrue(isDefaultCorrection("nimo", "ni\u00F1o"));
        // Mara
        assertTrue(isDefaultCorrection("maria", "Mar\u00EDa"));
    }

    /**
     * Make sure bigrams are showing when first character is typed
     *  and don't show any when there aren't any
     */
    public void testBigramsAtFirstChar() {
        assertTrue(isDefaultNextCorrection("about", "p", "part"));
        assertTrue(isDefaultNextCorrection("I'm", "a", "about"));
        assertTrue(isDefaultNextCorrection("about", "b", "business"));
        assertTrue(isASuggestion("about", "b", "being"));
        assertFalse(isDefaultNextSuggestion("about", "p", "business"));
    }

    /**
     * Make sure bigrams score affects the original score
     */
    public void testBigramsScoreEffect() {
       assertTrue(isDefaultCorrection("pa", "page"));
       assertTrue(isDefaultNextCorrection("about", "pa", "part"));
       assertTrue(isDefaultCorrection("sa", "said"));
       assertTrue(isDefaultNextCorrection("from", "sa", "same"));
    }
}
File
SuggestTests.java
Developer's decision
Combination
Kind of conflict
Comment
Method declaration
Method invocation
Method signature