# Last edited on 2025-09-24 19:31:01 by stolfi # Sampling functions for engp/cul # English - Plant names from Culpeper's herbal, mapped to lowercase. # To be included in select-evt-lines, fix_sample_tokens.gawk, select-gud-bad-words function select_evt_line(subsec,chapter,unit,linenum) { # Take part d (list of plants by planets), chapter 1, unit type "V" (plantlist); # also part h (herbal proper), all chapters, unit type "T" (chapter title). # Make it all into a single subsection. if (subsec = "bod.1") { return \ ((chapter ~ /^[d]/) && (unit ~ /^[V]/)) || \ ((chapter ~ /^[h]/) && (unit ~ /^[T]/)); } else { arg_error(("bad subsection \"" subsec "\"")); } } function fix_raw_word(word) { # Map upper case to lower case, break at hyphens. word = tolower(word); if (word !~ /^[-]*$/) { gsub(/[-]/, "\n", word); } return word; } function define_patterns() { # No patterns needed } function is_good_word(word) { # Accept only lowercase alpha, plus apostrophe. # Apostrophes can't be doubled. # Note that 'tis OK to begin an' end with apostrophe! return (word ~ /^([']?[a-z])+[']?$/); # # The following allows hyphenated words. # Note that each word of # an hyphenated compound must contain at least one letter. # return (word ~ /^(([']?[a-z])+[']?)([-]([']?[a-z])+[']?)*$/); }