Blob Blame History Raw
## This shell script checks a list of words for potential
## spelling problems.  It is provided for your hacking pleasure.
##
## It is designed to work with a raw list of words, one per line.
## % igcheck <wordlist>
##
## Uncomment the last couple of lines if you have time to browse
## through the (usually legal) violations of 
## "broad with broad", "slender with slender"

### ODD LETTERS
echo 'Checking for non-alphabetic characters...'
cat $1 | egrep "[^a-zA-ZáéíóúÁÉÍÓÚ'\-]"

### LENITION and VOWELS
echo 'Checking lenition...'
cat $1 | egrep '[aeiouáéíóúhjlnrvxz]h' | egrep -v '[aeiouáéíóú]h[aeiouáéíóú]' | egrep -v 'Fh?aranhaít' | egrep -v '^g?Ch?óbanhávan' | egrep -v "^([bdm]')?fhorhalla" | egrep -v '(bh)?forhalla' | egrep -v 'n?gh?ealhataí?$' | egrep -v "^([bdm]'|h|[nt]-)?unnailheicsiam" | egrep -v '^g?ch?úlhaist'
cat $1 | egrep 'sh[^aeiouáéíóúlnr]'
## check for eclipsis and lenition of same consonant
## so it suffices to check m?bh? later...
cat $1 | egrep 'm[bB]h' | egrep -v "^([bdm]'|h|[nt]-)?io?mbh" | egrep -v "^(d?th?rombhua|g?ch?ambh|([bdm]'|bh)?fh?uaimbhai?c)"
cat $1 | egrep 'n[dD]h' | egrep -v 'fh?lanndhe[ai]rg([ae])?$' | egrep -v '^d?th?eanndháileoi?g'
cat $1 | egrep '(b[pP]|t[sS]|d[tT])h'
cat $1 | egrep '^(g[cC]|n[gG]|bh[fF])h'
echo 'Checking for repeated letters...'
cat $1 | egrep '([^lnr])\1' | egrep -v '^(sh?núú|lottó)'
cat $1 | egrep '([lnr])\1\1'
cat $1 | egrep '(aá|áa|eé|ée|ií|ií|oó|óo|uú|úu)'
echo 'Checking for weird diphthongs...'
cat $1 | egrep '([iouáíóú][eé]|aé)' | egrep -v '^(bhuel|hiéana|t?sh?ubpoena)'
cat $1 | egrep '[aeoáéíó]u'
cat $1 | egrep '[íoóú][aá]' | egrep -v '^(sh?eampú|m?bh?uíá|g?ch?ó[aá]|reoá|t?sh?aíá)' | egrep -v 'iúáil' | egrep -v '^n?Gh?úam$'
cat $1 | egrep '[aáeéoó]ú' | egrep -v '^(m?bh?áú|g?ch?réú|n?dh?óú|n?gh?laeú|naoú|neamhbháú|t?sh?éú|t?sh?óú)'
cat $1 | egrep '[aáéíú]ó' | egrep -v '^(m?bh?uíó|n?dh?laíó|mh?éóis|réó|m?Bh?éóitia|mh?íóipe$)'
cat $1 | egrep '(eí|é[áío]|[áuú]o)'
echo 'Checking for weird triphthongs...'
cat $1 | egrep '[aeiouáéíóú][aeiouáéóú][aeouáéíóú]' | egrep -v '(uaí|iúá)' | egrep -v "^(([bdm]'|h|[nt]-)?aeó|n?gh?lae|hiéan|náia|naoú|b?ph?aranóia|reoá|s[pt]raeá)"
cat $1 | egrep '(eó|éa|io|iu|ío|uó)i' | egrep -v "^(([bdm]'|h|[nt]-)?aeóin|n?gh?iuirl|sciuir)" | egrep -v 'uóige'
cat $1 | egrep '[aouáóú]íú' | egrep -v '^(buí|g?ch?roíú|dlaíó|saíá|spraíú)' | egrep -v 'gh?naíú'

## Initial position
echo 'Checking for funny starting combinations...'
cat $1 | egrep '^[bcdfghlmnprt]h?[bcdfgmnpst]' | egrep -v '^(b(p|hf)|[cgt]h?n|gc|mb|n[dg]|ts|dt)' | egrep -v '^mh?ná$'
# this one includes "no initial ll,nn,rr"!
cat $1 | egrep '^(s[bdg]|[lmnr][lr]|nn|ps)'
cat $1 | egrep '^e[^aiouáíóú]'

## Terminal position
echo 'Checking for funny ending combinations...'
cat $1 | egrep '[bcdfghmpst][bcdfglmnprs]$' | egrep -v '(sc|dh[a-z]|[ptc]s|ai?sp|iamb|mp|t.*ghd)$'
cat $1 | egrep '[^bcdgmt]h$'
cat $1 | egrep '[bcdeéfghm]t$' | egrep -v '(ch|ing|abh)t$' | egrep -v '(sh?ei[cf]|ch?raif)t$'
cat $1 | egrep 'l[bdhinorsu]$' | egrep -v '(bh?oi?lb|gh?ild|scoi?lb)$'
cat $1 | egrep 'n[dfhilmopru]$' | egrep -v '(ainm|sh?einm|sh?oicind|^Alaind)$'

## from Litriú na Gaeilge 
echo 'Checking for pre-standard spellings (Litriú na Gaeilge rules)...'
# Rule 2.a, lch 103
cat $1 | egrep 'tch' | egrep -v '^(g?ch?(airtchlá|eartch|ruitchorda|ostchiorr)|leachtchriostai?l$|n?dh?(íotchúis|réachtchon)|smúitcheo|[sS]tátchist[eí]|d?th?(oitcheo|uairtchai?rr)|vástchóta)' | egrep -v 'fh?abhtcheartú$'
# Rule 3.I.b, lch 104.  ÓD lch viii -aidhe -> -aí
cat $1 | egrep 'dhe$' | egrep -v '(aghaidhe|réidhe)$' | egrep -v "^([bdm]'|h|[nt]-)?(fhlidhe|[ou]idhe|uídhe)" | egrep -v '^(luaidhe|(bh)?flidhe|m?bh?úidhe|g?Ch?oimdhe|d?th?eidhe|sh?oraidhe|spleidhe)$'
# Rule 3.II.b, lch 105  (exceptions include some "lit." spellings)
cat $1 | egrep 'adha.' | egrep -v "^([bdm]'|h|[nt]-)?adha" | egrep -v '(th?adhai?ll|radhai?rc|n?gh?adhai?r)' | egrep -v '^(m?bh?anadhaltra|n?gh?leadha|spadha)' | egrep -v "^(g?ch?adhai?[ln]|g?ch?eannadhairt|g?ch?ladha|m?bh?ladha|d?th?radhaill|mh?eadhar|ladhar|g?ch?eadharla)" | egrep -v "^([bdm]')?fhe?adha" | egrep -v "^(bh)?fe?adha"
# Rule 3.II.c, lch 105
cat $1 | egrep 'aedh(ea|i)'
# Rule 3.II.e, lch 105
cat $1 | egrep 'idhea' | egrep -v 'idheanna?$' | egrep -v '(infridhearg|fh?áidheadóireacht)a?$' | egrep -v '(uidheadha|fh?eidheartha)$' | egrep -v '^(g?ch?á|d?th?e)idheacha?$' | egrep -v '^heicsidheachúla'
# Rule 4, lch 106
cat $1 | egrep '[bm]hth' | egrep -v '^(réamh|leath|(bh?)fh?rith|neamh|b?ph?ríomh|g?ch?oi?mh|ríomh)th' | egrep -v 'ubhthorai?dh' | egrep -v '^(n?dh?o-chomhthomha|n?gh?eamhthro|d?th?aobhthro|n?dh?ubhthuirs|leamhthuirse$|rabhtha[rs]$)'
# Rule 6.I.b, lch 106
cat $1 | egrep 'ghe$' | egrep -v '^(n?dh?[aáó]|(bh)?fh?r?a|sh?eo|t?sh?o|d?th?ro|n?dh?eide|mh?a)ighe$' | egrep -v "^[bdm]'fhraighe" | egrep -v "^([bdm]'|h|[nt]-)?([aoó]|andó|éadó|ua)ighe"
# Rule 6.I.c, lch 107, exceptions are literary
cat $1 | egrep 'ugh' | egrep -v '^m?bh?rugh'
# Rule 6.II.b, lch 107, exceptions are literary
cat $1 | egrep '.ghail' | egrep -v 'fh?oghail$' | egrep -v 'iorghaile$' | egrep -v '^(n?dh?íoghail|d?th?oghail)$' | egrep -v '^mh?ionghailf$'
# Rule 8.b, lch 108
cat $1 | egrep 'tht'
# Rule 14.a i and ii, lch 113
cat $1 | egrep 'll[rs]' | egrep -v '([oO]lls|bhallra)' | egrep -v '^(n?dh?allr|m?ballra|n?dh?uillsilt|n?gh?éillsin|g?ch?allshaoth|g?ch?eallra|stiallscann)'
# Rule 14.b.ii, sonnda is literary, lch 113
cat $1 | egrep 'nnd' | egrep -v 'nndh?e[ai]rg' | egrep -v '^(lionndubh|g?ch?eanndán|sh?onnda$)' | egrep -v '^(b?ph?onnd)' | egrep -v '^d?th?eanndháileoi?g'
# Rule 14.b.iv, loinnreach/mainnre are genitives, lch 113
cat $1 | egrep 'nnr' | egrep -v '(nnrua|loinnreach)$' | egrep -v '^(g?ch?eannr|mh?ainnre|lannrollá)'
# Rule 14.b.v, annsan is emphatic pronomial, not ==ansin, lch 113
cat $1 | egrep 'nns' | egrep -v '^(g?ch?eanns|n?dh?innseanch|n?gh?rinnscr|b?ph?roinnseomra|g?ch?rannseil|mh?ionnscríbhinn|m?bh?onnsmid)' | egrep -v '^annsan$'
# Rule 15.a, lch 114
cat $1 | egrep 'ln' | egrep -v '(iailnimh|ilnáisiúnta|ollnóva|ulna|ilnithe$)'  | egrep -v '^(b?ph?ailn|m?bh?allnai?sc$)'
# Rule 15.b, oirmhidne is literary genitive, lch 114
cat $1 | egrep 'dn' | egrep -v '(eicidn[eí]$|ardnósa|oirmhidne$)' | egrep -v '^(m?bh?róidn|m?bh?airdne$|mh?aidneachai?n$)' | egrep -v '^muidne$'
# Rule 16.a.i, lch 115
cat $1 | egrep 'sg' | egrep -v 'aisgh(níomh|abh|air|afa$)|fh?olúsghlantó|(uas|íos)ghrád|aoisghrúpa'  | egrep -v '^(luasgh|b?ph?easghad|g?ch?leasghleac|g?ch?raosghalai?r$|g?ch?rosgho|n?dh?easghná|d?th?re?asgh|n?gh?lasgh|neasghao|rósghairdíní?$)'
# Rule 16.a.iii, lch 115
cat $1 | egrep 'sd' | egrep -v '(aisdúich|eisdírith|osduine$)' | egrep -v '^(g?ch?osdearg|d?th?easdí|d?th?rasdu|leasde|rósd|n?gh?lasdoi?nn)' | egrep -v 'osdaonna$'
# Rule 19.g, lch 121, bladha, miadha, mudha, spleadha  literary
cat $1 | egrep 'dha$' | egrep -v '(fhea|uidhea)dha$' | egrep -v '^((bh)?fea|m?bh?la|mh?(ia|u|o)|splea)dha$'
# Rule 23.I.a, lch 123
cat $1 | egrep 'árr'
# Rule 23.I.b, lch 123
cat $1 | egrep 'éir[dl]' | egrep -v '^(léirlé|spéirl)'
# Rule 24, lch 124
cat $1 | egrep "(-.*-|'.*')" | egrep -v '(earraí-le-roinnt$|éan-féin-é$)' | egrep -v '^[nt]-'
cat $1 | egrep '-' | egrep -v "(-.*-|'.*')" | egrep -v '^([nt]-[aeiouáéíóú]|an-|n?dh?ea-|x-gha)' | egrep -v '([bcdfglmnprst]h?)-(\1|h)' | egrep -v '[aeiouáéíóú]-[aeiouáéíóú]' | egrep -v '[A-ZÁÉÍÓÚ].*-[A-ZÁÉÍÓÚ]' | egrep -v "(ion-anál|^(bh|[bdm]')?(fh?o-[abcéegirt]|fh?rith-chuaran)|^g?ch?omh-a|^n?dh?o-(chomh|gh|ranna|scartha)|t?sh?o-(bh|gha|ranna)|t?sh?(in-sean|íos-lucht)|^([bdm]'|h)?a[mn]-)" | egrep -v '(-ca$|^g?ch?(rua-chré$|oisí-clois|raobh-abh)|iar-tharraing|órang-úta|fh?ia-chai?t$|^n?dh?iosc-jaca|uisce-sciá|^d?th?(adhall-íogair|iuf-teaf)|^m?bh?an-ab|^b?ph?ríomh-(air|bhanaist|roghchlái?r$)|^n?gh?(áma-gha|ar-amha|earr-(aighn|chlóscrío?bh))|^(réalt|spás)-am(a|anna)?$|^hais-táblaí?$|^hurdaí-gurda|^nua-staire?$|^neamh-(a|chomh|shain|incháilithe|fhéinchúis)|^mh?ór-(ais|éil)|^t-léint?e$|^u-chasadh$|^V-mhuineál$|^m?bh?éite-thástá(il|la)$)' | egrep -v '(fh?leisc-ama?$|il-eitn|idir-ilchríocha|in-bhithmh|^n?dh?o-bhraite$|^mh?(eán-am|uir-eolai?s$))'
# Rule 25, lch 127
cat $1 | egrep "'" | egrep -v "^(m?b|[dm])'"

# Others of a similar nature
# ÓD lch viii  -amhail -> -úil
cat $1 | egrep 'amhail$' | egrep -v '(sh?|^)amhail$'
# ÓD lch viii  -éaracht -> -éireacht
cat $1 | egrep 'éaracht$' | egrep -v '^mh?éaracht$'
# Ó Siadhail notes that 'ío' replaces 'ía' before a consonant
cat $1 | egrep 'ía[bcdfglmnprst]'

### Assumptions from aspell phonetics file
echo 'Checking for exceptions to assumptions made in aspell phonetics file...'
echo '  (errors in this section may imply gaeilge_phonet.dat needs attention)'

echo 'A...'
# ANBHANN
cat $1 | egrep 'nbhann' | egrep -v 'anbhanna?$'

# ANBHAIN
cat $1 | egrep 'anbhai' | egrep -v '(anbhainne?$|^m?bh?uanbhail|^n?gh?rianbhaic$)'

# AERGA
cat $1 | egrep 'erga' | egrep -v 'aerga$'

# AORG
cat $1 | egrep 'aorg[^h]' | egrep -v '^(mh?|t?sh?)aorg[aá]'

# AEILG
cat $1 | egrep 'aeilg' | egrep -v 'Gh?aeilge'

# AILBH
cat $1 | egrep 'ailbh' | egrep -v '[bcs]h?ailbh'

# ALBHÁI?D
cat $1 | egrep 'albhái?d' | egrep -v '^(g?ch?oinnealbhái?d|n?gh?albhái?d$)'

# ALBH
cat $1 | egrep 'albh[^aáeoóuúr]'

# ARBHÁI?D
cat $1 | egrep 'arbhái?d' | egrep -v '^mh?ótarbhái?d$'

# ARBHUIL
cat $1 | egrep 'arbhui[^t]' | egrep -v '(arbhuill|^mh?arbhuisc)[eí]$'

# ARBHUA
cat $1 | egrep 'arbhua' | egrep -v 'eadarbhuasa'

# ARBHIN
cat $1 | egrep 'arbhin' | egrep -v '^mh?arbhintinn'

# ARBH(EI), ARBH

# ATHFH(ÁÉÓAEIOU)---
cat $1 | egrep 'thfh[íú]' | egrep -v '^d?th?áthfhéithl'

# ATH(BCD...), ADH

# AGHI---
cat $1 | egrep 'aghi' | egrep -v '^g?ch?orraghiob'

# AGHLOIN
cat $1 | egrep 'aghloi[^t]' | egrep -v '^b?ph?leicseaghloine$'

# AGH

# AOMH(FLNST)---  (first says no fh exception needed)
cat $1 | egrep 'aomhfh' | egrep -v '^naomhfhá'
cat $1 | egrep 'aomh[bcdgmpr]'

echo 'Á...'
# ÁIRG-

# ÁDHU
cat $1 | egrep 'ádhu' | egrep -v '^b?ph?ádhuill[eí]$'

# ÁDH
cat $1 | egrep 'ádh[^u]' | egrep -v 'ádhú(il|la)$'

# ÁTHFH
cat $1 | egrep 'áthfh[aeiouáéíóú]' | egrep -v '^(d?th?áthfhéithl|n?gh?náth)'

# ÁTH(BCD...)

echo 'B...'
# BANBH, BHANBH, BAINBH, BHAINBH
cat $1 | egrep 'bh?ai?nb' | egrep -v '^m?bh?ai?nbh(arúi?n)?$'

echo 'C...'
# CHÉAFAÍ--$

# CH?EARCH--
cat $1 | egrep 'ch?earch' | egrep -v '^g?ch?earchaill[eí]?$'

# CH?ONF
cat $1 | egrep 'ch?onf' | egrep -v '^g?ch?onfa(cha?|i?dh|igh|í)$'

# CH?ANBH--
cat $1 | egrep 'ch?anb' | egrep -v '^g?ch?anbhái?s'

# CH?OLBH
cat $1 | egrep 'ch?olbh' | egrep -v '^g?ch?olbhaí?$'

# CH?URF
cat $1 | egrep 'ch?urf' | egrep -v '^g?ch?urfá(nna)?$'

echo 'D...'
# DH?ORCH

# DH?EARF
cat $1 | egrep 'dh?earf' | egrep -v '^n?dh?earf[aáó]'

# DH?EIRF
cat $1 | egrep 'dh?eirf' | egrep -v '^(n|leas)?dh?eirf(éar|iúr)'

# DH?OIL(BF)
cat $1 | egrep 'dh?oil[bf]' | egrep -v '^n?dh?oil(fe|bh)'

# DH?IFEAR
cat $1 | egrep 'dh?ife' | egrep -v '^n?dh?ifear$'

# DH$
cat $1 | egrep '[^aeiouáéíóú]dh$'

# DH
cat $1 | egrep 'edh' | egrep -v '(uiscedh|ch?inedh(eigh|íothú$))'
cat $1 | egrep 'údh.'
cat $1 | egrep '(^|[^aáiou])dh[^aeiouáéíóúlr]'

# DHLÚ-- and DHL(EIÍ)--
cat $1 | egrep '[^aáiou]dhl' | egrep -v '(dhlú(th|ite)|dhlistean|dhleatha|^neamhdhlíthiú)'
cat $1 | egrep '^dhl[^aeíiuú]'

# DHR rules
cat $1 | egrep '[^aáiou]dhr[aáoóuú]' | egrep -v '((dh?obhar|uisce)dhro|^mh?arbhdhra|^(scig|n?gh?earr)dhrámaí?$|^t?sh?reangdhrumaí?$)'
cat $1 | egrep '[^aáiou]dhr[eéií]' | egrep -v '(^n?dh?ídhreasacht|dhr[eé]acht|dhreacha?$|eirdhris)'
cat $1 | egrep '^dhr[^aáeéiouú]' | egrep -v '^dhr(óla|íoda)'

echo 'E...'

# EAFAR
cat $1 | egrep 'eafar$' | egrep -v '^(n?g|m)h?eafar$'

# EOFAR

# EILBH

# EIDH

# EOMH
cat $1 | egrep 'eomh[bcdfglmnprst]' | egrep -v '^leomh[ft]'

echo 'É...'
# ÉARBH
cat $1 | egrep 'éarb' | egrep -v '^n?gh?éarbh'

# ÉARM
cat $1 | egrep 'éarm[^h]' | egrep -v 'th?éarm(a|eol)'

# ÉARG
cat $1 | egrep 'éarg[^h]' | egrep -v '^(lán)?léargai?s$'

# ÉIRG
cat $1 | egrep 'éirg[^h]' | egrep -v 'ailléirg'

# ÉIRBH
cat $1 | egrep 'éirbh' | egrep -v '^(léirbhreith|spéirbhe?an$)'

# ÉALBH
cat $1 | egrep 'éalbh' | egrep -v '^m?bh?éalbh'

# ÉAFÁ
cat $1 | egrep 'éafá' | egrep -v 'éafá$'

echo 'F...'
# FH?AIRCH
cat $1 | egrep 'fh?airc' | egrep -v 'fh?airch(e|í|íní?)$'

# FH?OIRF
cat $1 | egrep 'foirf' | egrep -v '^(bh)?foirf'

# FH?ONNMH
cat $1 | egrep 'fh?onnm' | egrep -v "^(b'|bh)?fh?onnmhai?r"

# FH?OILMH
cat $1 | egrep 'fh?oilm' | egrep -v "^([bdm]'|bh)?fh?oilmh[eí]"

# FAIDH, almost always terminal
cat $1 | egrep 'faidh[^b]' | egrep -v "fh?aidhpeái?l"

# FADH, almost always terminal
cat $1 | egrep 'fadh[^bf]' | egrep -v 'fh?adharcái?n$'

# FIDH  (fidh only terminal)
cat $1 | egrep 'fidh.'

# FEADH  almost always terminal
cat $1 | egrep 'feadh[^n]' | egrep -v '^(bh)?feadha(in)?$'

# FEAR, FAR

# FINN  almost always terminal
cat $1 | egrep 'finn[^eé]'

# FAINN  almost always terminal
cat $1 | egrep 'fainn[^eéi]'

# FÁ

# FEÁ  almost always terminal
cat $1 | egrep 'feá.' | egrep -v '^(bh)?feá(dói?r|nna$)'

# FA?Í

# FA?IMI(DS)
cat $1 | egrep 'fa?imi[ds].'

# FA?IDÍS
cat $1 | egrep 'fa?idís.'

echo 'G...'
# GH?AINMH, GH?EALLMH
cat $1 | egrep 'gh?(ain|eall)mh' | egrep -v '^n?gh?(ain|eall)mh'

# GH?LAFAI?DH

# GH
cat $1 | egrep '[^aiou]gh[^aeiouáéíóúlnr]'
cat $1 | egrep '[^aiou]ghl[ií]' | egrep -v '(^t?sh?árghliú|aimhghlic(ea|i)s)$'

echo 'I...'
# IARG
cat $1 | egrep 'iarg[^áhú]'

# IARBH

# IDIRBH

# IRBHRÚ
cat $1 | egrep 'irbhrú' | egrep -v '^mh?uirbhrúchta?(nna)?$'

# IRBHU
cat $1 | egrep 'irbhu' | egrep -v '(eochairbhuill[eí]$|^litirbhuamaí?$)'

# IFÍ$  (lots)

# INMHE(AÁ)
cat $1 | egrep 'inmhe[^aá]'

# INNMH
cat $1 | egrep 'innmh' | egrep -v '(fh?uinnmh|^g?ch?oinnmh)'

# IONMHAG, IONMH
cat $1 | egrep 'ionmh' | egrep -v '^(g?ch?ionmhai?r|mh?ionmh)'

# ITHFH
cat $1 | egrep 'ithfh' | egrep -v '(ch?ithfholc|ch?rithfhuacht|fh?rithfh|^sh?uaithfhriochadh$)'

# ITH(BCD...)

# IDH(BCD...)
cat $1 | egrep 'idh[aouáéíóú]' | egrep -v 'idhí$'

# IGH(...)
cat $1 | egrep 'igh[bgmpaouáéíóú]'

echo 'Í...'
# ÍORM
cat $1 | egrep 'íorm' | egrep -v '(^n?dh?íormaí?$|fh?íormh)'

# ÍOMH(BCD...)
cat $1 | egrep 'íomh[bcdfglmnprst]' | egrep -v '^(b?ph?r|l|r|(n?g|s)h?n)íomh'

# ÍTHS-
cat $1 | egrep 'íth[bcdfglmnpst]' | egrep -v '^g?ch?líths(í|eacha?)$'

echo 'J...'
# J
cat $1 | egrep '[jJ]' | egrep -v '^(j|n?dh?iosc-j)'

echo 'K...'
# K
cat $1 | egrep '[kK]' | egrep -v '^(karaté|Kiótó)$'

echo 'L...'
# LEANBH/LINBH always terminal
cat $1 | egrep 'l(ea|i)nbh.' | egrep -v '^leanbhaoise?$'

# L(BGM)H?

echo 'M...'
# MORFAÍ--$  always terminal
cat $1 | egrep 'morfaí.' 

# MBANBH, MBAINBH  see BANBH, etc. above

# MH?ARF
cat $1 | egrep 'mharf[^aó]'

# MODH, MHODH

echo 'N...'
# NAFAÍ--
cat $1 | egrep 'nafaí' | egrep -v '^sh?nafaí$'

# NNARB
cat $1 | egrep 'nnarb' | egrep -v 'ionnarb'

# NNEALBH--
cat $1 | egrep 'nnealbh' | egrep -v '^g?ch?oinnealbhá'

# NDORCH, NDEARF, NDEIRF, NDOIL, NDIFEAR   see  D-
# NGAINMH, NGEALLMH, NGLAF...  see G-

# NCHA(ÍS)/NCHAIS/NCHAITHE
cat $1 | egrep 'ncha([ís]|is|ith)' | egrep -v '(ionchai?s|sh?eancha)'

# NCHAIR(D)
cat $1 | egrep 'nchair' | egrep -v '(nchaird[ei]|(th?ea|th?io|grea)nchair)'

# N(BM)H?

echo 'O...'
# OFAR--$
cat $1 | egrep '[^ae]ofar' | egrep -v '^(n?gh?l?a|mh?í)ofara?$'

# OIRCH
cat $1 | egrep 'oirch' | egrep -v '.?.?oirch'

# OCALBH
cat $1 | egrep 'ocalb' | egrep -v 'fh?ocalbhá'

# ORBHÁ
cat $1 | egrep 'orbhá' | egrep -v 'fh?orbhái?s$'

# ONNCHA
cat $1 | egrep 'onncha' | egrep -v '(Dh?|fh?i)onncha'

# OMHARB
cat $1 | egrep 'omharb' | egrep -v '^g?ch?omharba'

# OMH(BCD...)

# OTH(BCD...)
cat $1 | egrep 'oth[ft]'

# ODHAO
cat $1 | egrep 'odhao' | egrep -v 'fh?odhao(ine|nna)$'

# ODH(ACLNR)
cat $1 | egrep 'odh[bcdfgmpst]' | egrep -v '^d?th?odhchaí'

# OGHRÚP
cat $1 | egrep 'oghrúp'  | egrep -v 'fh?oghrúpa'

# OGHLUA
cat $1 | egrep 'oghlua'  | egrep -v '(^(n?dh?|t?sh?)oghluaiste(achta?)?$|^d?th?oghluai?s)'

# OGHAF
cat $1 | egrep 'oghaf' | egrep -v '^n?dh?oghafa'

# OGH(AÁBCD...)
cat $1 | egrep 'oghá' | egrep -v '^d?th?oghái?n$'

echo 'Ó...'
# ÓR[GM]
cat $1 | egrep 'órg[^h]' | egrep -v '(órga$|^mh?órga|^mórgóir$)'
cat $1 | egrep 'órm[^h]'  | egrep -v 'th?órma(ch|igh)$'

# ÓGH
cat $1 | egrep 'ógh' | egrep -v "^([bdm]'|h|[nt]-)?ógh"

echo 'Q...'
# Q
cat $1 | egrep '[qQ]' | egrep -v '^qu(inín|arto)$'

echo 'R...'
# RANFAÍ
cat $1 | egrep 'ranfa' | egrep -v 'fh?rith-chuaranfaí?$'

# RAFAÍ, lots, not nec. terminal either

# RRBHA

# REALMH
cat $1 | egrep 'realm' | egrep -v '^d?th?realmh'

# RÍFEAR
cat $1 | egrep 'rífear' | egrep -v '^((h|n-)?ath)?rífear$'

# ROMH(FT)
cat $1 | egrep 'romh[bcdfglmnprst]' | egrep -v '^b?ph?romh[ft]'

# RFEAN/RFIN
cat $1 | egrep 'rf(ean|in$)' | egrep -v '(ionoirfin|^(m?bh?e|n?gh?a|t?sh?e|mh?e)irf(ea|i)n)$'

# R(BGM)H--

# RBO--
cat $1 | egrep 'rbo' | egrep -v '^g?ch?osarbolg'

echo 'S...'
# SH?ORCH
cat $1 | egrep 'sh?orch' | egrep -v '^(sh?orch|tsorchaithe$)'

# SH?OILBH
cat $1 | egrep 'sh?oilb' | egrep -v '^(sh?oilbhi?r|tsoilbhris$)'

echo 'T...'
# TH?ALMH
cat $1 | egrep 'th?alm' | egrep -v '^d?th?almh[aóú]'

# TH?INFEADH/FIDH
cat $1 | egrep 'th?inf[ei]' | egrep -v '^d?th?inf(ea|i)dh$'

# TH?AFA
cat $1 | egrep 'th?afa' | egrep -v '^d?th?afai?nn$'

# TSORCH-, TSOILBH  see S-

# TH$ rule
cat $1 | egrep '[^aeiouáéíóú]th$'

# TH->H, following check for (and find no) potential exceptions (i.e.silent TH)
cat $1 | egrep '[^a]eth' | egrep -v 'uilethac'
cat $1 | egrep 'éth' | egrep -v '^(n?dh?éth|g?ch?réthul)'
cat $1 | egrep 'óth[^aeiouáéíóú]'

echo 'U...'
# UFA
cat $1 | egrep 'ufa[ír]' | egrep -v '^(m?bh?rufara?|(g?ch?|r)ufaí)$'

# UAI?RG
cat $1 | egrep 'uai?rg' | egrep -v '(fh?uarga(chta?)?$|^d?th?ua(irgn|rgai?n))'

# UARBH

# UALGA
cat $1 | egrep 'ualg' | egrep -v '((^n)?dh?ualg|^m?bh?ualghl)ai?s$'

# ULLMH
cat $1 | egrep 'ullm' | egrep -v 'ullmh[aóúu]'

# UMH

# UTH(BCDGMNPR)
cat $1 | egrep 'uthf'
cat $1 | egrep 'uth[^aeiouáéíóú]' | egrep -v '^(t?sh?ruth|n?gh?uthphoi?st$)'

# ULCH

# URCH(AÓ)

# UDH
cat $1 | egrep 'udh' | egrep -v '^mh?udh[aft]?'

# UGH
cat $1 | egrep 'ugh' | egrep -v '^m?bh?rugh'   # repeat of 6.I.c above

echo 'Ú...'
# ÚIRG
cat $1 | egrep 'úirg' | egrep -v '^liotúirg'

# ÚTH(BCDF...)- no 'fh' exception needed
cat $1 | egrep 'úth([gmns]|fh)'

echo 'V...'
# V  (see Litriú na Gaeilge, Rule 20, lch 121)
cat $1 | egrep '[vV]' | egrep -v "^(.?|[bdm]')[A-ZÁÉÍÓÚ]" | egrep -v '(vót|vír|volt|nóva|vialait|vinil)' | egrep -v "^([bdm]'|h|[nt]-)?(aircí|inveirteab)" | egrep -v '^([vV]|sva|leiviata|ribeaflaivin|rótvaidhlé|raiviólaí$|svuít|g?ch?ileav|n?dh?ordveidh|mh?eindiléiv)'

echo 'W...'
# W
cat $1 | egrep '[wW]' | egrep -v '(^wigwam|Dh?arwin)'

echo 'X...'
# X
cat $1 | egrep '[xX]' | egrep -v '^(Mh?arx.|x([aeéií]|-gha))'

echo 'Y...'
# Y
cat $1 | egrep '[yY]' | egrep -v '^yóyó'

echo 'Z...'
# Z
cat $1 | egrep '[zZ]' | egrep -v '^(z|b?ph?uza)' | egrep -v "^([bdm]'|h|[nt]-?)?(ózó|Úizbeiceast)"

## Remainder were inspired by gaeilge_phonet.dat but either
## correspond to defunct rules or exceptions have no logical implications
echo 'Checking for exceptions to defunct rules in phonetics file...'
cat $1 | egrep 'ealbhr' | egrep -v '^n?gh?ealbhruth'
cat $1 | egrep '..*gc[^h]'
cat $1 | egrep 'fph' | egrep -v '^n?gh?rafpháip'
cat $1 | egrep 'cdh' | egrep -v '^(m?bh?reacdhorc|sh?priocdhát|t?sh?iocdhó)'
cat $1 | egrep '..*bp' | egrep -v 'sh?ubpoena'
cat $1 | egrep 'íomhb' | egrep -v '^b?ph?ríomhbhe?an$'
cat $1 | egrep 'bhmh' | egrep -v '^d?th?aobhmhao'
cat $1 | egrep 'cgh' | egrep -v '^(m?bh?rioscghlór|t?sh?earcghr)'
cat $1 | egrep 'chdh' | egrep -v '^(n?dh?rochdh|g?ch?ríochdheigh|smeachdhún)'
cat $1 | egrep '[áiuú]fh' | egrep -v '^m?bh?áfhuinneo'
cat $1 | egrep 'éfh' | egrep -v '^n?dh?éfh'
cat $1 | egrep 'ófh' | egrep -v '^g?ch?lófhoir'

### Optional Broad/Broad, Slender/Slender check... lots of exceptions.
#echo 'Checking for broad/slender or slender/broad...'
#cat $1 | egrep '[aáoóuú][bcdfghlmnprst]+[iíeé]' | more
#cat $1 | egrep '[iíeé][bcdfghlmnprst]+[aáoóuú]' | more