| 1 | /* | 
| 2 |  * Qt implementation of OpenWnn library | 
| 3 |  * This file is part of the Qt Virtual Keyboard module. | 
| 4 |  * Contact: http://www.qt.io/licensing/ | 
| 5 |  * | 
| 6 |  * Copyright (C) 2015  The Qt Company | 
| 7 |  * Copyright (C) 2008-2012  OMRON SOFTWARE Co., Ltd. | 
| 8 |  * | 
| 9 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
| 10 |  * you may not use this file except in compliance with the License. | 
| 11 |  * You may obtain a copy of the License at | 
| 12 |  * | 
| 13 |  *      http://www.apache.org/licenses/LICENSE-2.0 | 
| 14 |  * | 
| 15 |  * Unless required by applicable law or agreed to in writing, software | 
| 16 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
| 17 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 18 |  * See the License for the specific language governing permissions and | 
| 19 |  * limitations under the License. | 
| 20 |  */ | 
| 21 |  | 
| 22 | #ifndef OPENWNNENGINEJAJP_H | 
| 23 | #define OPENWNNENGINEJAJP_H | 
| 24 |  | 
| 25 | #include <QObject> | 
| 26 | #include "composingtext.h" | 
| 27 |  | 
| 28 | class OpenWnnEngineJAJPPrivate; | 
| 29 |  | 
| 30 | class OpenWnnEngineJAJP : public QObject | 
| 31 | { | 
| 32 |     Q_OBJECT | 
| 33 |     Q_DISABLE_COPY(OpenWnnEngineJAJP) | 
| 34 |     Q_DECLARE_PRIVATE(OpenWnnEngineJAJP) | 
| 35 | public: | 
| 36 |     explicit OpenWnnEngineJAJP(QObject *parent = 0); | 
| 37 |     ~OpenWnnEngineJAJP(); | 
| 38 |  | 
| 39 |     enum DictionaryType { | 
| 40 |         /** Dictionary type (default) */ | 
| 41 |         DIC_LANG_INIT = 0, | 
| 42 |         /** Dictionary type (Japanese standard) */ | 
| 43 |         DIC_LANG_JP = 0, | 
| 44 |         /** Dictionary type (English standard) */ | 
| 45 |         DIC_LANG_EN = 1, | 
| 46 |         /** Dictionary type (Japanese person's name) */ | 
| 47 |         DIC_LANG_JP_PERSON_NAME = 2, | 
| 48 |         /** Dictionary type (User dictionary) */ | 
| 49 |         DIC_USERDIC = 3, | 
| 50 |         /** Dictionary type (Japanese EISU-KANA conversion) */ | 
| 51 |         DIC_LANG_JP_EISUKANA = 4, | 
| 52 |         /** Dictionary type (e-mail/URI) */ | 
| 53 |         DIC_LANG_EN_EMAIL_ADDRESS = 5, | 
| 54 |         /** Dictionary type (Japanese postal address) */ | 
| 55 |         DIC_LANG_JP_POSTAL_ADDRESS = 6, | 
| 56 |     }; | 
| 57 |  | 
| 58 |     enum KeyboardType { | 
| 59 |         /** Keyboard type (not defined) */ | 
| 60 |         KEYBOARD_UNDEF = 0, | 
| 61 |         /** Keyboard type (12-keys) */ | 
| 62 |         KEYBOARD_KEYPAD12 = 1, | 
| 63 |         /** Keyboard type (Qwerty) */ | 
| 64 |         KEYBOARD_QWERTY = 2, | 
| 65 |     }; | 
| 66 |  | 
| 67 |     enum { | 
| 68 |         /** Score(frequency value) of word in the learning dictionary */ | 
| 69 |         FREQ_LEARN = 600, | 
| 70 |         /** Score(frequency value) of word in the user dictionary */ | 
| 71 |         FREQ_USER = 500, | 
| 72 |         /** Maximum limit length of output */ | 
| 73 |         MAX_OUTPUT_LENGTH = 50, | 
| 74 |         /** Limitation of predicted candidates */ | 
| 75 |         PREDICT_LIMIT = 100, | 
| 76 |         /** Limitation of candidates one-line */ | 
| 77 |         LIMIT_OF_CANDIDATES_1LINE = 500, | 
| 78 |     }; | 
| 79 |  | 
| 80 |     bool setDictionary(DictionaryType type); | 
| 81 |     int predict(const ComposingText &text, int minLen, int maxLen); | 
| 82 |     int convert(ComposingText &text); | 
| 83 |     QSharedPointer<WnnWord> getNextCandidate(); | 
| 84 |     bool learn(WnnWord &word); | 
| 85 |     void breakSequence(); | 
| 86 |     int makeCandidateListOf(int clausePosition); | 
| 87 | }; | 
| 88 |  | 
| 89 | #endif // OPENWNNENGINEJAJP_H | 
| 90 |  |