남이 해놓은 설명만 보면서 살다가 생각좀 해서 이제서야 구현했다.
아직까지는 잘 되는 것 같은데... 알 수 없는 일이다^^
아래는 query를 공백을 기준으로 string[]으로 나눠서 놓고
검색결과 content를 공백으로 나눈 string[]와 비교해서 부분일치 및 완전일치를 카운트하는 예제다.
비교의 정확성을 위해서 porter stemmer를 이용했다.
int queryindex = 0;
int contentindex = 0;
Again:
if (myps.DoFilter(query[queryindex]) == myps.DoFilter(termindoc[contentindex]))
{
countbroken[queryindex]++;
isBrokenCountExist = true;
contentindex++;
if (queryindex == query.Length - 1)
{
count++;
queryindex = 0;
if (contentindex < termindoc.Length)
{
goto Again;
}
else
{
goto Exit;
}
}
else
{
queryindex++;
if (contentindex < termindoc.Length)
{
goto Again;
}
else
{
goto Exit;
}
}
}
}
Exit :
No comments:
Post a Comment