OLD | NEW |
(Empty) | |
| 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 #ifndef LATINIME_SUGGESTION_RESULTS_H |
| 18 #define LATINIME_SUGGESTION_RESULTS_H |
| 19 |
| 20 #include <queue> |
| 21 #include <vector> |
| 22 |
| 23 #include "third_party/prediction/defines.h" |
| 24 #include "third_party/prediction/suggest/core/result/suggested_word.h" |
| 25 |
| 26 namespace latinime { |
| 27 |
| 28 class SuggestionResults { |
| 29 public: |
| 30 explicit SuggestionResults(const int maxSuggestionCount) |
| 31 : mSuggestedWords(), |
| 32 mMaxSuggestionCount(maxSuggestionCount), |
| 33 mLanguageWeight(NOT_A_LANGUAGE_WEIGHT) {} |
| 34 |
| 35 void addPrediction(const int* const codePoints, |
| 36 const int codePointCount, |
| 37 const int score); |
| 38 void addSuggestion(const int* const codePoints, |
| 39 const int codePointCount, |
| 40 const int score, |
| 41 const int type, |
| 42 const int indexToPartialCommit, |
| 43 const int autocimmitFirstWordConfindence); |
| 44 void getSortedScores(int* const outScores) const; |
| 45 void dumpSuggestions() const; |
| 46 |
| 47 void setLanguageWeight(const float languageWeight) { |
| 48 mLanguageWeight = languageWeight; |
| 49 } |
| 50 |
| 51 int getSuggestionCount() const { return mSuggestedWords.size(); } |
| 52 |
| 53 std::priority_queue<SuggestedWord, |
| 54 std::vector<SuggestedWord>, |
| 55 SuggestedWord::Comparator> mSuggestedWords; |
| 56 |
| 57 private: |
| 58 DISALLOW_IMPLICIT_CONSTRUCTORS(SuggestionResults); |
| 59 |
| 60 const int mMaxSuggestionCount; |
| 61 float mLanguageWeight; |
| 62 }; |
| 63 } // namespace latinime |
| 64 #endif // LATINIME_SUGGESTION_RESULTS_H |
OLD | NEW |