Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: third_party/prediction/suggest/core/suggest.h

Issue 1247903003: Add spellcheck and word suggestion to the prediction service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 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_SUGGEST_IMPL_H
18 #define LATINIME_SUGGEST_IMPL_H
19
20 #include "third_party/prediction/defines.h"
21 #include "third_party/prediction/suggest/core/suggest_interface.h"
22 #include "third_party/prediction/suggest/core/policy/suggest_policy.h"
23
24 namespace latinime {
25
26 // Naming convention
27 // - Distance: "Weighted" edit distance -- used both for spatial and language.
28 // - Compound Distance: Spatial Distance + Language Distance -- used for pruning
29 // and scoring
30 // - Cost: delta/diff for Distance -- used both for spatial and language
31 // - Length: "Non-weighted" -- used only for spatial
32 // - Probability: "Non-weighted" -- used only for language
33 // - Score: Final calibrated score based on the compound distance, which is sent
34 // to java as the
35 // priority of a suggested word
36
37 class DicNode;
38 class DicTraverseSession;
39 class ProximityInfo;
40 class Scoring;
41 class SuggestionResults;
42 class Traversal;
43 class Weighting;
44
45 class Suggest : public SuggestInterface {
46 public:
47 AK_FORCE_INLINE Suggest(const SuggestPolicy* const suggestPolicy)
48 : TRAVERSAL(suggestPolicy ? suggestPolicy->getTraversal() : nullptr),
49 SCORING(suggestPolicy ? suggestPolicy->getScoring() : nullptr),
50 WEIGHTING(suggestPolicy ? suggestPolicy->getWeighting() : nullptr) {}
51 AK_FORCE_INLINE virtual ~Suggest() {}
52 void getSuggestions(ProximityInfo* pInfo,
53 void* traverseSession,
54 int* inputXs,
55 int* inputYs,
56 int* times,
57 int* pointerIds,
58 int* inputCodePoints,
59 int inputSize,
60 const float languageWeight,
61 SuggestionResults* const outSuggestionResults) const;
62
63 private:
64 DISALLOW_IMPLICIT_CONSTRUCTORS(Suggest);
65 void createNextWordDicNode(DicTraverseSession* traverseSession,
66 DicNode* dicNode,
67 const bool spaceSubstitution) const;
68 void initializeSearch(DicTraverseSession* traverseSession) const;
69 void expandCurrentDicNodes(DicTraverseSession* traverseSession) const;
70 void processTerminalDicNode(DicTraverseSession* traverseSession,
71 DicNode* dicNode) const;
72 void processExpandedDicNode(DicTraverseSession* traverseSession,
73 DicNode* dicNode) const;
74 void weightChildNode(DicTraverseSession* traverseSession,
75 DicNode* dicNode) const;
76 void processDicNodeAsOmission(DicTraverseSession* traverseSession,
77 DicNode* dicNode) const;
78 void processDicNodeAsDigraph(DicTraverseSession* traverseSession,
79 DicNode* dicNode) const;
80 void processDicNodeAsTransposition(DicTraverseSession* traverseSession,
81 DicNode* dicNode) const;
82 void processDicNodeAsInsertion(DicTraverseSession* traverseSession,
83 DicNode* dicNode) const;
84 void processDicNodeAsAdditionalProximityChar(
85 DicTraverseSession* traverseSession,
86 DicNode* dicNode,
87 DicNode* childDicNode) const;
88 void processDicNodeAsSubstitution(DicTraverseSession* traverseSession,
89 DicNode* dicNode,
90 DicNode* childDicNode) const;
91 void processDicNodeAsMatch(DicTraverseSession* traverseSession,
92 DicNode* childDicNode) const;
93
94 static const int MIN_CONTINUOUS_SUGGESTION_INPUT_SIZE;
95
96 const Traversal* const TRAVERSAL;
97 const Scoring* const SCORING;
98 const Weighting* const WEIGHTING;
99 };
100 } // namespace latinime
101 #endif // LATINIME_SUGGEST_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698