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