Mercurial > hg > machine-learning-hw6
changeset 2:7f92093ea77d
Use lookup for looking up words in the dictionary
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 06 Dec 2011 13:14:00 -0500 |
parents | e0f1290d2b43 |
children | ace890ed0ed9 |
files | processEmail.m |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/processEmail.m +++ b/processEmail.m @@ -76,12 +76,10 @@ endif ## Convert the vocabulary list - for i = 1:numel (vocabList) - if strcmp (vocabList{i}, str) - word_indices(end+1) = i; - break; - endif - endfor + idx = lookup (vocabList, str, "m"); + if (idx) + word_indices(end+1) = idx; + endif ## Print to screen, ensuring that the output lines are not too long if (l + length(str) + 1) > 78