function ind = wordhash(word,nmax)
% wordhash(word) --- a hash function for words
ind = 1;
for k=1:length(word)
    ind = 31*ind + word(k);
    ind = rem(ind,nmax) + 1; %! put in the range 1 to nmax
end