#! /usr/bin/gawk -f # Last edited on 2026-07-23 18:13:28 by stolfi # Sampling functions for engp/mky # Pseudo-English generated by a Markov chain # Words should be already all lowercase, with no hyphens or apostropes, # so we don't need to do anything. # To be included in wds_to_tlw.gawk function smp_define_patterns(smp,sec) { # No patterns needed if (sec != "tot.1") { data_error(("invalid section \"" sec "\"")); } } function smp_reclassify_token(smp,sec,cursec,curlin,type,wd) { # Reject subsections that are not main text: if (cursec !~ /{v[0-9]+}{tx} *$/) { return "x"; } # Discard punctuation other than parag breaks: if ((type == "p") && ( wd != "=")) { return "n"; } return type; } function smp_fix_token(smp,sec,type,wd) { # Nothing to do: return wd; } function smp_is_good_token(smp,sec,type,wd) { # Accept only lowercase alpha (no apostrophes or hyphens). return (wd ~ /^[a-z]+$/); }