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

📄 beyesclassifier.cpp

📁 一个很好的贝叶斯分类器
💻 CPP
字号:
// BeyesClassifier.cpp : 定义控制台应用程序的入口点。

//#define _WIN32_WINNT 0x0400

#include "stdafx.h"
#include"BeyesClassifier.h"

char *str;
vector<string> *lines_of_text = new vector<string>;


int main(int argc, char *argv[])
{
    

	WIN32_FIND_DATA FindFileData;


	HANDLE hFind;
	char fdir[100];
	char * fname, *str1;

	int count=0;
 
	printf("Please input the file direction: \n"); 

	scanf("%s", fdir);

	printf ("Target file is %s.\n", fdir);

	str=(char*)malloc(_MAX_PATH);
	strcpy(str,fdir);
	strcat(str,"\\");


	fname=strcat(fdir,"\\*.txt");


	hFind = FindFirstFile(fname, &FindFileData);
 
	if (hFind == INVALID_HANDLE_VALUE) 
	{
		printf ("Invalid File Handle. GetLastError reports %d\n", GetLastError ());
    
	} 
	else 
	{
		printf ("The first file found is %s\n", FindFileData.cFileName);
		str1=(char*)malloc(_MAX_PATH);
		strcpy(str1,str);

		strcat(str1,FindFileData.cFileName);
		printf("the file all name is :%s\n\n",str1);
		retrieve_text(str1);


		while(FindNextFile(hFind, &FindFileData))
		{
			count++;
			printf ("The file found is %s\n", FindFileData.cFileName);

			str1=(char*)malloc(_MAX_PATH);
			strcpy(str1,str);

			strcat(str1,FindFileData.cFileName);
		
		
			printf(" str is :%s\n",str);
			printf("the file all name is :%s\n\n",str1);
			retrieve_text(str1);
			free(str1);

		}

		strip_caps(lines_of_text);
		vector<string> *words = separate_words(lines_of_text);

		map< string, int > *text_map = appear_total(words);

		map_output( text_map );

		multimap_total(text_map);

		FindClose(hFind);
    
	 }
	file_prep();
}

⌨️ 快捷键说明

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