亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wi2dvf.c

?? 貝葉斯學習算法分類文本。基于樸素貝葉斯分類器的文本分類的通用算法
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Word-index to document-vector-file *//* Copyright (C) 1997 Andrew McCallum   Written by:  Andrew Kachites McCallum <mccallum@cs.cmu.edu>   This file is part of the Bag-Of-Words Library, `libbow'.   This library is free software; you can redistribute it and/or   modify it under the terms of the GNU Library General Public License   as published by the Free Software Foundation, version 2.      This library 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   Library General Public License for more details.   You should have received a copy of the GNU Library General Public   License along with this library; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */#include <bow/libbow.h>#include <netinet/in.h>		/* for machine-independent byte-order */#include <assert.h>#define INIT_BOW_DVF(DVF) { DVF.seek_start = -1; DVF.dv = NULL; }unsigned int bow_wi2dvf_default_capacity = 1024;bow_wi2dvf *bow_wi2dvf_new (int capacity){  bow_wi2dvf *ret;  int i;  if (capacity == 0)    capacity = bow_wi2dvf_default_capacity;  ret = bow_malloc (sizeof (bow_wi2dvf) + (sizeof (bow_dvf) * capacity));  ret->size = capacity;  ret->num_words = 0;  ret->fp = NULL;  for (i = 0; i < capacity; i++)    INIT_BOW_DVF(ret->entry[i]);  return ret;}/* xxx We should think about a scheme that doesn't require keeping all   the "document vectors" in core at the time time.  We could write   them to disk, read them back in when we needed to add to them, then   write them back out again.  We would need a nice caching scheme, as   well as nice way to deal with "document vectors" that grow. *//* Add a "word vector" WV, associated with "document index" DI, to    the map WI2DVF. */ voidbow_wi2dvf_add_di_wv (bow_wi2dvf **wi2dvf, int di, bow_wv *wv){  int i, wi;  int max_wi = bow_num_words ();  if (max_wi > (*wi2dvf)->size)    {      /* There are so many unique words, we need to grow the array	 that maps WI's to DVF's. */      int wi = (*wi2dvf)->size;	        /* a "word index" */      (*wi2dvf)->size = MAX (max_wi, (*wi2dvf)->size * 2);      (*wi2dvf) = bow_realloc (*wi2dvf, 			       (sizeof (bow_wi2dvf)				+ (sizeof (bow_dvf) * (*wi2dvf)->size)));      /* Initialize the new part of the realloc'ed space. */      for ( ; wi < (*wi2dvf)->size; wi++)	INIT_BOW_DVF((*wi2dvf)->entry[wi]);    }  /* Run down the "word vector", depositing each entry in the WI2DVF. */  for (i = 0; i < wv->num_entries; i++)    {      wi = wv->entry[i].wi;      assert ((*wi2dvf)->size > wi);      if ((*wi2dvf)->entry[wi].dv == NULL)	{	  /* There is not yet a "document vector" for "word index" WI,	     so create one. */	  (*wi2dvf)->entry[wi].dv = bow_dv_new (0);	  /* This 2 is a flag to the hide/unhide code that this DV exists. */	  (*wi2dvf)->entry[wi].seek_start = 2;	  ((*wi2dvf)->num_words)++;	}      /* Add the "document index" DI and the count associated with         word index WI to the WI'th "document vector". */      /* xxx Should we be adding WV->ENTRY[i].WEIGHT also? */      bow_dv_add_di_count_weight (&((*wi2dvf)->entry[wi].dv), di,				  wv->entry[i].count, 0);    }}/* Read all the words from file pointer FP, and add them to WI2DVF,   associated with document index DI. */voidbow_wi2dvf_add_di_text_fp (bow_wi2dvf **wi2dvf, int di, FILE *fp){  char word[BOW_MAX_WORD_LENGTH]; /* buffer for reading and stemming words */  int wi;			/* a word index */  bow_lex *lex;  /* Loop once for each document in this file. */  while ((lex = bow_default_lexer->open_text_fp (bow_default_lexer, fp)))    {      /* Loop once for each lexical token in this document. */      while (bow_default_lexer->get_word (bow_default_lexer,					  lex, word, BOW_MAX_WORD_LENGTH))	{	  /* Find out the word's "index". */	  wi = bow_word2int_add_occurrence (word);	  if (wi < 0)	    continue;	  /* Increment our stats about this word/document pair. */	  bow_wi2dvf_add_wi_di_count_weight (wi2dvf, wi, di, 1, 0);	}      bow_default_lexer->close (bow_default_lexer, lex);    }}/* In the map WI2DVF, increase by COUNT and WEIGHT our record of the   number times and weight that the document with "document index" DI   contains the word with "word index" WI. */voidbow_wi2dvf_add_wi_di_count_weight (bow_wi2dvf **wi2dvf, int wi,				   int di, int count, float weight){  if (wi >= (*wi2dvf)->size)    {      /* There are so many unique words, we need to grow the array	 that maps WI's to DVF's. */      int old_size = (*wi2dvf)->size; /* a "word vector" */      (*wi2dvf)->size = MAX (wi+1, (*wi2dvf)->size * 2);      (*wi2dvf) = bow_realloc (*wi2dvf, 			       (sizeof (bow_wi2dvf)				+ (sizeof (bow_dvf) * (*wi2dvf)->size)));      /* Initialize the new part of the realloc'ed space. */      for ( ; old_size < (*wi2dvf)->size; old_size++)	INIT_BOW_DVF((*wi2dvf)->entry[old_size]);    }   /* Increment the stats for the WI/DI pair. */  if ((*wi2dvf)->entry[wi].dv == NULL)    {      /* There is not yet a "document vector" for "word index" WI,	 so create one. */      (*wi2dvf)->entry[wi].dv = bow_dv_new (0);      /* This 2 is a flag to the hide/unhide code that this DV exists. */      (*wi2dvf)->entry[wi].seek_start = 2;      ((*wi2dvf)->num_words)++;    }  /* Add the "document index" DI and the count associated with     word index WI to the WI'th "document vector". */  bow_dv_add_di_count_weight (&((*wi2dvf)->entry[wi].dv), di, count, weight);}/* Return a pointer to the BOW_DE for a particular word/document pair,    or return NULL if there is no entry for that pair. */bow_de *bow_wi2dvf_entry_at_wi_di (bow_wi2dvf *wi2dvf, int wi, int di){  bow_dv *dv = bow_wi2dvf_dv (wi2dvf, wi);  if (!dv)    return NULL;  return bow_dv_entry_at_di (dv, di);}/* Remove the word with index WI from the vocabulary of the map WI2DVF */voidbow_wi2dvf_remove_wi (bow_wi2dvf *wi2dvf, int wi){  assert (wi < wi2dvf->size);  if (wi2dvf->entry[wi].dv)    {      bow_dv_free (wi2dvf->entry[wi].dv);      (wi2dvf->num_words)--;    }  INIT_BOW_DVF (wi2dvf->entry[wi]);}#define FREE_WHEN_HIDING_WI 0/* Temporarily hide the word with index WI from the vocabulary of the   map WI2DVF. The function BOW_WI2DVF_DV() will no longer see the entry   for this WI, but */voidbow_wi2dvf_hide_wi (bow_wi2dvf *wi2dvf, int wi){  assert (wi < wi2dvf->size);#if FREE_WHEN_HIDING_WI  if (wi2dvf->entry[wi].dv)    {      bow_dv_free (wi2dvf->entry[wi].dv);      /* (wi2dvf->num_words)--; */    }  wi2dvf->entry[wi].dv = NULL;#endif  /* The token -1 is reserved to mean that the DV is uninitialized. */  assert (!(wi2dvf->entry[wi].dv && wi2dvf->entry[wi].seek_start == -1));  /* Make the SEEK_START negative so we won't use it in normal situations,     but will be able to remember it and get it back when we need it. */  if (wi2dvf->entry[wi].seek_start > 0)    {      wi2dvf->entry[wi].seek_start = - (wi2dvf->entry[wi].seek_start);      (wi2dvf->num_words)--;    }}/* Make visible all DVF's that were hidden with BOW_WI2DVF_HIDE_WI(). */voidbow_wi2dvf_unhide_all_wi (bow_wi2dvf *wi2dvf){  int wi;  for (wi = 0; wi < wi2dvf->size; wi++)    {      if (wi2dvf->entry[wi].seek_start < -1)	{	  wi2dvf->entry[wi].seek_start = - (wi2dvf->entry[wi].seek_start);	  (wi2dvf->num_words)++;	}    }}/* Write WI2DVF to file-pointer FP, in a machine-independent format.   This is the format expected by bow_wi2dvf_new_from_fp(). */voidbow_wi2dvf_write (bow_wi2dvf *wi2dvf, FILE *fp){  long seek_base;  long seek_current;  int wi;  bow_wi2dvf_unhide_all_wi (wi2dvf);  /* Figure out how many bytes the WI2DVF (without the DV's) will     take at the beginning the file. */  seek_base =     (ftell (fp)			/* Where we are starting */     + (sizeof (int)		/* for the number of "word indices" */	+ (sizeof (int)		/* for each SEEK_START value */	   * wi2dvf->size)));	/* multiplied by the number of WI's */  /* Write the maximum "word index". */  bow_fwrite_int (wi2dvf->size, fp);  /* Figure out the correct SEEK_START values for all the DVF's,     set them in the DVF's data structure, and write out the DVF's     SEEK_START information. */  for (wi = 0, seek_current = seek_base; wi < wi2dvf->size; wi++)    {      if (wi2dvf->entry[wi].dv == NULL)	{	  /* Write an indication of a NULL document vector. */	  bow_fwrite_int (-1, fp);	  /* Set the SEEK_START in the data structure. */	  wi2dvf->entry[wi].seek_start = -1;	}      else	{	  /* Write the DVF's SEEK_START info. */	  bow_fwrite_int (seek_current, fp);	  /* Set the SEEK_START in the data structure. */	  wi2dvf->entry[wi].seek_start = seek_current;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久天天做天天爱综合色| 精品粉嫩aⅴ一区二区三区四区| 日韩av电影免费观看高清完整版 | 欧美日韩国产首页| 91理论电影在线观看| 成人激情小说网站| 不卡一卡二卡三乱码免费网站| 国产精品18久久久久久久久| 国产一区二区三区视频在线播放| 欧美aⅴ一区二区三区视频| 日韩中文欧美在线| 久久成人免费网站| 国产精品18久久久久久久久| 国产91综合一区在线观看| 国产盗摄女厕一区二区三区| 成人av在线一区二区| 95精品视频在线| 欧美人与禽zozo性伦| 欧美一区二区三区在线看| 欧美一二三区在线观看| 久久伊人中文字幕| 国产精品毛片久久久久久| 国产精品久久久久一区二区三区| 久久久www成人免费无遮挡大片| 国产日韩欧美电影| 一区二区三区四区不卡在线 | 欧美日韩精品系列| 欧美一级黄色片| 久久久三级国产网站| 国产精品久久久久久妇女6080 | 亚洲欧美在线观看| 亚洲电影一区二区三区| 久久99热国产| eeuss鲁片一区二区三区在线看| 91免费看片在线观看| 日韩视频免费观看高清完整版在线观看 | 亚洲手机成人高清视频| 亚洲成a天堂v人片| 国产一区视频网站| 色综合久久中文综合久久牛| 欧美一区二区日韩| 国产精品久久久久影视| 男人操女人的视频在线观看欧美| 国产精品一区二区在线看| 日本福利一区二区| 国产偷国产偷亚洲高清人白洁| 亚洲精品免费看| 国产成人在线看| 欧美老肥妇做.爰bbww| 国产日韩欧美制服另类| 水野朝阳av一区二区三区| 成人动漫一区二区在线| 欧美电视剧免费观看| 亚洲一区二区四区蜜桃| 成人性生交大片免费看在线播放| 这里是久久伊人| 亚洲伦理在线精品| 成人午夜视频在线| 日韩一级片在线观看| 亚洲影院免费观看| 波多野洁衣一区| 久久久综合视频| 久久99久久精品| 91精品国产91久久久久久最新毛片 | av一区二区三区在线| 久久综合久久鬼色| 久久精品国内一区二区三区| 欧美日韩在线电影| 亚洲同性gay激情无套| 成人免费av资源| 欧美激情在线看| 国产一区二区三区电影在线观看| 日韩欧美一级在线播放| 免费观看日韩电影| 制服.丝袜.亚洲.中文.综合| 亚洲mv大片欧洲mv大片精品| 欧美私模裸体表演在线观看| 亚洲欧美日韩久久| 色婷婷精品大在线视频| 亚洲最大成人网4388xx| 日本乱人伦aⅴ精品| 曰韩精品一区二区| 色悠悠久久综合| 亚洲成人黄色影院| 91麻豆精品国产91久久久| 日本在线观看不卡视频| 91精品国产综合久久久蜜臀粉嫩| 日韩高清不卡在线| 精品噜噜噜噜久久久久久久久试看 | 56国语精品自产拍在线观看| 首页欧美精品中文字幕| 日韩欧美一级二级三级久久久| 久久电影网电视剧免费观看| 久久久精品日韩欧美| 成人av网站免费观看| 中文字幕字幕中文在线中不卡视频| 91老司机福利 在线| 亚洲成av人片观看| 精品久久久久av影院| 国产精品一区久久久久| 亚洲精品菠萝久久久久久久| 欧美性生活大片视频| 精品制服美女丁香| 国产精品高潮呻吟久久| 欧美四级电影网| 国产美女娇喘av呻吟久久 | 99视频精品在线| 天涯成人国产亚洲精品一区av| 91麻豆精品国产自产在线| 国产精选一区二区三区| 亚洲欧美日韩小说| 精品国产一区二区国模嫣然| 99国产精品99久久久久久| 日韩在线播放一区二区| 国产精品人成在线观看免费| 91 com成人网| 成人网在线播放| 蜜臀精品久久久久久蜜臀| 国产精品久久三区| 日韩无一区二区| 色女孩综合影院| 国产高清亚洲一区| 日韩av在线免费观看不卡| 国产精品二三区| 久久看人人爽人人| 91精品国产综合久久小美女| 91在线码无精品| 黑人巨大精品欧美一区| 亚洲成人免费av| 亚洲图片另类小说| 国产午夜精品一区二区三区四区| 欧美精品少妇一区二区三区| 99久免费精品视频在线观看| 寂寞少妇一区二区三区| 天堂久久一区二区三区| 国产精品午夜在线| 精品久久久网站| 欧美一区二区三区日韩| 在线观看精品一区| 99re视频精品| 成人动漫av在线| 国产精品1024| 精品一区二区久久久| 日本亚洲三级在线| 亚洲国产成人av| 一区二区不卡在线播放| 亚洲丝袜制服诱惑| 欧美国产精品一区| 日本一二三四高清不卡| 久久久美女毛片| 欧美一区二区三区成人| 日韩一区二区三区精品视频| 欧美日韩精品一区视频| 欧美性欧美巨大黑白大战| 91麻豆福利精品推荐| 99精品欧美一区二区三区小说 | 精品视频一区三区九区| 欧美午夜在线观看| 欧美三级视频在线| 欧美亚洲国产怡红院影院| 91久久人澡人人添人人爽欧美| 96av麻豆蜜桃一区二区| 91久久奴性调教| 色天使色偷偷av一区二区| 色婷婷久久综合| 欧美视频在线不卡| 欧美女孩性生活视频| 欧美一区二区观看视频| 精品国产三级a在线观看| 久久精品亚洲精品国产欧美kt∨| 中文字幕第一区| 日本不卡不码高清免费观看| **性色生活片久久毛片| 欧美午夜寂寞影院| 欧美日韩精品一区二区三区| 欧美丰满少妇xxxxx高潮对白| 欧美精品九九99久久| ww亚洲ww在线观看国产| 国产精品久久久久影院老司| 一区二区三区日韩| 秋霞午夜av一区二区三区| 国内偷窥港台综合视频在线播放| 国产夫妻精品视频| 色综合久久久久久久久| 日韩一级成人av| 最近日韩中文字幕| 日韩精品欧美精品| 成人一二三区视频| 91精品久久久久久久久99蜜臂| 久久久亚洲精品石原莉奈| 亚洲精品高清视频在线观看| 久久精品99久久久| 91亚洲男人天堂| 精品国产一二三区| 亚洲精选一二三| 国产一区二区三区久久悠悠色av| 色综合久久综合网欧美综合网| 精品欧美久久久| 亚洲一区电影777| 丁香亚洲综合激情啪啪综合|