about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/examples/dynamic/HHMM/Mgram/letter2num.m
blob: f4e3f1d9a742bb1118871fdadb31a6883e6cd8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
function n = letter2num(l)

% map a-z to 1:26 and A-Z to 27:52
punct_code = [32:47 58:64 91:96 123:126];
digits_code = 48:57;
upper_code = 65:90;
lower_code = 97:122;

c = double(l);
n = c-96;
ndx = find(n <= 0); % upper case
n(ndx) = c(ndx)  - 64 + 26;