| Bytes | Lang | Time | Link |
|---|---|---|---|
| nan | 240715T184131Z | bigyihsu | |
| 286 | Retina 0.8.2 | 240405T114246Z | Neil |
| 348 | JavaScript ES6 | 240404T153443Z | Arnauld |
| 431 | Python 3 | 240404T161654Z | totallyh |
Lexurgy, 660 bytes
symbol sc,sf,sm,sp,st,SC,SF,SM,SP,ST
class v {e,é,i,í,a,á,o,ó,u,ú}
class V {E,É,I,Í,A,Á,O,Ó,U,Ú}
element W {@v,@V}
element L {mé,tú,sé}
element E {muid,sibh,siad}
element a {a,b,c,d,e,f,g,h,i,l,m,n,o,p,r,s,t,u,á,é,í,ó,ú}
element A {A,B,C,D,E,F,G,H,I,L,M,N,O,P,R,S,T,U,Á,É,Í,Ó,Ú}
h:
*=>h/sí $$ _ @W
*=>h/@L $$ {b,c,d,f,g,m,p,s,t} _//@L $$ {sc,sf,sm,sp,st} _
*=>H/@L $$ {B,C,D,F,G,M,P,S,T} _//@L $$ {SC,SF,SM,SP,ST} _
{b,c,d,f,g,p,t,B,C,D,F,G,P,T}=>{mb,gc,nd,bhf,ng,bp,dt,mB,gC,nD,bhF,nG,bP,dT}/@E $$ _
*=>n/@E $$ _ @V
*=>n\-/@E $$ _ @v
{@L,sí,@E}=>{{mo,do,a},a,{ár,bhur,a}}
i:
o $$=>' */_ @W
c:
@a=>@A/_ []* $$ []* @A
@a=>@A/_ ' []* @A
A large number of bytes were wasted on one-off rules. and just listing out lowercase/uppercase letters.
I will need to see if doing this as more idiomatic Lexurgy (with features and such) would be shorter.
Ungolfed Explanation
# define a whole bunch of stuff to start with
symbol sc,sf,sm,sp,st,SC,SF,SM,SP,ST # consider the s-clusters as a single segment
class v {e,é,i,í,a,á,o,ó,u,ú}
class V {E,É,I,Í,A,Á,O,Ó,U,Ú}
element W {@v,@V} # all vowels
element lentites {mé,tú,sé} # pronouns that cause lentition
element eclipses {muid,sibh,siad} # pronouns that cause eclipsis
element a {a,b,c,d,e,f,g,h,i,l,m,n,o,p,r,s,t,u,á,é,í,ó,ú}
element A {A,B,C,D,E,F,G,H,I,L,M,N,O,P,R,S,T,U,Á,É,Í,Ó,Ú}
h-prothesis:
# nothing turns into h after pronoun sí
*=>h / sí $$ _ @W
lentition:
# nothing turns into h after lentition pronouns, EXCEPT for the s-clusters below
*=>h / @lentites $$ {b,c,d,f,g,m,p,s,t} _ // @lentites $$ {sc,sf,sm,sp,st} _
*=>H / @lentites $$ {B,C,D,F,G,M,P,S,T} _ // @lentites $$ {SC,SF,SM,SP,ST} _
eclipsis:
# replace each of these... with each of these... when following an eclipsis pronoun.
{b,c,d,f,g,p,t,B,C,D,F,G,P,T} => {mb,gc,nd,bhf,ng,bp,dt,mB,gC,nD,bhF,nG,bP,dT} / @eclipses $$ _
# handling vowel eclipsis
* => n / @eclipses $$ _ @V
* => n\- / @eclipses $$ _ @v
pronouns-conjunctive-to-possessive:
# translate conjunctive into their possessive form
{@lentites,sí,@eclipses}=>{{mo,do,a},a,{ár,bhur,a}}
elision:
# handle elision for mo and do
o $$ => ' * / _ @W
caps:
# fix casing for the uppercase nouns.
@a=>@A / _ []* $$ []* @A
@a=>@A / _ ' []* @A # this case is specifically for elided mo and do
Retina 0.8.2, 286 bytes
[aáeéiíoóuú]
!$&
s!í, (!)?
a $#1$*h
[éú], ([bcdfgmpt]|s(?![cfmpt]))
$&#
s!é,
a
é,
o
t!ú,
do
o !
'
([dh], )(d|g|(!))
$1n$#3$*-$2
[dh], [bcfpt]
$&@
b@
m$&
c@
g$&
f@
bh$&
p@
b$&
t@
d$&
@|!
muid,
ár
sibh,
bhur
siad,
a
T`láéíóú`LÁÉÍÓÚ`.+[ '](?=.*[A-Z])
([AR] n)-
$1
#([A-ZÁÉÍÓÚ])
H$1
#
h
Try it online! Link is to test suite that runs the code on each input only (the code would otherwise mangle the outputs) and then deletes the successful tests. Explanation: Conveniently all of the Irish vowels are in Retina's default ISO-8859-1 character set.
i)`
Run the first half of the script case-insensitively.
[aáeéiíoóuú]
!$&
Precede vowels with a ! to make them easier to match.
s!í, (!)?
a $#1$*h
Handle the h-prothesis.
[éú], ([bcdfgmpt]|s(?![cfmpt]))
$&#
Handle lenition, but insert # as a placeholder which will be converted to the correct case of H later.
s!é,
a
é,
o
t!ú,
do
o !
'
Change the lenition conjunctives to possessives and fix up o before a vowel.
([dh], )(d|g|(!))
$1n$#3$*-$2
Handle the eclipsis of a d, g or vowel, assuming for now that the vowel is in lower case.
[dh], [bcfpt]
$&@
b@
m$&
c@
g$&
f@
bh$&
p@
b$&
t@
d$&
Handle the other eclipsis consonants.
@|!
Delete the @ and ! markers are they're not needed any more.
muid,
ár
sibh,
bhur
siad,
a
Change the eclipsis conjunctions to possessives.
T`láéíóú`LÁÉÍÓÚ`.+[ '](?=.*[A-Z])
Capitalise the possessives if there is a capital letter in the noun.
([AR] n)-
$1
Remove the - if the vowel eclipsis was in upper case.
#([A-ZÁÉÍÓÚ])
H$1
#
h
Change the # to an H of the appropriate case.
JavaScript (ES6), 348 bytes
Expects (pronoun)(word).
p=>w=>(a="mé/mo //m'/tú/do //d'/sé/a /sí/a /muid/ár /sibh/bhur /siad/a ".split`/`)[2*((i=a.indexOf(p))<5&(u=/[A-Z]/.test(w),v=/^[aeiouá-ú]/i.test(w)))-~i][C=`to${u?"Upp":"Low"}erCase`](s="bmgncgdnpbtdfb")+(i<9?w.replace(/^[bcdfgmpt]|s(?![cfmpt])/i,"$&h")[C]():i>10?v?(u?"n":"n-")+w:(j=s[C]().search(w[0]))&1?w:s[j^1]+["h"[j-12]]+w:v?"h"+w:w)
Python 3, 431 bytes
def c(p,w):
v='eéiíaáoóuú';t='mé tú sí sé muid sibh siad'.split().index(p);p='mo do a a ár bhur a'.split()[t];s=' ';f=w[0].lower();l='fbcdgpt'
if w.isupper():p=p.upper()
if t>3:
if f in l:w='bmgnnbdh'[l.index(f)::7]+w
if f in v:w='n'+'-'*w[0].islower()+w
if t<2and f in v:p=p[0];s="'"
w='h'*(t==2and f in v)+w[0]+'hH'[w[1].isupper()]*(t<4)*(t!=2)*(f in'ms'+l)*(w[1]not in'cCfFmMpPtT'*(f=='s'))+w[1:];return p+s+w
You tell me I've somehow made a mistake and I'm deleting this post and forgetting I ever submitted it in the first place.