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_WORD_PROPERTY_H 18 #define LATINIME_WORD_PROPERTY_H 19 20 #include <vector> 21 22 #include "defines.h" 23 #include "dictionary/property/ngram_property.h" 24 #include "dictionary/property/unigram_property.h" 25 #include "utils/int_array_view.h" 26 27 namespace latinime { 28 29 // This class is used for returning information belonging to a word to java side. 30 class WordProperty { 31 public: 32 // Default constructor is used to create an instance that indicates an invalid word. WordProperty()33 WordProperty() 34 : mCodePoints(), mUnigramProperty(), mNgrams() {} 35 WordProperty(const std::vector<int> && codePoints,const UnigramProperty & unigramProperty,const std::vector<NgramProperty> & ngrams)36 WordProperty(const std::vector<int> &&codePoints, const UnigramProperty &unigramProperty, 37 const std::vector<NgramProperty> &ngrams) 38 : mCodePoints(std::move(codePoints)), mUnigramProperty(unigramProperty), 39 mNgrams(ngrams) {} 40 getCodePoints()41 const CodePointArrayView getCodePoints() const { 42 return CodePointArrayView(mCodePoints); 43 } 44 getUnigramProperty()45 const UnigramProperty &getUnigramProperty() const { 46 return mUnigramProperty; 47 } 48 getNgramProperties()49 const std::vector<NgramProperty> &getNgramProperties() const { 50 return mNgrams; 51 } 52 53 private: 54 // Default copy constructor is used for using as a return value. 55 DISALLOW_ASSIGNMENT_OPERATOR(WordProperty); 56 57 const std::vector<int> mCodePoints; 58 const UnigramProperty mUnigramProperty; 59 const std::vector<NgramProperty> mNgrams; 60 }; 61 } // namespace latinime 62 #endif // LATINIME_WORD_PROPERTY_H 63