# Last edited on 2002-01-16 03:18:28 by stolfi
# Sampling functions for enrc/red
# English - Well's "War of the Worlds", lowercased,
# converted to Voynichese-looking Roman-like code.
# To be included in select-evt-lines, fix-raw-words, select-gud-bad-words

function select_evt_line(subsec,chapter,unit,linenum)
{
  # Take running text (unit type "P") in the story proper 
  # (parts [bc]), as a single subsection.
  if (subsec = "bod.1")
    { 
      return ((chapter ~ /^[bc]/) && (unit ~ /^[P]/));
    }
  else
    { arg_error(("bad subsection \"" subsec "\"")); }
}

function fix_raw_word(word)
{
  # Assume that the word table maps each valid word of the text, ignoring case, 
  # to a string `@xxxxx' where `xxxxx' are lowercase letters.
  if (word ~ /^[@]/)
    { # Just remove the `@'
      gsub(/^[@]/, "", word);
    }
  else 
    { word = ("?" word "?"); }
  return word;
}

function define_patterns()
{
  # No patterns needed 
}

function is_good_word(word)
{ 
  # The Voynichese-like pseudo-Roman code uses lowercase letters only
  return (word ~ /^[aoydsrlciektph]+$/);
}