• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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_NGRAM_PROPERTY_H
18 #define LATINIME_NGRAM_PROPERTY_H
19 
20 #include <vector>
21 
22 #include "defines.h"
23 #include "dictionary/property/historical_info.h"
24 #include "dictionary/property/ngram_context.h"
25 
26 namespace latinime {
27 
28 class NgramProperty {
29  public:
NgramProperty(const NgramContext & ngramContext,const std::vector<int> && targetCodePoints,const int probability,const HistoricalInfo historicalInfo)30     NgramProperty(const NgramContext &ngramContext, const std::vector<int> &&targetCodePoints,
31             const int probability, const HistoricalInfo historicalInfo)
32             : mNgramContext(ngramContext), mTargetCodePoints(std::move(targetCodePoints)),
33               mProbability(probability), mHistoricalInfo(historicalInfo) {}
34 
getNgramContext()35     const NgramContext *getNgramContext() const {
36         return &mNgramContext;
37     }
38 
getTargetCodePoints()39     const std::vector<int> *getTargetCodePoints() const {
40         return &mTargetCodePoints;
41     }
42 
getProbability()43     int getProbability() const {
44         return mProbability;
45     }
46 
getHistoricalInfo()47     const HistoricalInfo getHistoricalInfo() const {
48         return mHistoricalInfo;
49     }
50 
51  private:
52     // Default copy constructor is used for using in std::vector.
53     DISALLOW_DEFAULT_CONSTRUCTOR(NgramProperty);
54     DISALLOW_ASSIGNMENT_OPERATOR(NgramProperty);
55 
56     const NgramContext mNgramContext;
57     const std::vector<int> mTargetCodePoints;
58     const int mProbability;
59     const HistoricalInfo mHistoricalInfo;
60 };
61 } // namespace latinime
62 #endif // LATINIME_NGRAM_PROPERTY_H
63