# Last edited on 2002-01-20 22:25:41 by stolfi

function slot_extract(w)
{
  # Extracts the final consonant cluster from a 
  # Vietnamese VIQR word.
  
  # Remove the tone mark, for good measure:
  gsub(/[`'.?~]/, "", w);
  # Now get the maximal string of final consonants
  match(w, /[b-df-hj-np-tvwxzB-DF-HJ-NP-TVWXZ]*$/);
  return substr(w, RSTART);
}                    

function slot_factor(w)
{
  # Trivial factorization (VIQR bytes)
  return gensub(/(.)/, "{\\1}", "g", w);
}