#! /usr/bin/gawk -f
# Last edited on 2004-02-26 06:28:38 by stolfi
# Sampling functions for geez/eno
# Ge'ez (classic Ethiopian) - "First Book of Enoch",
# in the standard SERA encoding.
# To be included in wds-to-tlw

function smp_define_patterns(smp,sec)
{
  # No patterns needed 
  if (sec != "tot.1") { data_error(("invalid section \"" sec "\"")); }
}

function smp_reclassify_word(smp,sec,cursec,curlin,type,wd)
{
  # Delete all but ordinary chapters from the book proper ("{p}{cN}{tx}"). 
  if (cursec !~ /^{p[1-9][1-9]*}{c[1-9][0-9]*}{tx}/) { return "n"; }
  
  # Delete titles:
  if (cursec ~ /{(tt|cn)}$/) { return "n"; }
  
  # Within the selected sections, reject anything that is not prose text
  if (cursec !~ /{tx}$/) { return "x"; }
  
  # Discard punctuation other than parag breaks: 
  if ((type == "p") && ( wd != "=")) { return "n"; }
  
  return type;
}

function smp_fix_word(smp,sec,type,wd)
{
  # Input is in SERA. 
  # No special processing needed.
  return wd;
}

function smp_is_good_word(smp,sec,type,wd)
{ 
  # Accept upper and lower case alpha, plus apostrophe
  # and backquote (as charater prefixes only):
  return ((wd ~ /^([`\']?[a-zA-Z])+$/));
}