This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Ps = ; for m=1:Number_words n=1; temp = fscanf(fid_new,'%1c',1); while(~isletter(temp)&&~isfinite(str2double(temp))) %Won't work temp = fscanf(fid_new,'%1c',1); %Without this end %--Ian Salman new_words(m,n)=temp; while(~isspace(temp)) new_words(m,n)=temp; temp = fscanf(fid_new,'%1c',1); n=n+1; end freq(m) = fscanf(fid_new,'%d \n',1); i = strmatch(new_words(m,:),words,'exact'); if isempty(i) %Check if the current word occurs in the training set Ps = [Ps; 0.4]; %If it is a new word, make it's spam prob almost % neutral ( slightly biased towards ham) else Ps = [Ps; prob(i)]; %. ..else use the existing prob. end end fclose('all');...
View Full Document
This note was uploaded on 06/09/2010 for the course EE 131A taught by Professor Lorenzelli during the Spring '08 term at UCLA.
- Spring '08