متن مورد نظر را به متغیر doc می دهیم . دقت کنید در مت مورد نظر عدد و کاراکترهایی مثل نقطه و ویرگول و .. نباشه. فقط حروف الفبا باشه در غیر این صورت خطا میده
doc='asd sdfsdgfdgh retyry th gfhgfh rdytyu zxcvcx rdytyu mdsfdk dyptrtry lkfdglldfg ljdf';
m=10;
threshold=.01;
C=strsplit(doc,' ',true);
[uq, ~, dx]=unique(C);
cnt=hist(dx,1:numel(uq));
V=cell2struct( num2cell(cnt)',uq,1);
dex=round(1:((numel(C)-1) /m):numel(C));
for i=1:numel(dex)-1
c{i}=C(dex(i):dex(i+1)-1);
dc(i)=0;
[uq, ~, dx]=unique(c{i});
cnt=hist(dx, 1:numel(uq));
Vc=cell2struct(num2cell(cnt)', uq,1);
for j=1:numel(uq)
dc(i)= dc(i)+abs(V.(uq{j})- Vc.(uq{j}))/ (V.(uq{j})+Vc.(uq{j}));
end
end
style=sum(dc)/numel(C);
outlierindex= find(dc<style-threshold);
c(outlierindex)