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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? 分詞算法源代碼.txt

?? 它是文本分詞程序代碼的核心算法
?? TXT
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
// Document.cpp: implementation of the Document class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "frequency.h"
#include "Document.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

#include "Document.h"

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//詞表操作

void Document::initTmpWordArray()
//詞匯表初始化
{	
	int i;
	for (i=0;i<=255;i++) tmpWordArray[i]=NULL;	
}

void Document::InCreaseWord(WordType *pWord)
//指定詞條頻度加1
{	
	if (pWord==NULL) return;
	pWord->count ++;
}

void Document::ArrangeWord(WordType * pWord,int intMethod,int Direction)
//intMethod=1 詞條頻率 =2 詞條文內(nèi)權(quán)重
//插入詞條按照詞頻或者詞權(quán)重對(duì)wordtype進(jìn)行排序
{	
	int i,j;
	if (intMethod==1)	
	{
		// 插入排序
		for (i=0;i<intWordCount[Direction-1];i++) //intWordCount描述lastWordArray[]中兩個(gè)方向的詞數(shù).by xfguo
			if (lastWordArray[Direction-1][i].count<=pWord->count)//Direction; 1 正向 ;2 反向
			{ 
				for(j=intWordCount[Direction-1]-1;j>=i;j--) 
					lastWordArray[Direction-1][j+1]=lastWordArray[Direction-1][j]; 
				break;
			}
		lastWordArray[Direction-1][i]=*pWord;
		intWordCount[Direction-1]++;
	}
	else if (intMethod==2)	
	{	
		for (i=0;i<intWordCount[Direction-1];i++)
			if (lastWordArray[Direction-1][i].weight_count<=pWord->weight_count )
			{ 
				for(j=intWordCount[Direction-1]-1;j>=i;j--) 
					lastWordArray[Direction-1][j+1]=lastWordArray[Direction-1][j]; 
				break;
			}
		lastWordArray[Direction-1][i]=*pWord;
		intWordCount[Direction-1]++;
	}
	else if (intMethod==0)
	{	
		lastWordArray[Direction-1][intWordCount[Direction-1]]=*pWord;
		intWordCount[Direction-1]++;
	}
}

void Document::AddNewWord(char * strWord,int intWordCount,int intWordLength,float weight)
//加入新的詞匯
{	
	//if (IfExtendWordTable==2) return;
	if (strlen(strWord)>48 ) return ;
	WordType * pWordTmp,*pWordInsert,*pWordStart,*pTmp;	
	pWordTmp=(WordType *)malloc(sizeof(WordType));
    	pWordTmp->next=tmpWordArray[(unsigned char)(*strWord)];
	pWordTmp->count=intWordCount;
	pWordTmp->length=intWordLength;
	pWordTmp->weight=weight; //???
	strcpy(pWordTmp->word,strWord);

	//插入排序
	pWordStart=tmpWordArray[(unsigned char)(*strWord)];
	pWordInsert=NULL;

	while((pWordStart!=NULL)&&(pWordStart->length>intWordLength))
	{	
		pWordInsert=pWordStart;
		pWordStart=pWordStart->next;
	}
	
	if (pWordInsert==NULL)
	{	
		pTmp=tmpWordArray[(unsigned char)(*strWord)];
		tmpWordArray[(unsigned char)(*strWord)]=pWordTmp;
		pWordTmp->next=pTmp;
	}
	else
	{	
		pTmp=pWordInsert;
		pWordInsert->next=pWordTmp;
		pWordTmp->next =pWordStart;
	}
}

void Document::freeWordTable(WordType * pWord)
//詞匯表行的釋放
{	
	WordType *tmpWord;
	while (pWord!=NULL)
	{
		tmpWord=pWord->next;
		free(pWord);
		pWord=tmpWord;
	}

/*	WordType * q;
	while (pWord!=NULL)
	{	
		q=pWord->next;
	        free(pWord); 
		pWord=q;
	}
*/

}

void Document::ArrangeWordInTable(int YuZhi,int intMethod,int Direction)
//intMethod=1 詞條頻率 =2 詞條文內(nèi)權(quán)重 =0 不排序
//輸出詞條排序
//tmpWordArray[]按一定的順序插入到lastWordArray[]中
{	
	int i;
	intWordCount[Direction-1]=0;
	WordType *pWord;
	
	for (i=0;i<=255;i++) 
	{	pWord=tmpWordArray[i];
		while (pWord!=NULL)
		{	if (pWord->count>=YuZhi) ArrangeWord(pWord,intMethod,Direction);
			pWord=pWord->next;
		}
	}
}

void Document::ResetWordTable()//將詞頻設(shè)置為0
{
	int i;
	WordType *pWord;
	for (i=0;i<=255;i++) 
	{	pWord=tmpWordArray[i];
		while (pWord!=NULL)
		{	pWord->count=0;
			pWord->weight_count=0; 
			pWord=pWord->next;
		}
	}
}

void Document::ClearWordTable()//清空詞表內(nèi)的詞條
{	
	int i;
	WordType *pWord;
	for (i=0;i<=255;i++) 
	{	pWord=tmpWordArray[i];
		while (pWord!=NULL)
		{	pWord->count=0;
			pWord->weight_count=0; 
			pWord=pWord->next;
		}
	}
}

WordType * Document::FindWord(char *strWord)
//查詢表中有無(wú)所查的單詞,如果找到,返回指針位置,否則返回NULL
{	
	if (*strWord=='\0') return NULL;//出錯(cuò)誤
	WordType * pStartPlace;
	pStartPlace=tmpWordArray[(unsigned char)(*strWord)];
	while (pStartPlace!=NULL)
	{	
		if (strcmp(strWord,pStartPlace->word)==0) return pStartPlace;  //找到了
		pStartPlace=pStartPlace->next ;
	}
	return NULL;//沒(méi)有找到
}

void Document::freeTmpWordArray()
//詞匯表的釋放
{	
	int i;
	for (i=0;i<=255;i++) {freeWordTable(tmpWordArray[i]);tmpWordArray[i]=NULL;}
}

void Document::initArrangeTable()
//釋放臨時(shí)詞表
{	
	intWordCount[0]=0;
	intWordCount[1]=0;
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//詞條文件操作

//篩選后導(dǎo)出詞條
void Document::WriteWordToFile(char * strFileName,int ifWriteFre,int Direction)
//ifWriteFre =1 輸出詞頻 =0 no
{	
	FILE *fWrite;
	if((fWrite=fopen(strFileName,"w"))==NULL) return ;
	int i;
	int count;
	char strWordTmp[50];
	count=intWordCount[Direction-1];

	for (i=0;i<count;i++)
	{	
		if (Direction==2)
			ReverseString(lastWordArray[Direction-1][i].word,strWordTmp);
		else	strcpy(strWordTmp,lastWordArray[Direction-1][i].word);
		if (ifWriteFre==1){
			//if (strWordTmp[0]<128)
			//	continue;
		 	fprintf(fWrite,"%s %d\n",strWordTmp,lastWordArray[Direction-1][i].count);
		}
		else 	fprintf(fWrite,"%s\n",strWordTmp);
	}
	fclose(fWrite);
}

void Document::copylastword(WordType *pWordtype,int *wordnum)
{             
	int i;
	int count=intWordCount[0];	
		
	*wordnum=intWordCount[0];
	
	for (i=0;i<intWordCount[0];i++)
	{	
		strcpy(pWordtype[i].word,lastWordArray[0][i].word);
                pWordtype[i].count =lastWordArray[0][i].count;
	}
} 

int Document::ReadFileFromText(char* strFileName)
//讀取文本文件內(nèi)容到字符串。自動(dòng)分配內(nèi)存。
{	
	/* if (strSource!=NULL) free(strSource); */
	FILE* fp;
	long lFileLength;
	if((fp=fopen(strFileName,"rb"))!=NULL)
	{           
		fseek(fp,0,SEEK_END);
		lFileLength=ftell(fp);
		rewind(fp);
		
		strSource=(char *)malloc(lFileLength+1);
		fread(strSource,lFileLength,1,fp);
		*(strSource+lFileLength)='\0';
		fclose(fp);
	
                //去掉換行 
		//直接在strsource上修改,那個(gè)更更好??-

		char * strTmpSource;
		strTmpSource=(char *)malloc(lFileLength+1);
		int i,j;
		j=0;
		for (i=0;i<=lFileLength;i++)
		{
			if (*(strSource+i)!='\r' && *(strSource+i) !='\n')
			{  
				*(strTmpSource+j) = *(strSource+i);
			   	j ++;
			}
		}			
		lFileLength=j;
		free(strSource);
		strSource=(char *)malloc(lFileLength+1);
		*(strSource+lFileLength+1)='\0';
		strcpy(strSource,strTmpSource);
		free(strTmpSource);
		
	  	return 1;
	}
	else
	{
		//AfxMessageBox(strFileName);
		return 0;
	}
}
	
int Document::GetCharFromString(char * strSource,int intStartPlace,char * strReturn,int * intCharLength)
//取得源串中的從絕對(duì)地址開(kāi)始的字符
//返回值:0 末尾;1 字符 ;2 符號(hào) ;-1 出錯(cuò) ;4 回車(chē)
//                 漢語(yǔ)    
{	
	unsigned char char1,char2;
	char strVertueWord[1000];

	int intStrLength;
	WordType * pWord;
	int i;
	
	char1=(unsigned char)(*(strSource+intStartPlace));
	if (char1==0) return 0;
	char2=(unsigned char)(*(strSource+intStartPlace+1));

	if (char1>128) 
	{	
		if (char2==0) return -1;
		*strReturn=(char)(char1);
		*(strReturn+1)=(char)(char2);
		*(strReturn+2)='\0';
		*intCharLength=2;
		
		if (Direction==2) ReverseString("-—;/ 。,:、!?的了在你我她它他到是不和《〉》〈~【】〖〗×∥■▲○●→─·…★“”‘’()—",strVertueWord);
		else strcpy(strVertueWord,";-—/ 。,:、!?的了在你我她它他到是不和《〉 》〈~【】〖〗×∥■▲○●→─·…★“”‘’()—");
		if (strstr(strVertueWord,strReturn)==NULL) return 1;
		else if ((strstr(strVertueWord,strReturn)-strVertueWord)%2==1) return 1;
		else return 2;
	}
	
	*strReturn=(char)(char1);

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本道色综合久久| 日本一区二区三级电影在线观看 | 久久精品国产色蜜蜜麻豆| 亚洲乱码一区二区三区在线观看| 久久久久国产免费免费 | av亚洲产国偷v产偷v自拍| 另类综合日韩欧美亚洲| 美女脱光内衣内裤视频久久影院| 亚洲图片自拍偷拍| 午夜欧美2019年伦理| 性做久久久久久免费观看| 亚洲一区二区三区美女| 亚洲国产精品影院| 日本在线观看不卡视频| 美女任你摸久久| 国产酒店精品激情| 成人手机电影网| 91毛片在线观看| 欧美精品在线观看一区二区| 欧美一二三区在线| 国产性天天综合网| 亚洲精品免费在线观看| 天天免费综合色| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美三级在线看| 555www色欧美视频| 久久久久久久久蜜桃| 国产精品欧美经典| 亚洲国产日韩a在线播放性色| 视频在线观看一区| 国产99久久久久久免费看农村| 99久久精品国产导航| 在线播放91灌醉迷j高跟美女 | 国产精品毛片大码女人| 一区二区三区四区蜜桃| 久热成人在线视频| 91免费版在线| 久久久久久久久久久久久久久99| 亚洲免费资源在线播放| 久久99久国产精品黄毛片色诱| jizzjizzjizz欧美| 欧美一级二级三级蜜桃| 亚洲欧美日韩久久| 韩国欧美国产一区| 视频一区视频二区在线观看| 三级欧美韩日大片在线看| 国产一区二区三区电影在线观看| 91国偷自产一区二区开放时间| 欧美成人免费网站| 亚洲一区二区三区视频在线播放 | 精品sm捆绑视频| 亚洲精品高清在线观看| 国产精品亚洲а∨天堂免在线| 欧美网站大全在线观看| 国产精品高潮久久久久无| 麻豆久久久久久久| 欧美日韩视频一区二区| 国产精品视频你懂的| 亚洲国产综合人成综合网站| 成人午夜在线播放| 久久精品夜色噜噜亚洲aⅴ| 日韩中文字幕91| 在线免费观看成人短视频| 国产精品婷婷午夜在线观看| 激情综合色丁香一区二区| 在线观看av一区| 中文字幕在线一区免费| 国产伦精一区二区三区| 91精品国产高清一区二区三区| 亚洲精品成人天堂一二三| 成人av在线观| 国产精品伦一区二区三级视频| 精品一区二区三区不卡| 日韩精品一区二区三区四区视频| 亚洲成av人片在线| 欧美日韩视频在线一区二区| 一区二区三区.www| 欧美性受xxxx黑人xyx| 亚洲一区二区欧美| 欧美女孩性生活视频| 图片区小说区国产精品视频| 欧美久久免费观看| 麻豆91免费观看| 精品国产第一区二区三区观看体验| 精品制服美女丁香| 国产色产综合产在线视频 | 免费在线观看一区| 欧美三电影在线| 一区二区三区日本| 欧美巨大另类极品videosbest| 亚州成人在线电影| 欧美精品 国产精品| 亚洲不卡av一区二区三区| 欧美日韩国产一区| 美女视频免费一区| 国产偷国产偷亚洲高清人白洁| 国产福利91精品一区| 亚洲视频在线一区观看| 91视频在线观看免费| 亚洲国产精品尤物yw在线观看| 日韩一区二区电影| 国产成人一区在线| 亚洲一区二区三区中文字幕在线 | 成人av先锋影音| 国产剧情一区二区三区| 日本一区二区三区国色天香| 91在线观看美女| 一区二区三区精品视频| 成人免费视频免费观看| 亚洲欧美日韩国产综合在线| 欧美精品v日韩精品v韩国精品v| 黑人巨大精品欧美一区| 国产精品免费久久久久| 欧美人与z0zoxxxx视频| 国产精品乡下勾搭老头1| 亚洲三级免费观看| 欧美丰满嫩嫩电影| 成人午夜大片免费观看| 爽爽淫人综合网网站| 中文字幕色av一区二区三区| 欧美日韩中文精品| 懂色av中文一区二区三区 | 99国产麻豆精品| 久久精品国产澳门| 亚洲免费av在线| 日韩福利电影在线观看| 久久色中文字幕| 在线观看一区日韩| 成人午夜av影视| 久久99精品久久久久久久久久久久| 日韩一区欧美一区| 精品成人一区二区三区四区| 欧美色图在线观看| 色老汉一区二区三区| 国产91精品一区二区麻豆网站 | 日韩欧美在线观看一区二区三区| 成人免费高清视频| 国模大尺度一区二区三区| 亚洲国产三级在线| 一区二区三区在线视频播放| 在线看日韩精品电影| 黄一区二区三区| 日韩黄色在线观看| 亚洲午夜精品17c| 国产精品久久福利| 国产精品国产馆在线真实露脸 | 国产精品蜜臀在线观看| 欧美xxxx在线观看| 日韩精品一区二区三区视频播放 | 欧美日韩国产综合久久| 91老师国产黑色丝袜在线| 成人黄色国产精品网站大全在线免费观看| 免费精品视频在线| 麻豆中文一区二区| 极品美女销魂一区二区三区免费| 免费成人在线观看视频| 蜜桃精品视频在线观看| 国产精品三级电影| 国产在线播放一区三区四| 亚洲制服丝袜av| 曰韩精品一区二区| 一区二区三区在线观看网站| 亚洲视频图片小说| 亚洲一区二区三区国产| 天天操天天综合网| 精品一区二区三区免费| 国产综合成人久久大片91| 高清成人免费视频| 99久久精品国产网站| 欧美无砖专区一中文字| 欧美一区二区精美| 日本一区二区三区在线不卡| 亚洲男人的天堂av| 石原莉奈在线亚洲二区| 国产资源在线一区| aaa欧美色吧激情视频| 欧洲一区二区av| 日韩欧美一级二级三级| 久久久久久影视| 亚洲另类色综合网站| 日本成人在线不卡视频| 99国产精品久久久久久久久久久 | 国产亚洲女人久久久久毛片| 久久老女人爱爱| 亚洲天堂a在线| 蜜臀久久久99精品久久久久久| 国产精品一线二线三线精华| 色婷婷综合久久久| 亚洲精品一区二区三区99| 国产精品免费丝袜| 男人的天堂亚洲一区| www.亚洲免费av| 欧美一卡二卡三卡四卡| 国产精品免费视频一区| 日韩中文字幕麻豆| 色猫猫国产区一区二在线视频| 91精品在线观看入口| 国产精品久久久久婷婷二区次| 五月婷婷综合在线| 日本高清不卡在线观看|