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

📄 bayesol.h

📁 dbacl是一个通用目的的digramic贝叶斯文本分类器。它可以学习你提供的文本
💻 H
字号:
/*  * Copyright (C) 2002 Laird Breyer *   * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *  * Author:   Laird Breyer <laird@lbreyer.com> */#ifdef HAVE_CONFIG_H#include "config.h"#endif#if !defined HAVE_WCHAR_H || !defined HAVE_WCTYPE_H#undef HAVE_LIBBOOST_REGEX#endif#if defined HAVE_LIBBOOST_REGEX#define UNICODE#include <boost/regex.h>#else #include <sys/types.h>#include <regex.h>#endif/* some systems seem to have broken sys/types */#if defined OS_SUN#include <ieeefp.h>typedef uint8_t u_int8_t;typedef uint16_t u_int16_t;typedef uint32_t u_int32_t;typedef uint64_t u_int64_t;#endiftypedef u_int8_t category_count_t;typedef double real_value_t;typedef u_int8_t submatch_order_t;typedef u_int8_t regex_count_t;typedef int charbuf_len_t;typedef int error_code_t;typedef int bool_t;#define BUFLEN ((charbuf_len_t)1024)/* maximum number of categories we can handle simultaneously */#define MAX_CAT ((category_count_t)64)/* options */#define OPTION_RISKSPEC     1#define OPTION_SCORES       4#define OPTION_VERBOSE      5#define INPUT_FROM_CMDLINE  6#define OPTION_FILTER       10#define OPTION_DEBUG        15#define OPTION_I18N         16typedef u_int32_t options_t; /* make sure big enough for all options */typedef long int re_bitfield;/* maximum number of regular expressions we can handle */#define MAX_RE ((regex_count_t)(8 * sizeof(re_bitfield)))/* maximum number of tagged subexpressions we can handle for each regex */#define MAX_SUBMATCH ((submatch_order_t)10)/* when the ratio of complexities is below this value, flag a problem */#define MEANINGLESS_THRESHOLD 0.9/* macros *//* data structures */typedef struct lv {  char *re;  char *ve;  bool_t found;  struct lv *next;  real_value_t sm[MAX_SUBMATCH];} LossVector;typedef struct rm {  regex_t reg;  LossVector *lv;  struct rm *next;} RegMatch;typedef struct {  category_count_t num_cats;  category_count_t num_priors;  char* catname[MAX_CAT];  real_value_t prior[MAX_CAT];  LossVector* loss_list[MAX_CAT];  RegMatch *regs;  real_value_t cross_entropy[MAX_CAT];  real_value_t complexity[MAX_CAT];  real_value_t loss_matrix[MAX_CAT][MAX_CAT];} Spec;

⌨️ 快捷键说明

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