1 /** 2 * userphrase.h 3 * 4 * Copyright (c) 1999, 2000, 2001 5 * Lu-chuan Kung and Kang-pen Chen. 6 * All rights reserved. 7 * 8 * Copyright (c) 2004 9 * libchewing Core Team. See ChangeLog for details. 10 * 11 * See the file "COPYING" for information on usage and redistribution 12 * of this file. 13 */ 14 15 #ifndef USERPHRASE_H 16 #define USERPHRASE_H 17 18 #define FREQ_INIT_VALUE (1) 19 #define SHORT_INCREASE_FREQ (10) 20 #define MEDIUM_INCREASE_FREQ (5) 21 #define LONG_DECREASE_FREQ (10) 22 #define MAX_ALLOW_FREQ (99999999) 23 24 #define USER_UPDATE_FAIL (4) 25 #define USER_UPDATE_INSERT (1) 26 #define USER_UPDATE_MODIFY (2) 27 #define USER_UPDATE_IGNORE (8) 28 29 #include "global.h" 30 31 typedef struct { 32 uint16 *phoneSeq; 33 char *wordSeq; 34 int userfreq; 35 int recentTime; 36 int origfreq; /* the initial frequency of this phrase */ 37 int maxfreq; /* the maximum frequency of the phrase of the same pid */ 38 } UserPhraseData ; 39 40 /** 41 * @brief Update or add a new UserPhrase. 42 * 43 * @param phoneSeq[] Phone sequence 44 * @param wordSeq[] Phrase against the phone sequence 45 * 46 * @return 47 * @retval USER_UPDATE_FAIL Update fail. 48 * @retval USER_UPDATE_INSERT Sequence is new, add new entry. 49 * @retval USER_UPDATE_MODIFY Sequence is existing, update it's data. 50 */ 51 int UserUpdatePhrase( const uint16 phoneSeq[], const char wordSeq[] ); 52 53 /** 54 * @brief Read the first phrase of the phone in user phrase database. 55 * 56 * @param phoneSeq[] Phone sequence 57 * 58 * @return UserPhraseData, if it's not existing then return NULL. 59 */ 60 UserPhraseData *UserGetPhraseFirst( const uint16 phoneSeq[] ); 61 62 /** 63 * @brief Read the next phrase of the phone in user phrase database. 64 * 65 * @param phoneSeq[] Phone sequence 66 * 67 * @return UserPhraseData, if it's not existing then return NULL. 68 */ 69 UserPhraseData *UserGetPhraseNext( const uint16 phoneSeq[] ); 70 71 #endif 72 73