Your line
for iword=1:length(wordbank)
should be
for iword=1:total_no_words
as you do not want to be trying to de-pluralize words that were never stored. length(wordbank) is going to be set by you defining it as a cell array with 25000 entries.
As an optimization, you can replace your checkcount lines that currently say
checkcount=sum(is_letter+is_space);
if checkcount~=length(tline)
with
if ~all(is_letter | is_space)
And after that your line
if strcmp(tline,lower(tline))==1 || strcmp(tline,upper(tline))==1
could be optimized to
if strcmp(tline,lower(tline)) || strcmp(tline,upper(tline))
However! This line checks that time is all in upper-case or all in lower-case and will not store any line that is in mixed-case. Your all-upper-case lines will be stored in upper-case. I suspect you do not intend either of these behaviours, and I cannot tell what you are wanting to check with that "if" statement. I suspect you should be using
and then storing that unconditionally.
Best Answer