초보~고수님들 도와주세요
홀림길
질문 제목 : 불용어탐색인데 개초보라 모르겠네요
질문 내용 :
#include stdio.h
#include stdlib.h
#include string.h
#include tchar.h
int main(void)
{
char chr1[10],chr2[10];
char chr;
int marks=0;
int i=0;
file *fp1;
fp1=fopen(d:\\documents\\visual studio 2008\\projects\\asd\\asd\\stoplist.txt,r);
if(fp1==null)
{
printf(파일처리오류발생\n);
exit(1);
}
file *fp2;
fp2=fopen(d:\\documents\\visual studio 2008\\projects\\asd\\asd\\list.txt,r);
if(fp2==null)
{
printf(파일처리오류발생\n);
exit(1);
}
while(1)
{
if(feof(fp1))
break;
fscanf(fp1,%s,&chr1);
marks++;
printf(숫자1 %d\n,marks);
}
while(1)
{
if(feof(fp2))
break;
fscanf(fp2,%s,&chr2); for (i=0;marks==i;i++)
{
chr=strstr(chr1, chr2);
}
printf(숫자1 %d\n,chr);
}
fclose(fp1);
fclose(fp2); return 0;
}음.. chr1 에 불용어가 들어있고 chr2에 문장이 들어있습니다
chr1과 chr2를 비교해서 문장에 불용어가 몃개있는지 찾는것입니다
예를들어
in the rain , i am korean you are in the busan 이라는 문장이 있다고 하고
불용어 리스트가 in a go the am are 가 있다고 하면
원하는 결과값은
in : 2
am : 1
the : 2
are : 1이런식으로 나오게 해야 하는데 아무리 해도 비교에서 막히네요 ㅠㅠ