dict.h
来自「用python写的分词程序,实现的是最大匹配方法,简单易用」· C头文件 代码 · 共 35 行
H
35 行
#ifndef _DICT_H_#define _DICT_H_#include "word.h"/** * A dictionary is a hash table of * - key: string * - value: word * * Dictionary data can be loaded from files. Two type of dictionary * files are supported: * - character file: Each line contains a number and a character, * the number is the frequency of the character. * The frequency should NOT exceeds 65535. * - word file: Each line contains a number and a word, the * number is the character count of the word. */namespace rmmseg{ /* Instead of making a class with only one instance, i'll not * bother to make it a class here. */ namespace dict { void add(Word *word); bool load_chars(const char *filename); bool load_words(const char *filename); Word *get(const char *str, int len); }}#endif /* _DICT_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?