Skip to main content
added 130 characters in body
Source Link
Lux
  • 293
  • 5
  • 9

PHP, 3311 2988 2916 2845 2759 2671 26672667 2509 2484 bytes, passing 301/400

<?define(J,[ieh,ah,aa,Ah,eh,ee,ie,ih,oh,oo,Oh,uh,Uh,au,eu,Au,ei,ai,ey,ay,a,e,i,o,u,A,O,U,y]);$b=$e=[];function v($a){return in_array($a,J);}function n($a){return!v($a);}function pronounce($w){global$b,$e;$w=strtr(strtolower(strtr($w,[ß=>5,Ä=>4,ä=>4,Ö=>0,ö=>0,Ü=>6,ü=>6])),[5=>S,4=>A,0=>O,6=>U]);$W=[];$L=$w;while($L)foreach(array_merge([tzsch,dsch,tsch,zsch,sch,chs,ch,ck,dt,ng,nk,pf,ph,qu,ss,th,tz,b,c,d,f,g,h,j,k,l,m,n,p,r,s,S,t,v,w,x,z],J)as$c){$l=strlen($c);if(substr($L,0,$l)==$c){$W[]=$c;$L=substr($L,$l);break;}}$s=[];$l=count($W);for($o=$t=$i=0;$i<$l;$i++){$c=$W[$i];$p=$i?$W[$i-1]:0;$n=$i==$l-1?0:$W[$i+1];if(!$n||!(n($c)&&$c==$n&&n($W[$i+2])))$s[$o][]=$c;if($p&&((!$n&&v($c)&&n($p))||(n($n)&&v($W[$i+2]))))$s[++$o]=[];}$s[count($s)-1]||array_pop($s);foreach($s as$z){$b[]=$t;$t+=count($z);$e[]=$t;}$o=[sie=>ziQ,du=>duQ,'die'=>diQ,der=>deQAB,zu=>tsuQ,wir=>viQAB,mir=>miQAB,den=>deQn,dass=>das,er=>eQAB,so=>zoQ,war=>vaQAB,für=>fyQAB,ja=>jaQ,wie=>viQ,dir=>diQAB,nur=>nuQAB,dem=>deQm,ihn=>iQn,auch=>aUBx,ihr=>iQAB,da=>daQ,schon=>ʃoQn,wenn=>vEn,mal=>maQl,gut=>guQt,nach=>naQx,will=>vIl,muss=>mUs,hab=>haQp,vor=>foQAB,ihm=>miQm,tun=>tuQn][$w]?:'';if($o)goto x;$P=$B=$S=$V=$Z=0;count($s)>1&&$o=[ver=>fEAB,da=>da,ge=>gC][join($s[0])];$o&&$P=1&&array_shift($s);(($P||count($s)==2)&&$o.=W)||(count($s)>2&&$d=1&&$h=(int)count($s)/2);$w=array_merge(...$s);foreach($w as$l){if(0<$S--)continue;$n=$w[$B+1];$p=$w[$B-1];$f='';$Z+=in_array($B,$b);$f=$l==d&&!$n?t:($l==b&&(!$n||$n==t)?p:($l==g&&(!$n||$n==t)?((!$n&&$p==i)?K:k):($l==c?(($n==A||$n==e||$n==i)?ts:k):($l==ch?(($p==a||$p==o||$p==u)?x:K):($l==chs||$l==x?ks:($l==ck?k:($l==dsch?dZ:($l==dt||$l==th?t:($l==ph||$l==v?f:(!$f&&$l==g?g:($l==h?(v($n)?h:''):($l==ng?N:($l==nk?Nk:($l==qu?kv:($l==r?((!v($n)&&!$n==t)?AB:R):($l==sch?S:($l==ss||$l==S?s:($l==tsch||$l==tzsch||$l==zsch?tS:($l==tz||$l==z?ts:($l==w?v:($l==s?(!$p&&($n==p||$n==t))?S:(v($n)?z:s):$f)))))))))))))))))))));$U=0;if(v($l)){if(strlen($l)>1)($f=[au=>aUB,eu=>cYB,ei=>aIB][$l])||$U=1;else{if(n($n)&&((!$w[$B+2]&&$n!=n)||v($w[$B+2])))$U=1;if($l==e){$U=!$n?:$U;if(!$w[$B+2]){if($n==r)($f=A)&&$U=!$S=1;if($n==m||$n==l)$f=C;}}elseif($n==ch)$U=0;if(in_array($B,$e))$U=0;}$f=($U||!$Z)&&!$f?($l[0]==O?D:($l[0]==U?y:($l[0]==A?E:$l[0]))).Q:(!$f?($l==e?((!$n||(!$w[$B+2]&&($n==n||$n==s)))?C:E):($l==A?E:($l==i?I:($l==o?c:($l==u?U:(($l==U||$l==y)?Y:$l)))))):$f);$V++;}$f=$f?:$l;if($d&&$Z==$h)$f.=W;$o.=$f;$B++;}if(strpos($o,W)===false&&$V>1)$o=W.$o;for(;$j++<strlen($o);)if($o[$j]==$o[$j+1])$o=substr($o,0,$j).substr($o,$j+1);x:return strtr($o,[S=>ʃ,Z=>ʒ,K=>ç,g=>ɡ,N=>ŋ,Q=>'ː',W=>ˈ,B=>'̯',R=>ʁ,A=>ɐ,E=>ɛ,O=>œ,I=>ɪ,Y=>ʏ,U=>ʊ,c=>ɔ,C=>ə,D=>ø]);}

<?$f=fopen(__FILE__,r);fseek($f,__COMPILER_HALT_OFFSET__);eval(strtr(stream_get_contents($f),[F=>'=>',M=>'==','&'=>'&&',H=>'function ',A_=>'array',G=>'if',4=>'for','|'=>'||','~'=>'))','%'=>str,7=>'=$',8=>'[]',9=>'!$','@'=>'count(','#'=>';$',5=>'return ',3=>':(']));__halt_compiler();define(J,[ieh,ah,aa,Ah,eh,ee,ie,ih,oh,oo,Oh,uh,Uh,au,eu,Au,ei,ai,ey,ay,a,e,i,o,u,A,O,U,y])#b7e=8;Hv($a){5in_A_($a,J);}Hn($a){5!v($a);}Hpronounce($w){global$b,$e#w=%tr(%tolower(%tr($w,[ßF1,ÄF2,äF2,ÖF0,öF0,ÜF6,üF6]~,[1FS,2FA,0FO,6FU])#W=8#L7w;while($L)4each(A__merge([tzsch,dsch,tsch,zsch,sch,chs,ch,ck,dt,ng,nk,pf,ph,qu,ss,th,tz,b,c,d,f,g,h,j,k,l,m,n,p,r,s,S,t,v,w,x,z],J)as$c){$l=%len($c);G(sub%($L,0,$l)M$c){$W87c#L=sub%($L,$l);break;}}$s=8#l=@$W);4($o7t7i=0#i<$l#i++){$c7W[$i]#p7i?$W[$i-1]:0#n7iM$l-1?0:$W[$i+1];G(9n|!(n($c)&$cM$n&n($W[$i+2]~)$s[$o]87c;G($p&((9n&v($c)&n($p~|(n($n)&v($W[$i+2]~~$s[++$o]=8;}$s[@$s)-1]|A__pop($s);4each($s as$z){$b87t#t+=@$z)#e87t;}$o=[sieFziQ,duFduQ,'die'FdiQ,derFdeQT,zuFtsuQ,wirFviQT,mirFmiQT,denFdeQn,dassFdas,erFeQT,soFzoQ,warFvaQT,fürFfyQT,jaFjaQ,wieFviQ,dirFdiQT,nurFnuQT,demFdeQm,ihnFiQn,auchFaUBx,ihrFiQT,daFdaQ,schonFʃoQn,wennFvEn,malFmaQl,gutFguQt,nachFnaQx,willFvIl,mussFmUs,habFhaQp,vorFfoQT,ihmFmiQm,tunFtuQn][$w]?:'';G($o)goto x#P7B7S7V7Z=0;@$s)>1&$o=[verFfET,daFda,geFgC][join($s[0])]#o&$P=1&A__shGt($s);(($P|@$s)M2)&$o.=W)|(@$s)>2&$d=1&$h=(int)@$s)/2)#w=A__merge(...$s);4each($w as$l){G(0<$S--)continue#n7w[$B+1]#p7w[$B-1]#f=''#Z+=in_A_($B,$b)#f7lMd&9n?t3$lMb&(9n|$nMt)?p3$lMg&(9n|$nMt)?((9n&$pMi)?K:k)3$lMc?(($nMA|$nMe|$nMi)?ts:k)3$lMch?(($pMa|$pMo|$pMu)?x:K)3$lMchs|$lMx?ks3$lMck?k3$lMdsch?dZ3$lMdt|$lMth?t3$lMph|$lMv?f39f&$lMg?g3$lMh?(v($n)?h:'')3$lMng?N3$lMnk?Nk3$lMqu?kv3$lMr?((!v($n)&9nMt)?T:R)3$lMsch?S3$lMss|$lMS?s3$lMtsch|$lMtzsch|$lMzsch?tS3$lMtz|$lMz?ts3$lMw?v3$lMs?(9p&($nMp|$nMt~?S3v($n)?z:s):$f~~~~~~~~~~)#U=0;G(v($l~{G(%len($l)>1)($f=[auFaUB,euFcYB,eiFaIB][$l])|$U=1;else{G(n($n)&((9w[$B+2]&$n!=n)|v($w[$B+2]~)$U=1;G($lMe){$U=9n?:$U;G(9w[$B+2]){G($nMr)($f=A)&$U=9S=1;G($nMm|$nMl)$f=C;}}elseG($nMch)$U=0;G(in_A_($B,$e~$U=0;}$f=($U|9Z)&9f?($l[0]MO?D3$l[0]MU?y3$l[0]MA?E:$l[0]~).Q39f?($lMe?((9n|(9w[$B+2]&($nMn|$nMs~)?C:E)3$lMA?E3$lMi?I3$lMo?c3$lMu?U3($lMU|$lMy)?Y:$l~~~:$f)#V++;}$f7f?:$l;G($d&$ZM$h)$f.=W#o.7f#B++;}G(%pos($o,W)M=false&$V>1)$o=W.$o;4(#j++<%len($o);)G($o[$j]M$o[$j+1])$o=sub%($o,0,$j).sub%($o,$j+1);x:5%tr($o,[SFʃ,ZFʒ,KFç,gFɡ,NFŋ,QF'ː',WFˈ,TFɐ̯,BF'̯',RFʁ,AFɐ,EFɛ,OFœ,IFɪ,YFʏ,UFʊ,cFɔ,CFə,DFø]);}

Powered by the tears of ternary statements.

EDIT 7: Squeezed off ~170 bytes by writing a preprocessor into the program. As a consequence, the actual program (everything after __halt_compiler();) is kinda hard to read. If you want the unprocessed program, switch eval with print in the third statement.

PHP, 3311 2988 2916 2845 2759 2671 2667 bytes, passing 301/400

<?define(J,[ieh,ah,aa,Ah,eh,ee,ie,ih,oh,oo,Oh,uh,Uh,au,eu,Au,ei,ai,ey,ay,a,e,i,o,u,A,O,U,y]);$b=$e=[];function v($a){return in_array($a,J);}function n($a){return!v($a);}function pronounce($w){global$b,$e;$w=strtr(strtolower(strtr($w,[ß=>5,Ä=>4,ä=>4,Ö=>0,ö=>0,Ü=>6,ü=>6])),[5=>S,4=>A,0=>O,6=>U]);$W=[];$L=$w;while($L)foreach(array_merge([tzsch,dsch,tsch,zsch,sch,chs,ch,ck,dt,ng,nk,pf,ph,qu,ss,th,tz,b,c,d,f,g,h,j,k,l,m,n,p,r,s,S,t,v,w,x,z],J)as$c){$l=strlen($c);if(substr($L,0,$l)==$c){$W[]=$c;$L=substr($L,$l);break;}}$s=[];$l=count($W);for($o=$t=$i=0;$i<$l;$i++){$c=$W[$i];$p=$i?$W[$i-1]:0;$n=$i==$l-1?0:$W[$i+1];if(!$n||!(n($c)&&$c==$n&&n($W[$i+2])))$s[$o][]=$c;if($p&&((!$n&&v($c)&&n($p))||(n($n)&&v($W[$i+2]))))$s[++$o]=[];}$s[count($s)-1]||array_pop($s);foreach($s as$z){$b[]=$t;$t+=count($z);$e[]=$t;}$o=[sie=>ziQ,du=>duQ,'die'=>diQ,der=>deQAB,zu=>tsuQ,wir=>viQAB,mir=>miQAB,den=>deQn,dass=>das,er=>eQAB,so=>zoQ,war=>vaQAB,für=>fyQAB,ja=>jaQ,wie=>viQ,dir=>diQAB,nur=>nuQAB,dem=>deQm,ihn=>iQn,auch=>aUBx,ihr=>iQAB,da=>daQ,schon=>ʃoQn,wenn=>vEn,mal=>maQl,gut=>guQt,nach=>naQx,will=>vIl,muss=>mUs,hab=>haQp,vor=>foQAB,ihm=>miQm,tun=>tuQn][$w]?:'';if($o)goto x;$P=$B=$S=$V=$Z=0;count($s)>1&&$o=[ver=>fEAB,da=>da,ge=>gC][join($s[0])];$o&&$P=1&&array_shift($s);(($P||count($s)==2)&&$o.=W)||(count($s)>2&&$d=1&&$h=(int)count($s)/2);$w=array_merge(...$s);foreach($w as$l){if(0<$S--)continue;$n=$w[$B+1];$p=$w[$B-1];$f='';$Z+=in_array($B,$b);$f=$l==d&&!$n?t:($l==b&&(!$n||$n==t)?p:($l==g&&(!$n||$n==t)?((!$n&&$p==i)?K:k):($l==c?(($n==A||$n==e||$n==i)?ts:k):($l==ch?(($p==a||$p==o||$p==u)?x:K):($l==chs||$l==x?ks:($l==ck?k:($l==dsch?dZ:($l==dt||$l==th?t:($l==ph||$l==v?f:(!$f&&$l==g?g:($l==h?(v($n)?h:''):($l==ng?N:($l==nk?Nk:($l==qu?kv:($l==r?((!v($n)&&!$n==t)?AB:R):($l==sch?S:($l==ss||$l==S?s:($l==tsch||$l==tzsch||$l==zsch?tS:($l==tz||$l==z?ts:($l==w?v:($l==s?(!$p&&($n==p||$n==t))?S:(v($n)?z:s):$f)))))))))))))))))))));$U=0;if(v($l)){if(strlen($l)>1)($f=[au=>aUB,eu=>cYB,ei=>aIB][$l])||$U=1;else{if(n($n)&&((!$w[$B+2]&&$n!=n)||v($w[$B+2])))$U=1;if($l==e){$U=!$n?:$U;if(!$w[$B+2]){if($n==r)($f=A)&&$U=!$S=1;if($n==m||$n==l)$f=C;}}elseif($n==ch)$U=0;if(in_array($B,$e))$U=0;}$f=($U||!$Z)&&!$f?($l[0]==O?D:($l[0]==U?y:($l[0]==A?E:$l[0]))).Q:(!$f?($l==e?((!$n||(!$w[$B+2]&&($n==n||$n==s)))?C:E):($l==A?E:($l==i?I:($l==o?c:($l==u?U:(($l==U||$l==y)?Y:$l)))))):$f);$V++;}$f=$f?:$l;if($d&&$Z==$h)$f.=W;$o.=$f;$B++;}if(strpos($o,W)===false&&$V>1)$o=W.$o;for(;$j++<strlen($o);)if($o[$j]==$o[$j+1])$o=substr($o,0,$j).substr($o,$j+1);x:return strtr($o,[S=>ʃ,Z=>ʒ,K=>ç,g=>ɡ,N=>ŋ,Q=>'ː',W=>ˈ,B=>'̯',R=>ʁ,A=>ɐ,E=>ɛ,O=>œ,I=>ɪ,Y=>ʏ,U=>ʊ,c=>ɔ,C=>ə,D=>ø]);}

Powered by the tears of ternary statements.

PHP, 3311 2988 2916 2845 2759 2671 2667 2509 2484 bytes, passing 301/400

<?$f=fopen(__FILE__,r);fseek($f,__COMPILER_HALT_OFFSET__);eval(strtr(stream_get_contents($f),[F=>'=>',M=>'==','&'=>'&&',H=>'function ',A_=>'array',G=>'if',4=>'for','|'=>'||','~'=>'))','%'=>str,7=>'=$',8=>'[]',9=>'!$','@'=>'count(','#'=>';$',5=>'return ',3=>':(']));__halt_compiler();define(J,[ieh,ah,aa,Ah,eh,ee,ie,ih,oh,oo,Oh,uh,Uh,au,eu,Au,ei,ai,ey,ay,a,e,i,o,u,A,O,U,y])#b7e=8;Hv($a){5in_A_($a,J);}Hn($a){5!v($a);}Hpronounce($w){global$b,$e#w=%tr(%tolower(%tr($w,[ßF1,ÄF2,äF2,ÖF0,öF0,ÜF6,üF6]~,[1FS,2FA,0FO,6FU])#W=8#L7w;while($L)4each(A__merge([tzsch,dsch,tsch,zsch,sch,chs,ch,ck,dt,ng,nk,pf,ph,qu,ss,th,tz,b,c,d,f,g,h,j,k,l,m,n,p,r,s,S,t,v,w,x,z],J)as$c){$l=%len($c);G(sub%($L,0,$l)M$c){$W87c#L=sub%($L,$l);break;}}$s=8#l=@$W);4($o7t7i=0#i<$l#i++){$c7W[$i]#p7i?$W[$i-1]:0#n7iM$l-1?0:$W[$i+1];G(9n|!(n($c)&$cM$n&n($W[$i+2]~)$s[$o]87c;G($p&((9n&v($c)&n($p~|(n($n)&v($W[$i+2]~~$s[++$o]=8;}$s[@$s)-1]|A__pop($s);4each($s as$z){$b87t#t+=@$z)#e87t;}$o=[sieFziQ,duFduQ,'die'FdiQ,derFdeQT,zuFtsuQ,wirFviQT,mirFmiQT,denFdeQn,dassFdas,erFeQT,soFzoQ,warFvaQT,fürFfyQT,jaFjaQ,wieFviQ,dirFdiQT,nurFnuQT,demFdeQm,ihnFiQn,auchFaUBx,ihrFiQT,daFdaQ,schonFʃoQn,wennFvEn,malFmaQl,gutFguQt,nachFnaQx,willFvIl,mussFmUs,habFhaQp,vorFfoQT,ihmFmiQm,tunFtuQn][$w]?:'';G($o)goto x#P7B7S7V7Z=0;@$s)>1&$o=[verFfET,daFda,geFgC][join($s[0])]#o&$P=1&A__shGt($s);(($P|@$s)M2)&$o.=W)|(@$s)>2&$d=1&$h=(int)@$s)/2)#w=A__merge(...$s);4each($w as$l){G(0<$S--)continue#n7w[$B+1]#p7w[$B-1]#f=''#Z+=in_A_($B,$b)#f7lMd&9n?t3$lMb&(9n|$nMt)?p3$lMg&(9n|$nMt)?((9n&$pMi)?K:k)3$lMc?(($nMA|$nMe|$nMi)?ts:k)3$lMch?(($pMa|$pMo|$pMu)?x:K)3$lMchs|$lMx?ks3$lMck?k3$lMdsch?dZ3$lMdt|$lMth?t3$lMph|$lMv?f39f&$lMg?g3$lMh?(v($n)?h:'')3$lMng?N3$lMnk?Nk3$lMqu?kv3$lMr?((!v($n)&9nMt)?T:R)3$lMsch?S3$lMss|$lMS?s3$lMtsch|$lMtzsch|$lMzsch?tS3$lMtz|$lMz?ts3$lMw?v3$lMs?(9p&($nMp|$nMt~?S3v($n)?z:s):$f~~~~~~~~~~)#U=0;G(v($l~{G(%len($l)>1)($f=[auFaUB,euFcYB,eiFaIB][$l])|$U=1;else{G(n($n)&((9w[$B+2]&$n!=n)|v($w[$B+2]~)$U=1;G($lMe){$U=9n?:$U;G(9w[$B+2]){G($nMr)($f=A)&$U=9S=1;G($nMm|$nMl)$f=C;}}elseG($nMch)$U=0;G(in_A_($B,$e~$U=0;}$f=($U|9Z)&9f?($l[0]MO?D3$l[0]MU?y3$l[0]MA?E:$l[0]~).Q39f?($lMe?((9n|(9w[$B+2]&($nMn|$nMs~)?C:E)3$lMA?E3$lMi?I3$lMo?c3$lMu?U3($lMU|$lMy)?Y:$l~~~:$f)#V++;}$f7f?:$l;G($d&$ZM$h)$f.=W#o.7f#B++;}G(%pos($o,W)M=false&$V>1)$o=W.$o;4(#j++<%len($o);)G($o[$j]M$o[$j+1])$o=sub%($o,0,$j).sub%($o,$j+1);x:5%tr($o,[SFʃ,ZFʒ,KFç,gFɡ,NFŋ,QF'ː',WFˈ,TFɐ̯,BF'̯',RFʁ,AFɐ,EFɛ,OFœ,IFɪ,YFʏ,UFʊ,cFɔ,CFə,DFø]);}

Powered by the tears of ternary statements.

EDIT 7: Squeezed off ~170 bytes by writing a preprocessor into the program. As a consequence, the actual program (everything after __halt_compiler();) is kinda hard to read. If you want the unprocessed program, switch eval with print in the third statement.

added 12 characters in body
Source Link
Lux
  • 293
  • 5
  • 9

Testing code is here, though it does depend on this filethis file.

Testing code is here, though it does depend on this file.

Testing code is here, though it does depend on this file.

added 22 characters in body
Source Link
Lux
  • 293
  • 5
  • 9

PHP, 3311 2988 2916 2845 2759 26712671 2667 bytes, passing 301/400

PHP, 3311 2988 2916 2845 2759 2671 bytes, passing 301/400

PHP, 3311 2988 2916 2845 2759 2671 2667 bytes, passing 301/400

added 67 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
deleted 63 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
deleted 49 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
deleted 50 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
added 47 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
deleted 300 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
added 36 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
added 53 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
deleted 6474 characters in body
Source Link
Lux
  • 293
  • 5
  • 9
Loading
Source Link
Lux
  • 293
  • 5
  • 9
Loading