Home | History | Annotate | Download | only in personalization
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.inputmethod.latin.personalization;
     18 
     19 import com.android.inputmethod.latin.Dictionary;
     20 import com.android.inputmethod.latin.ExpandableBinaryDictionary;
     21 
     22 import android.content.Context;
     23 import android.content.SharedPreferences;
     24 
     25 /**
     26  * Locally gathers stats about the words user types and various other signals like auto-correction
     27  * cancellation or manual picks. This allows the keyboard to adapt to the typist over time.
     28  */
     29 public class UserHistoryDictionary extends DecayingExpandableBinaryDictionaryBase {
     30     /* package for tests */ static final String NAME =
     31             UserHistoryDictionary.class.getSimpleName();
     32     /* package */ UserHistoryDictionary(final Context context, final String locale,
     33             final SharedPreferences sp) {
     34         super(context, locale, sp, Dictionary.TYPE_USER_HISTORY, getDictionaryFileName(locale));
     35     }
     36 
     37     private static String getDictionaryFileName(final String locale) {
     38         return NAME + "." + locale + ExpandableBinaryDictionary.DICT_FILE_EXTENSION;
     39     }
     40 }
     41