Logo Search packages:      
Sourcecode: zh-autoconvert version File versions  Download package

gbpercent.c

/* ANSI-C code produced by gperf version 2.7.1 (19981006 egcs) */
/* Command-line: gperf -L ANSI-C -I -t -H gbHash -N inGB -C -E -o -n -c -D gbpercent.txt  */
/****************************************************
 400 Most frequently used GB chars. 
 ****************************************************/
#include <string.h>
#include "zhstatis.h"

/* maximum key range = 991, duplicates = 5 */

#ifdef __GNUC__
__inline
#endif
static unsigned int
gbHash (register const char *str, register unsigned int len)
{
  static const unsigned short asso_values[] =
    {
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991, 991, 991, 991, 991, 991, 991, 991, 991, 991,
      991,  91, 425, 320, 148,  70, 510,  85, 203, 160,
        6,  18, 480, 223, 113, 345,  28, 120, 320, 390,
       75,  20, 275, 380, 230,  50, 433,  15, 145,   5,
      455, 460, 163, 180, 338,  40,   8, 508, 510,  45,
      325,  85,  30, 140, 105, 305,   3, 225, 100, 403,
      113, 480,  25, 205,   0, 250, 393, 371,  63, 260,
      268, 991,  10, 470, 405, 268, 348,  76, 285, 131,
      408, 398, 991, 125, 330, 126, 388, 503,  51, 148,
      350,  46,   1, 166,  15,  16, 485, 106, 458,  41,
      103, 221,  21,  61, 500, 991
    };
  return asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
}

#ifdef __GNUC__
__inline
#endif
const struct charHz *
inGB (register const char *str, register unsigned int len)
{
  enum
    {
      TOTAL_KEYWORDS = 400,
      MIN_WORD_LENGTH = 2,
      MAX_WORD_LENGTH = 2,
      MIN_HASH_VALUE = 0,
      MAX_HASH_VALUE = 990
    };

  static const struct charHz wordlist[] =
    {
      {"种",      0.151748},
      {"治",      0.062792},
      {"知",      0.176508},
      {"为",      0.442767},
      {"文",      0.214763},
      {"无",      0.213959},
      {"只",      0.229438},
      {"或",      0.085280},
      {"位",      0.128747},
      {"交",      0.073778},
      {"华",      0.094296},
      {"将",      0.168043},
      {"到",      0.514231},
      {"近",      0.063487},
      {"的",      3.500849},
      {"手",      0.211674},
      {"元",      0.071841},
      {"问",      0.140707},
      {"式",      0.057680},
      {"但",      0.167690},
      {"怎",      0.072121},
      {"话",      0.146944},
      {"术",      0.070839},
      {"务",      0.081974},
      {"实",      0.156769},
      {"今",      0.083052},
      {"那",      0.382771},
      {"没",      0.244614},
      {"基",      0.057849},
      {"毛",      0.075090},
      {"得",      0.396983},
      {"命",      0.093383},
      {"众",      0.058726},
      {"还",      0.233198},
      {"活",      0.092784},
      {"公",      0.188655},
      {"倒",      0.054738},
      {"内",      0.111181},
      {"前",      0.200232},
      {"是",      1.345411},
      {"打",      0.129442},
      {"次",      0.121678},
      {"未",      0.054546},
      {"使",      0.118288},
      {"第",      0.123170},
      {"你",      0.436374},
      {"们",      0.495768},
      {"民",      0.174189},
      {"在",      0.964866},
      {"山",      0.103285},
      {"数",      0.091243},
      {"传",      0.063780},
      {"点",      0.152685},
      {"中",      0.717652},
      {"甚",      0.058755},
      {"色",      0.074190},
      {"叫",      0.089328},
      {"主",      0.204736},
      {"心",      0.273937},
      {"西",      0.117537},
      {"教",      0.117812},
      {"过",      0.327524},
      {"之",      0.327879},
      {"因",      0.127394},
      {"么",      0.276714},
      {"我",      1.014949},
      {"机",      0.137512},
      {"要",      0.370943},
      {"直",      0.075193},
      {"条",      0.064573},
      {"太",      0.103034},
      {"性",      0.095783},
      {"声",      0.151640},
      {"一",      1.703619},
      {"市",      0.101242},
      {"神",      0.091301},
      {"业",      0.134539},
      {"五",      0.103181},
      {"被",      0.126292},
      {"深",      0.060073},
      {"以",      0.349432},
      {"当",      0.222406},
      {"爱",      0.073591},
      {"十",      0.211422},
      {"员",      0.097189},
      {"明",      0.152480},
      {"四",      0.123866},
      {"时",      0.412130},
      {"物",      0.078221},
      {"国",      0.624527},
      {"半",      0.061338},
      {"书",      0.098381},
      {"钱",      0.055097},
      {"说",      0.508134},
      {"它",      0.075883},
      {"极",      0.055787},
      {"运",      0.061514},
      {"听",      0.115919},
      {"八",      0.075698},
      {"情",      0.143753},
      {"请",      0.073937},
      {"及",      0.083070},
      {"写",      0.056349},
      {"清",      0.078525},
      {"代",      0.104545},
      {"至",      0.079151},
      {"林",      0.074843},
      {"所",      0.197660},
      {"道",      0.421135},
      {"两",      0.176988},
      {"联",      0.064201},
      {"生",      0.343557},
      {"记",      0.077728},
      {"小",      0.293018},
      {"世",      0.114808},
      {"留",      0.063376},
      {"便",      0.128778},
      {"工",      0.149985},
      {"行",      0.203868},
      {"她",      0.305242},
      {"美",      0.152936},
      {"建",      0.074596},
      {"战",      0.076361},
      {"求",      0.059639},
      {"李",      0.057653},
      {"此",      0.158364},
      {"算",      0.073128},
      {"花",      0.065122},
      {"即",      0.059687},
      {"六",      0.070030},
      {"达",      0.061845},
      {"现",      0.169370},
      {"向",      0.143764},
      {"江",      0.058127},
      {"指",      0.068890},
      {"令",      0.055467},
      {"南",      0.074475},
      {"收",      0.055267},
      {"体",      0.100845},
      {"来",      0.642527},
      {"北",      0.113407},
      {"大",      0.670268},
      {"义",      0.072306},
      {"系",      0.085791},
      {"原",      0.089937},
      {"字",      0.074014},
      {"更",      0.087664},
      {"水",      0.102945},
      {"展",      0.063943},
      {"转",      0.059482},
      {"家",      0.324818},
      {"些",      0.166013},
      {"名",      0.142495},
      {"正",      0.143041},
      {"周",      0.062711},
      {"该",      0.063875},
      {"果",      0.084231},
      {"结",      0.070334},
      {"自",      0.340950},
      {"能",      0.253537},
      {"白",      0.089789},
      {"资",      0.066471},
      {"会",      0.342850},
      {"思",      0.068379},
      {"流",      0.067758},
      {"武",      0.061514},
      {"技",      0.058356},
      {"东",      0.121345},
      {"亲",      0.084066},
      {"受",      0.084736},
      {"对",      0.311761},
      {"远",      0.066691},
      {"最",      0.134213},
      {"死",      0.089264},
      {"识",      0.056331},
      {"万",      0.101912},
      {"台",      0.078054},
      {"上",      0.636581},
      {"里",      0.300629},
      {"轻",      0.058334},
      {"干",      0.076271},
      {"儿",      0.146378},
      {"管",      0.067145},
      {"了",      1.283668},
      {"王",      0.084392},
      {"报",      0.094190},
      {"步",      0.060622},
      {"任",      0.079391},
      {"感",      0.088464},
      {"跟",      0.065369},
      {"不",      1.307755},
      {"各",      0.080068},
      {"年",      0.402590},
      {"然",      0.251950},
      {"住",      0.097438},
      {"全",      0.151277},
      {"等",      0.136630},
      {"往",      0.064102},
      {"安",      0.090869},
      {"什",      0.130740},
      {"想",      0.217789},
      {"解",      0.081322},
      {"金",      0.088088},
      {"作",      0.224425},
      {"德",      0.055379},
      {"化",      0.107695},
      {"他",      0.826706},
      {"月",      0.152597},
      {"让",      0.073580},
      {"见",      0.196038},
      {"事",      0.229908},
      {"共",      0.077287},
      {"提",      0.088749},
      {"几",      0.135949},
      {"革",      0.060397},
      {"分",      0.168552},
      {"夫",      0.067138},
      {"利",      0.084762},
      {"方",      0.202303},
      {"三",      0.185462},
      {"老",      0.182608},
      {"持",      0.053845},
      {"象",      0.078045},
      {"重",      0.126537},
      {"去",      0.330934},
      {"再",      0.117460},
      {"光",      0.084711},
      {"百",      0.072738},
      {"却",      0.105046},
      {"呢",      0.056342},
      {"界",      0.083728},
      {"变",      0.064229},
      {"回",      0.156121},
      {"车",      0.089804},
      {"党",      0.054791},
      {"难",      0.092669},
      {"地",      0.430809},
      {"吃",      0.072425},
      {"办",      0.061534},
      {"电",      0.125012},
      {"都",      0.252867},
      {"产",      0.103862},
      {"非",      0.068245},
      {"言",      0.064196},
      {"间",      0.131700},
      {"把",      0.158959},
      {"也",      0.412956},
      {"候",      0.061082},
      {"城",      0.060972},
      {"何",      0.088065},
      {"新",      0.131476},
      {"保",      0.061942},
      {"满",      0.057693},
      {"关",      0.112545},
      {"样",      0.169738},
      {"比",      0.097747},
      {"面",      0.188836},
      {"青",      0.067301},
      {"入",      0.103631},
      {"题",      0.074605},
      {"反",      0.087462},
      {"少",      0.112757},
      {"院",      0.064434},
      {"父",      0.060794},
      {"意",      0.161359},
      {"进",      0.161229},
      {"人",      1.081233},
      {"开",      0.211932},
      {"目",      0.094628},
      {"别",      0.100654},
      {"觉",      0.075649},
      {"好",      0.253067},
      {"成",      0.232004},
      {"军",      0.104464},
      {"定",      0.141283},
      {"又",      0.202277},
      {"场",      0.098824},
      {"社",      0.071268},
      {"接",      0.076121},
      {"学",      0.313110},
      {"士",      0.059531},
      {"天",      0.262760},
      {"程",      0.058312},
      {"特",      0.075691},
      {"每",      0.067385},
      {"区",      0.059983},
      {"强",      0.060747},
      {"通",      0.095327},
      {"制",      0.081732},
      {"必",      0.060990},
      {"平",      0.116858},
      {"已",      0.183761},
      {"总",      0.099417},
      {"用",      0.208392},
      {"口",      0.119434},
      {"黄",      0.055445},
      {"望",      0.075475},
      {"权",      0.064165},
      {"日",      0.238170},
      {"带",      0.065223},
      {"看",      0.216015},
      {"长",      0.176671},
      {"师",      0.098604},
      {"于",      0.237050},
      {"可",      0.310500},
      {"门",      0.123004},
      {"先",      0.103316},
      {"认",      0.073529},
      {"这",      0.748073},
      {"从",      0.181841},
      {"功",      0.069931},
      {"下",      0.366675},
      {"由",      0.106073},
      {"领",      0.063793},
      {"脸",      0.055222},
      {"期",      0.089414},
      {"本",      0.197245},
      {"己",      0.148374},
      {"有",      0.846428},
      {"法",      0.158459},
      {"处",      0.099988},
      {"身",      0.167521},
      {"边",      0.077498},
      {"派",      0.057761},
      {"司",      0.084963},
      {"论",      0.072820},
      {"后",      0.297066},
      {"度",      0.074446},
      {"许",      0.075854},
      {"立",      0.093914},
      {"与",      0.165147},
      {"信",      0.114573},
      {"笑",      0.096279},
      {"真",      0.116060},
      {"京",      0.082472},
      {"动",      0.178348},
      {"女",      0.141049},
      {"表",      0.090741},
      {"加",      0.109685},
      {"语",      0.057889},
      {"相",      0.122566},
      {"完",      0.060534},
      {"告",      0.058129},
      {"量",      0.059348},
      {"件",      0.090981},
      {"息",      0.056893},
      {"外",      0.167708},
      {"计",      0.085688},
      {"合",      0.087272},
      {"连",      0.067046},
      {"眼",      0.101187},
      {"空",      0.058894},
      {"理",      0.154598},
      {"者",      0.145362},
      {"经",      0.189995},
      {"多",      0.270297},
      {"头",      0.189444},
      {"给",      0.136868},
      {"力",      0.138951},
      {"统",      0.074402},
      {"高",      0.162739},
      {"很",      0.134687},
      {"政",      0.120122},
      {"常",      0.089189},
      {"张",      0.093070},
      {"个",      0.594848},
      {"路",      0.089668},
      {"走",      0.125810},
      {"如",      0.201591},
      {"子",      0.441396},
      {"而",      0.260181},
      {"做",      0.086397},
      {"和",      0.440206},
      {"并",      0.111459},
      {"海",      0.119826},
      {"队",      0.066006},
      {"着",      0.335011},
      {"就",      0.389616},
      {"二",      0.155393},
      {"风",      0.076789},
      {"部",      0.143537},
      {"同",      0.187525},
      {"其",      0.152385},
      {"发",      0.232956},
      {"红",      0.063231},
      {"才",      0.099303},
      {"马",      0.093403},
      {"快",      0.064661},
      {"起",      0.235155},
      {"出",      0.425756},
      {"服",      0.075191},
      {"放",      0.087173},
      {"品",      0.059628},
      {"英",      0.057878},
      {"决",      0.062792},
      {"九",      0.096854},
      {"气",      0.114705},
      {"科",      0.072145},
      {"七",      0.061058},
      {"应",      0.089767}
    };

  static const short lookup[] =
    {
         0,   -1,   -1,    1,   -1,   -1,    2,   -1,
        -1,    3,   -1,    4,   -1,    5,   -1,    6,
         7,   -1,    8,   -1,    9,   10,   -1,   11,
        -1,   12,   13,   -1,   14,   -1,   15,   16,
        -1,   17,   -1,   18,   -1,   -1,   19,   -1,
        -1,   20,   -1,   21,   -1,   -1,   22,   -1,
        -1,   23,   24,   25,   -1,   26,   -1,   27,
        28,   -1,   29,   -1,   30,   31,   -1,   32,
        -1,   33,   34,   -1,   35,   -1,   36,   37,
        -1,   38,   -1,   39,   40,   -1, -482,   -1,
        43, -359,   -2,   44,   45,   46,   47,   -1,
        48,   -1,   49,   50,   -1,   51,   -1,   -1,
        52,   -1,   -1,   -1,   53,   54,   -1,   55,
        -1,   56,   57,   -1,   58,   59,   60,   61,
        -1,   62,   63,   64,   65,   -1,   66,   67,
        68,   69,   -1,   70,   -1,   71,   72,   -1,
        73,   -1,   74,   75,   -1,   76,   77,   78,
        79,   -1,   80,   -1,   81,   82,   -1,   83,
        -1,   84,   85,   -1,   86,   -1,   87,   88,
        -1,   89,   90,   91,   -1,   -1,   92,   -1,
        93,   94,   -1,   95,   -1,   96,   97,   -1,
        98,   -1,   99,  100,   -1,  101,   -1,  102,
       103,   -1,  104,   -1, -605,  107,   -1,  108,
        -1,  109,  110,   -1,  111,   -1,  112,  113,
        -1,  114,   -1,  115,  116,   -1,  117,   -1,
       118,  119,   -1,  120, -295,   -2,   -1,   -1,
       121,   -1,  122,  123,   -1,   -1,  124,  125,
       126,   -1,  127,   -1,  128,  129,   -1,  130,
        -1,  131,  132,   -1,  133,   -1,  134,  135,
        -1,  136,   -1,  137,  138,   -1,  139,   -1,
       140,  141,   -1,   -1,  142,  143,   -1,   -1,
       144,   -1,  145,  146,   -1,  147,   -1,  148,
       149,   -1,  150,   -1,  151,  152,   -1,   -1,
        -1,   -1,  153,   -1,  154,   -1,  155,  156,
        -1,  157,   -1,  158,  159,   -1,  160,   -1,
       161,   -1,   -1,  162,   -1,  163,  164,   -1,
       165,   -1,  166,   -1,   -1,  167,   -1,  168,
        -1,   -1,  169,   -1, -727,  172,   -1,  173,
        -1,  174,  175,   -1,  176,   -1,  177,  178,
        -1,  179,   -1,  180,  181,   -1,  182,   -1,
       183,  184,   -1,  185,   -1,  186, -230,   -2,
       187,   -1,  188,   -1,   -1,  189,   -1,  190,
       191,   -1,  192,   -1,  193,  194,   -1,  195,
        -1,  196,  197,   -1,  198,   -1,  199,  200,
        -1,  201,   -1,  202,  203,   -1,  204,   -1,
       205,  206,   -1,  207,   -1,  208,  209,   -1,
       210,   -1,  211,   -1,   -1,  212,   -1,  213,
        -1,   -1,  214,   -1,  215,  216,   -1,   -1,
       217,  218,  219,   -1,  220,   -1,  221,  222,
        -1,  223,   -1,  224,  225,   -1,  226,  227,
       228,  229,   -1,  230,   -1,  231,   -1,   -1,
       232,   -1, -822,  235,   -1,  236,   -1,  237,
       238,   -1,  239,   -1,  240, -167,   -2,  241,
        -1,  242,   -1,   -1,  243,   -1,  244,  245,
        -1,  246,  247,  248,  249,   -1,  250,   -1,
       251,  252,   -1,  253,  254,  255,   -1,   -1,
       256,   -1,  257,  258,   -1,  259,   -1,  260,
       261,   -1,  262,   -1,  263,  264,   -1,  265,
        -1,  266,  267,   -1,  268,   -1,  269,  270,
        -1,  271,   -1,  272,  273,   -1,  274,   -1,
       275,  276,   -1,  277,   -1,  278,   -1,   -1,
       279,   -1,  280,   -1,   -1,  281,   -1,  282,
        -1,   -1,  283,   -1,  284,   -1,   -1,  285,
        -1,  286,   -1,   -1,  287,   -1,  288,   -1,
        -1,  289,   -1,  290,  291,   -1,  292,   -1,
       293,   -1,   -1,  294,   -1,  295,  296,   -1,
       297,   -1,  298,   -1,   -1,  299,   -1,  300,
        -1,   -1,  301,   -1,  302,   -1,   -1,  303,
        -1,  304,   -1,   -1,  305,   -1, -952,  -94,
        -2,  308,   -1,  309,   -1,   -1,   -1,   -1,
       310,   -1,   -1,  311,   -1,  312,   -1,   -1,
       313,   -1,  314,   -1,   -1,  315,   -1,  316,
        -1,   -1,  317,   -1,  318,   -1,   -1,  319,
        -1,  320,   -1,   -1,  321,   -1,  322,   -1,
        -1,  323,   -1,  324,   -1,   -1,  325,  326,
       327,   -1,   -1,  328,   -1,  329,  330,   -1,
       331,   -1,  332,   -1,   -1,  333,   -1,  334,
        -1,   -1,   -1,   -1,  335,  336,   -1,  337,
        -1,  338,   -1,   -1,  339,   -1,  340,   -1,
        -1,   -1,   -1,  341,   -1,   -1,  342,   -1,
       343,   -1,   -1,   -1,   -1,  344,   -1,   -1,
        -1,   -1,  345,   -1,   -1,  346,   -1,  347,
        -1,   -1,  348,   -1,  349,   -1,   -1,  350,
        -1,  351,  352,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,  353,   -1,   -1,  354,   -1,
       355,   -1,   -1,   -1,   -1,  356,   -1,   -1,
       357,   -1,  358,   -1,   -1,   -1,   -1,  359,
        -1,   -1,   -1,   -1,  360,  361,   -1,   -1,
        -1,  362,   -1,   -1,   -1,   -1,  363,   -1,
        -1,  364,   -1,  365,   -1,   -1,  366,   -1,
       367,   -1,   -1,  368,   -1,   -1,   -1,   -1,
        -1,   -1,  369,   -1,   -1,  370,   -1,  371,
        -1,   -1,  372,   -1,   -1,   -1,   -1,   -1,
        -1,  373,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,  374,   -1,  375,   -1,   -1,  376,   -1,
       377,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,  378,
        -1,   -1,  379,   -1,  380,   -1,   -1,   -1,
        -1,  381,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,  382,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,  383,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,  384,   -1,   -1,
        -1,   -1,   -1,   -1,  385,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,  386,   -1,   -1,   -1,   -1,   -1,   -1,
       387,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,  388,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,  389,   -1,   -1,   -1,   -1,
       390,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
       391,   -1,  392,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,  393,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,  394,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,  395,   -1,   -1,   -1,   -1,
       396,   -1,  397,   -1,   -1,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,  398,   -1,   -1,   -1,
        -1,   -1,   -1,   -1,   -1,   -1,  399
    };

  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
    {
      register int key = gbHash (str, len);

      if (key <= MAX_HASH_VALUE && key >= 0)
        {
          register int index = lookup[key];

          if (index >= 0)
            {
              register const char *s = wordlist[index].name;

              if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
                return &wordlist[index];
            }
          else if (index < -TOTAL_KEYWORDS)
            {
              register int offset = - 1 - TOTAL_KEYWORDS - index;
              register const struct charHz *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
              register const struct charHz *wordendptr = wordptr + -lookup[offset + 1];

              while (wordptr < wordendptr)
                {
                  register const char *s = wordptr->name;

                  if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
                    return wordptr;
                  wordptr++;
                }
            }
        }
    }
  return 0;
}

Generated by  Doxygen 1.6.0   Back to index