⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wordhash.main.c

📁 一个C语言写的快速贝叶斯垃圾邮件过滤工具
💻 C
字号:
/* $Id: wordhash.main.c,v 1.10 2005/03/16 03:37:13 m-a Exp $ */#include "common.h"#include "wordhash.h"typedef struct{  int count;}wh_elt_t;/* function definitions */static void word_init(void *vw){     wh_elt_t *w = vw;     w->count = 0;   }static voiddump_hash (wordhash_t * h){  hashnode_t *p;  for (p = wordhash_first (h); p != NULL; p = wordhash_next (h))    {      word_t *key = p->key;      (void)word_puts(key, 0, stdout);      (void)printf (" %d\n", ((wh_elt_t *) p->buf)->count);    }}intmain (void){  wordhash_t *h = wordhash_new ();  char buf[100];  wh_elt_t *w;  while (scanf ("%99s", buf) != EOF)    {      word_t *t = word_news(buf);      w = wordhash_insert (h, t, sizeof (word_t), &word_init);      w->count++;    }  dump_hash (h);  wordhash_free (h);  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -