Spell check with txt file

For each word in the email, check whether the word is in the dictionary.
Print out misspelled words.
How can you check whether the word in "sentence.txt" is in "text.txt"?
Also how can you print words not in text.txt file?
=
=
For example:
There is no one in th hous.
(It should check this sentence to "text.txt" and print out th & hous because it is not in "sentence.txt" file.)

답변 (1개)

Lalit Patil
Lalit Patil 2013년 2월 23일

1 개 추천

CStr = textread('sentence.txt', '%s', 'delimiter', '\n')
CStr1 = textread('text.txt', '%s', 'delimiter', '\n')
contained = ismember(CStr, CStr1) % if ans 1 then it is in text.txt
notIndata2 = CStr(~contained) % print those are not in text.txt
notIndata2 = CStr(contained) % print those are in text.txt

댓글 수: 4

Kim
Kim 2013년 2월 23일
is there a way to do using any of these functions?
(fopen, fclose, fgetl, ischar, isempty, lower, find, strcmp, intersect, max, length, sort, input, str2num, fprintf.)
Walter Roberson
Walter Roberson 2013년 2월 23일
Yes. In an application such as you describe, I can see a use for all of those except str2num (but not all of what you list might be needed in any one implementation.)
Muthu Annamalai
Muthu Annamalai 2013년 2월 23일
If your question is not a homework project, which I hope it is not, then 'textread' is part of base-MATLAB and you should use it. Why go for the elementary functions?
Kim
Kim 2013년 2월 23일
it is a homework project, and it recommends to use those functions but I don't know how to :(

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기

질문:

Kim
2013년 2월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by