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

📄 stoptree.cc

📁 一个增量文本聚类的算法。 参考文献: Wai-chiu Wong, Ada Wai-chee Fu, Incremental Document Clustering for Web Page Cl
💻 CC
字号:
#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include <iostream.h>#include "StopTree.h"#include "Word.h"StopTree::StopTree(){    FILE *in;    char str[MaxWordLen];    stopRoot = NULL;    if((in=fopen("../MyLib/stoplist","r")) == NULL){        cerr << "Cannot open the stoplist file\n";        exit(1);    }    while(!feof(in)){	fscanf(in,"%s",&str);	insert(&stopRoot,str);    }//    printTree(stopRoot);    fclose(in);}StopTree::~StopTree(){}void StopTree::insert(Word **root,char *str){    if((* root) == NULL){    	(* root) = new Word(str);    }else{	int s;	s = strcmp((* root)->nameList->name,str);	if(s > 0){	    insert(&((* root)->left),str);	}else if(s < 0){	    insert(&((* root)->right),str);	}    }}void StopTree::printTree(Word *root){    if(root->left != NULL){	printTree(root->left);    }    printf("%s\n",root->nameList->name);    if(root->right != NULL){	printTree(root->right);    }}int StopTree::inStopList(Word *root,char *str){    int l=0;    if(root == NULL){        l = 0;    }else if(strcmp(root->nameList->name,str) > 0){        l = inStopList(root->left,str);    }else if(strcmp(root->nameList->name,str) < 0){        l = inStopList(root->right,str);    }else{	l = 1;    }    return l;}

⌨️ 快捷键说明

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