Spell check with txt file

1 visualización (últimos 30 días)
Kim
Kim el 23 de Feb. de 2013
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 comentario
Walter Roberson
Walter Roberson el 23 de Feb. de 2013
What have you tried so far?

Iniciar sesión para comentar.

Respuestas (1)

Lalit Patil
Lalit Patil el 23 de Feb. de 2013
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 comentarios
Muthu Annamalai
Muthu Annamalai el 23 de Feb. de 2013
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 el 23 de Feb. de 2013
it is a homework project, and it recommends to use those functions but I don't know how to :(

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by