# Last edited on 2002-01-20 22:06:49 by stolfi function slot_extract(w) { # Extracts the initial consonant cluster from a # Vietnamese VIQR word. # Remove the tone mark, for good measure: gsub(/[`'?.~]/, "", w); # Now return everything up to the first vowel. # If there are no vowels, assume that the consonants are final ones ("ng"?) if (match(w, /[aiueoyAIUEOY]/)) { return substr(w, 1, RSTART-1); } else { return ""; } } function slot_factor(w) { # Trivial factorization (VIQR bytes) return gensub(/(.)/, "{\\1}", "g", w); }