% function to evaluate tentative text by computing probability of
% letter pairs
% input is assumed simplified to capitals and spaces using simplify_text

function total=count_pairs(matrix, text)
%text=simplify_text(text);
total=0;
for k=1:length(text)-1
letter1=text(k);
letter2=text(k+1);
total=total+log(.01+matrix(letter1,letter2));
end
total=total/length(text);
return