Created
May 10, 2010 05:42
-
-
Save sgallese/395720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
################################################################ | |
# Autor: Xavier López Morrás (2005) | |
# | |
# [email protected] | |
# | |
# separador.pl SEPARADOR DE SÍLABAS Y ACENTUADOR . | |
# INPUT: transcripcion. | |
# OUTPUT: transcripcion silabificada y acentuada. | |
################################################################ | |
##################################################################### | |
#### Puedes hacer uso libre del script y código a nivel personal. | |
#### Para otras finalidades consultar al autor. | |
##################################################################### | |
# Used to run program from command line | |
# Usage: perl separador.pl "word" | |
# Note the quotes around word | |
# E.g.: perl transcriptor.pl "gato" | |
$INPUT = $ARGV[0]; | |
$INPUT =~ s/^'(.*)'$/$1/; | |
$INPUT =~ s/^"(.*)"$/$1/; | |
@OUTPUT = &proc_sil($INPUT); | |
print "@OUTPUT"; | |
sub proc_sil { | |
#recogemos el argumento que es la transcripcion fonetica sin separacion de silabas ni acentos | |
local $transcripcion= shift; | |
#convertiendo carácteres para procesar con más facilidad | |
$transcripcion =~ s/γ/G/g; | |
$transcripcion =~ s/θ/Z/g; | |
$transcripcion =~ s/β/B/g; | |
$transcripcion =~ s/ř/R/g; | |
$transcripcion =~ s/t∫/X/g; | |
$transcripcion =~ s/ð/D/g; | |
$transcripcion =~ s/λ/L/g; | |
$transcripcion =~ s/ŋ/ç/g; | |
$transcripcion =~ s/^ +//g; | |
#creamos un array cuyos elementos son las palabras | |
@palabras= split(/ /,$transcripcion); | |
local $n=0; | |
########################################################################################## | |
## procesamiento de una palabra | |
########################################################################################## | |
for (@palabras) { | |
local $palabra=$palabras[$n]; | |
local $n2=-1; | |
################################################################################### | |
## procesamiento de una silaba individual | |
################################################################################### | |
#for ($n3=0; (length($palabra)) >= $n3; $n3++) { | |
while ( (substr($palabra,$n2,1)=~/./) ) { | |
$letra0= substr($palabra,$n2,1); | |
$letra1= substr($palabra,$n2-1,1); | |
$letra2= substr($palabra,$n2-2,1); | |
$letra3 =substr($palabra,$n2-3,1); | |
$letra4 =substr($palabra,$n2-4,1); | |
$letra_sig=substr($palabra,$n2+1,1); | |
local $silaba="8xz"; | |
#print "<font color=grey>-$letra0-</font>"; | |
#caso CV | |
if ($letra0=~/[aeiouAEIOU]/) { | |
if ($letra1=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) { | |
unless ( ($letra2=~/[tkpgGdDfbB]/) && ($letra1=~/[rl]/) ) { | |
$silaba=$letra1.$letra0; | |
##print "$silaba!!<br>"; | |
$n2--; | |
} | |
} | |
} | |
#caso CVC | |
if ($letra0=~/[nszrNpkmMlLZçdDgb]/) { | |
if ($letra1=~/[aeiouAEIOU]/) { | |
if ($letra2=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) { | |
unless( ($letra3=~/[tkpgGdDfbB]/) && ($letra2=~/[rl]/) ) { | |
$silaba="$letra2"."$letra1"."$letra0"; | |
##print "$silaba*<br>"; | |
$n2=$n2-2;} | |
} | |
} | |
} | |
#caso V | |
if ( ($letra0=~/[aeiouAEIOU]/) ) { | |
unless ( ($letra1=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) || ($letra1=~/[jw]/) ) { | |
$silaba= "$letra0"; | |
##print "$silaba?<br>"; | |
} | |
} | |
#caso VC | |
if ( ($letra0=~/[nszrNpkmMlLZçdDgb]/) && ($letra1=~/[aeiouAEIOUwj]/) ) { | |
unless ($letra2=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/ || ($letra2=~/[jw]/) ) { | |
$silaba= $letra1.$letra0; | |
##print "$silaba-<br>"; | |
$n2--; | |
} | |
} | |
#caso VCC | |
if ( ($letra0=~/[s]/) && ($letra1=~/[kn]/) && ($letra2=~/[aeiouAEIOU]/) ) { | |
$silaba= $letra2.$letra1.$letra0; | |
$n2=$n2-2; | |
##print "$silaba*<br>"; | |
} | |
#caso CCV | |
if ( ($letra0=~/[aeiouAEIOU]/) && ($letra1=~/[rl]/) && ($letra2=~/[tkpgGdDfbB]/) ) | |
{$silaba= $letra2.$letra1.$letra0; | |
##print "$silaba<br>"; | |
$n2=$n2-2;} | |
#caso CCVC | |
if ( ($letra0=~/[nszrNpkmMlLZçdDgb]/) && ($letra1=~/[aeiouAEIOU]/) && ($letra2=~/[rl]/) && ($letra3=~/[tkpgGdDfbB]/)) {$silaba= $letra3.$letra2.$letra1.$letra0; | |
##print "$silaba<br>"; | |
$n2=$n2-3;} | |
#caso CVCC | |
if ( ($letra0=~/[s]/) && ($letra1=~/[b]/) && ($letra2=~/[aeiouAEIOU]/) && ($letra3=~/[s]/) ) | |
{$silaba= $letra3.$letra2.$letra1.$letra0; | |
$n2=$n2-3;} | |
#diptongos | |
#caso CVv y Vv | |
if ( ($letra0=~/[jw]/) && ($letra1=~/[aeiou]/) ) { | |
if ($letra2 =~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) { | |
$silaba= $letra2.$letra1.$letra0; | |
##print "$silaba<br>"; | |
$n2=$n2-2; | |
} | |
elsif ( ($letra0=~/[jw]/) && ($letra1=~/[aeiou]/) ) { | |
$silaba= $letra1.$letra0; | |
##print "$silaba¿¿<br>"; | |
$n2--; | |
} | |
} | |
#caso CvV | |
if ( ($letra0=~/[aeiouAEIOU]/) && ($letra1=~/[jw]/) ) { | |
if (($letra2 =~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) ) { | |
unless ($encontrada==1) { | |
$silaba = $letra2.$letra1.$letra0; | |
##print "$silaba-<br>"; | |
$n2=$n2-2; | |
} | |
} | |
elsif ( ($letra0=~/[aeiou]/) && ($letra1=~/[jw]/) ) { | |
$silaba= $letra1.$letra0; | |
##print "$silaba<br>"; | |
$n2--; | |
} | |
} | |
#caso CvVC | |
if ( ($letra0=~/[cksznNplrçm]/) && ($letra1=~/[aeiouAEIOU]/) && ($letra2=~/[wj]/) | |
&& ($letra3=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) ) { | |
$silaba= $letra3.$letra2.$letra1.$letra0; | |
##print "$silaba<br>"; | |
$n2 = $n2-3; | |
} | |
#caso CCvV | |
if ( ($letra0=~/[aeiou]/) && ($letra1=~/[jw]/) && ($letra2=~/[rl]/) && ($letra3=~/[tkpgGdDfbB]/) ) { | |
$silaba= $letra3.$letra2.$letra1.$letra0; | |
$n2= $n2-3; | |
} | |
#caso CCVv | |
if ( ($letra0=~/[jw]/) && ($letra1=~/[aeiou]/) && ($letra2=~/[rl]/) && ($letra3=~/[tkpgGdDfbB]/) ) { | |
$silaba= $letra3.$letra2.$letra1.$letra0; | |
$n2= $n2-3; | |
} | |
#caso CCvVC | |
if ( ($letra0=~/[cksznNplrçm]/) && ($letra1=~/[aeiou]/) && ($letra2=~/[jw]/) && ($letra3=~/[rl]/) && | |
($letra4=~/[tkpgGdDfbB]/) ) { | |
$silaba= $letra4.$letra3.$letra2.$letra1.$letra0; | |
$n2= $n2-4; | |
} | |
################################## fin diptongos ############################ | |
#caso CCVCC | |
if ( ($letra0=~/s/) && ($letra1=~/[n]/) && ($letra2=~/[aeiouAEIOU]/) && ($letra3=~/[r]/) | |
&& ($letra4=~/[tkpgGdDfbB]/) ) { | |
$silaba= $letra4.$letra3.$letra2.$letra1.$letra0; | |
##print "$silaba*<br>"; | |
$n2= $n2-4; | |
} | |
#otros casos | |
if ( ($letra0=~/[jw]/) ) { | |
unless ( $letra1=~/[aeioubBcdDfgGhklLmnNñprRstvxXyzZ]/ ) { | |
$silaba= $letra0; | |
##print "$silaba*<br>"; | |
##$tonica_encontrada=1; | |
} | |
if ($letra1=~/[bBcdDfgGhklLmnNñprRstvxXyzZ]/) { | |
$silaba=$letra1.$letra0; | |
print "$silaba:<br>"; | |
$n2--; | |
} | |
} | |
if ($silaba=="8xz") { | |
$silaba="?"; | |
} | |
#comprobamos si es tónica con acento | |
unshift(@word,$silaba); | |
$n2--; | |
} | |
############################################################################################# | |
############################## fin procesamiento silaba ################################### | |
####asignamos el acento si hay tónica | |
local $n5=0; | |
for (@word) { | |
if ($word[$n5]=~/[AEIOU]/) { | |
$word[$n5]= "'".$word[$n5]; | |
$tonica_encontrada=1; | |
} | |
$n5++; | |
} | |
####### acentos por defecto ####################### | |
unless (($tonica_encontrada==1)) { | |
if (@word>1) { # si no es monosilabo.... | |
if ($word[-1]=~/[rlZdD]$/) { # si la ultima silaba acaba en C | |
$word[-1]="'"."$word[-1]"; | |
} | |
else { | |
$word[-2]="'"."$word[-2]"; | |
} | |
} | |
if ((@word==1) && ($word[0]=~/ir|ba|Ba/)) { | |
$word[0]="'"."$word[0]"; | |
} | |
elsif ( (@word==1) && ($word[0]=~/[^']..+/)) { #si es monosilabo y tiene 3 o mas letras | |
unless ($word[0]=~/^lo[sz]$|^la[sz]$/) { #excepto 'los' y 'las' | |
$word[0]="'"."$word[0]"; | |
}} | |
} | |
#añadimos la palabra a la frase en formas de elementos (=silabas) de un array | |
push(@phrase_sil, @word); | |
#reseteamos la palabra | |
@word=(); | |
$tonica_encontrada=0; | |
$n++; | |
} | |
############ convertimos de nuevo los caracteres para ser visualizador en pagina web ###################### | |
local $n4=0; | |
for (@phrase_sil) { | |
$phrase_sil[$n4] =~ s/G/γ/g; | |
$phrase_sil[$n4] =~ s/Z/θ/g; | |
$phrase_sil[$n4] =~ s/B/β/g; | |
$phrase_sil[$n4] =~ s/R/ř/g; | |
$phrase_sil[$n4] =~ s/X/t∫/g; | |
$phrase_sil[$n4] =~ s/D/ð/g; | |
$phrase_sil[$n4] =~ s/ç/ŋ/g; | |
$phrase_sil[$n4] =~ tr/AEIOU/aeiou/; | |
$phrase_sil[$n4] =~ s/L/λ/g; | |
$n4++; | |
} | |
############################################################################################################ | |
############################ fin procesamiento palabra #################################################### | |
return @phrase_sil; | |
} | |
############################### fin separador de silabas ################################################## | |
1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Used to run program from command line | |
# Usage: perl spantoipa.pl word | |
# E.g.: perl spantoipa.pl gato | |
#load a file of words separated by newlines | |
open (MYDICT, 'utf8aspellutf8ipa.txt'); | |
while (<MYDICT>) { | |
chomp; | |
#print out each word | |
#print "$_\n"; | |
#run word through transcriptor.pl | |
$transcription = `perl transcriptor.pl $_`; | |
#print "$transcription\n"; | |
#run each transcription through separador.pl | |
$separatorcommand = "perl separador.pl '" . $transcription . "'"; | |
$separator = `$separatorcommand`; | |
print "$separator\n"; | |
} | |
close (MYDICT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
################################################################# | |
#### AUTOR: Xavier López Morrás | |
#### | |
#### SCRIPT: Transcriptor fonético automático del español | |
#### EMAIL: [email protected] | |
################################################################## | |
##################################################################### | |
#### Puedes hacer uso libre del script y código a nivel personal. | |
#### Para otras finalidades consultar al autor. | |
##################################################################### | |
## INPUT: escritura ordinaria. OUTPUT: transcripcion fonetica. | |
# Used to run program from command line | |
# Usage: perl transcriptor.pl word | |
# E.g.: perl transcriptor.pl gato | |
use utf8; | |
binmode STDOUT, "utf8"; | |
$OUTPUT1 = &caracteres($ARGV[0]); | |
$OUTPUT2 = &transcribe($ARGV[0]); | |
print "$OUTPUT2"; | |
sub caracteres { | |
local $Frasev= shift; | |
$Frasev =~ tr/+/ /; | |
$Frasev =~ s/%F1/ñ/g; | |
$Frasev =~ s/%E1/á/g; | |
$Frasev =~ s/%E9/é/g; | |
$Frasev =~ s/%ED/í/g; | |
$Frasev =~ s/%F3/ó/g; | |
$Frasev =~ s/%FA/ú/g; | |
$Frasev =~ s/%2C/,/g; | |
$Frasev =~ s/%21/!/g; | |
$Frasev =~ s/%BF/¿/g; | |
$Frasev =~ s/%3F/?/g; | |
$Frasev =~ s/%FC/ü/g; | |
$Frasev =~ s/%DC/Ü/g; | |
$Frasev =~ s/%CD/Í/g; | |
$Frasev =~ s/%DA/Ú/g; | |
$Frasev =~ s/%C1/Á/g; | |
$Frasev =~ s/%C9/É/g; | |
$Frasev =~ s/%D3/Ó/g; | |
$Frasev =~ s/%3A/:/g; | |
$Frasev =~ s/%22/"/g; | |
substr ($Frasev, 0, 2) = ""; | |
return $Frasev; | |
} | |
sub transcribe { | |
local $oracion=shift; | |
$oracion=~ s/%F1/ñ/g; | |
$oracion=~ s/%E1/á/g; | |
$oracion=~ s/%E9/é/g; | |
$oracion=~ s/%ED/í/g; | |
$oracion=~ s/%F3/ó/g; | |
$oracion=~ s/%FA/ú/g; | |
$oracion=~ s/%3A/|/g; | |
$oracion=~ s/%22//g; | |
$oracion=~ s/%FC/w/g; | |
$oracion=~ s/%DC/w/g; | |
$oracion=~ s/%CD/í/g; | |
$oracion=~ s/%DA/ú/g; | |
$oracion=~ s/%C1/á/g; | |
$oracion=~ s/%C9/é/g; | |
$oracion=~ s/%D3/ó/g; | |
$oracion=~ s/%2C/,/g; | |
$oracion=~ s/%21/,/g; | |
$oracion=~ s/%BF/,/g; | |
$oracion=~ s/%3F/,/g; | |
$oracion=~ tr/+/ /; | |
$oracion=~ tr/ABCDEFGHIJKLMNÑOPQ/abcdefghijklmnñopq/; | |
$oracion=~ tr/RSTUVWXYZ/rstuvwxyz/; | |
$medida = length ( $oracion ) ; | |
$esp=0; | |
$n = 0; | |
$voc = 0; | |
$rasgo= 0; | |
while ($n < $medida ) | |
{ | |
$c = substr ( $oracion, $n, 1 ); | |
$vsig = substr ($oracion, $n+1, 1); | |
$vant = substr ($oracion, $n-1, 1); | |
if ($vsig eq " ") { | |
$esps = 1; | |
} | |
elsif ($vsig ne " ") { | |
$esps = 0; | |
} | |
$vsigg = substr ($oracion, $n+2, 1); | |
$impres=""; | |
if ($vsigg eq " " || $vsig eq " " ) { | |
$vsigg = substr ($oracion, $n+3, 1); | |
} | |
if ($vsig eq " ") { | |
$vsig = substr ($oracion, $n+2, 1); } | |
if ($vsig eq "h" && $c ne "c") { | |
$vsig = $vsigg; | |
} | |
if ($c eq "." || $c eq "," || $c eq ";") { | |
$impres= ""; | |
$rasgo = 0; } | |
if ($c eq " ") { | |
$impres=" "; | |
$esp = 1 | |
} | |
if ($c eq "a") | |
{ | |
$impres= "a"; | |
$rasgo = "vocal"; | |
$voc = "a"; | |
$esp = 0; | |
} | |
if ($c eq "á") | |
{ | |
$impres= "A"; | |
$rasgo = "vocal"; | |
$voc = "a"; | |
$esp = 0; | |
} | |
if ($c eq "é") { | |
$impres= "E"; | |
$rasgo = "vocal"; | |
$voc = "e"; | |
$esp = 0; } | |
if ($c eq "í") | |
{ | |
$impres= "I"; | |
$rasgo = "vocal"; | |
$voc = "ii"; | |
} | |
if ($c eq "ó") { | |
$impres= "O"; | |
$rasgo = "vocal"; | |
$voc = "o"; | |
$esp = 0; } | |
if ($c eq "ú") | |
{ | |
$impres= "U"; | |
$rasgo = "vocal"; | |
$voc = "uu"; | |
} | |
#resto de letras | |
if ($c eq "b") | |
{ | |
if ($rasgo eq "vocal" || $rasgo eq "l" || $rasgo eq "r") | |
{ | |
if ($vsig=~/[aeiouáéíóúrl]/) { | |
$impres="β"; } | |
else | |
{ | |
$impres= "b"; | |
} | |
} | |
else | |
{ | |
$impres= "b"; | |
} | |
$rasgo = "b"; | |
} | |
if ($c eq "c") { | |
if ( $vsig eq "h" ) { | |
$impres="t∫"; | |
$n++; | |
$rasgo = "tS"; } | |
elsif ( $vsig eq "e" || $vsig eq "i" ||$vsig eq "í" ) { | |
$impres="θ"; | |
$rasgo ="Z"; } | |
else { | |
$impres= "k"; | |
$rasgo = "k"; } | |
} | |
if ($c eq "d") { | |
if ($rasgo eq "vocal" || $rasgo eq "r") | |
{ | |
if ($vsig=~/[aeiouáéíóúrl]/) { | |
$impres= "ð" } | |
else { | |
$impres= "d"; } | |
} | |
else | |
{ | |
$impres= "d"; | |
} | |
$rasgo= "d"; | |
} | |
if ($c eq "e") { | |
$impres= "e"; | |
$rasgo = "vocal"; | |
$voc = "e"; | |
$esp = 0; } | |
if ($c eq "f") { | |
$impres= "f"; | |
$rasgo = f; } | |
if ($c eq "g") { | |
if ($vsig eq "a"|| $vsig eq "w") { | |
if ($rasgo eq "vocal" || $rasgo eq "s" || $rasgo eq "r" || $rasgo eq "l") { | |
$impres= "γ"; | |
} | |
else { | |
$impres= "g"; } | |
} | |
elsif ($vsig eq "e") { | |
$impres= "x"; } | |
elsif ($vsig eq "i") { | |
$impres= "x"; } | |
elsif ($vsig eq "o") { | |
if ($rasgo eq "vocal" || $rasgo eq "s" || $rasgo eq "r" || $rasgo eq "l") { | |
$impres= "γ"; } | |
else { | |
$impres= "g" } | |
} | |
elsif ($vsig eq "u"|| $vsig eq "ú") { | |
if ( $vsigg eq "e" || $vsigg eq "i" ) { | |
$n++; | |
if ($rasgo eq "vocal" || $rasgo eq "s" || $rasgo eq "r" || | |
$rasgo eq "l") { | |
$impres="γ" } | |
else { | |
$impres= "g"; } | |
} | |
else { | |
if ($rasgo eq "vocal"|| $rasgo eq "s" || $rasgo eq "r" || | |
$rasgo eq "l") { | |
$impres="γ" } | |
else { | |
$impres= "g"; } | |
} | |
} | |
elsif ($vsig eq "r"||$vsig eq "l") { | |
if ($rasgo eq "vocal"){ | |
$impres="γ"; | |
$rasgo eq "G";} | |
else { | |
$impres= "g"; | |
$rasgo eq "g";} | |
} | |
else { | |
$impres= "g"; } | |
$rasgo = "g"; | |
} | |
if ($c eq "h") { | |
} | |
if ($c eq "i") { | |
if ( ($rasgo eq "vocal") || ($vsig=~/[aeiouáéíó]/) ) { | |
unless ($vant=~/ /) { | |
$impres= "j"; | |
$rasgo = "vocal"; | |
$voc = "ï"; | |
} | |
} | |
else { | |
$impres= "i"; | |
$rasgo = "vocal"; | |
$voc = "i"; | |
} | |
if ($vant=~/ /) { | |
$impres= "i"; | |
$esp = 0; | |
} | |
} | |
if ($c eq "j") { | |
$impres= "x"; | |
$rasgo = x; | |
} | |
if ($c eq "k") { | |
$impres= "k"; | |
$rasgo = "k"; | |
} | |
if ($c eq "l") { | |
if ($vsig eq "l" && $vsigg ne "l" && $esps ne 1) { | |
if ($rasgo eq "vocal"){ | |
$impres= "λ"} | |
elsif ($rasgo ne "vocal"){ | |
$impres= "λ"} | |
$n++; | |
} | |
elsif ($vsig eq "l" && $vsigg ne "l" && $esps eq 1) { | |
$impres= "l l"; | |
$n = $n+2; | |
$esps = 0; | |
} | |
elsif ($vsig eq "l" && $vsigg eq "l" && $esps eq 1) { | |
$impres= "λ λ"; | |
$n = $n+3; | |
$esps = 0; | |
} | |
else { | |
$impres= "l"; | |
$rasgo = "l"; | |
$esp = 0; | |
} | |
$rasgo = "l"; | |
} | |
if ($c eq "m") { | |
if ($vsig eq "f") { | |
$impres= "M"; } | |
else { | |
$impres= "m"; | |
} | |
$rasgo = "m"; | |
} | |
if ($c eq "n") { | |
if ($vsig eq "t" || $vsig eq "d" || $vsig eq "z") | |
{ | |
$impres= "N"; } | |
elsif (($vsig eq "c" || $vsig eq "q") && ($vsigg eq "a" || $vsigg eq "o" || $vsigg eq "u")) { | |
$impres="ŋ"; } | |
elsif ($vsig eq "b"||$vsig eq "v"||$vsig eq "p" || $vsig eq "m"){ | |
$impres= "m"; } | |
elsif ($vsig eq "g" || $vsig eq "j"){ | |
$impres="ŋ";} | |
elsif ($vsig eq "f"){ | |
$impres= "M";} | |
elsif (($vsig eq "c") && ($vsigg eq "e" || $vsigg eq "i")) { | |
$impres= "N"; } | |
elsif ( (($vsig eq "y") && ($vsigg =~ /a|e|i|o|u/)) || ($vsig eq "l" && $vsigg eq "l") ) { | |
$impres= "ñ"; } | |
else { | |
$impres= "n"; | |
} | |
$rasgo = "n"; | |
} | |
if ($c eq "ñ") { | |
$impres= "ñ"; | |
$rasgo ="ñ"; | |
} | |
if ($c eq "o") { | |
$impres= "o"; | |
$rasgo = "vocal"; | |
$voc = "o"; | |
$esp = 0;} | |
if ($c eq "p") { | |
$impres= "p"; | |
$rasgo = "p"; | |
} | |
if ($c eq "q") { | |
$impres= "k"; | |
$n++; | |
$rasgo = "q"; | |
} | |
if ($c eq "r") { | |
if ($rasgo eq "t" || $rasgo eq "d" || $rasgo eq "p" || $rasgo eq "b" || $rasgo eq "k" || $rasgo eq "g" ||$rasgo eq "f") { | |
$impres="r"; | |
$rasgo = "r"; | |
} | |
elsif ($vsig eq "r") { | |
$rasgo = "r";} | |
elsif ($vsig ne "r" && $rasgo eq "r" && $esp ne 1) { | |
$impres="ř"; | |
$rasgo = "R"; | |
} | |
elsif ($rasgo eq "vocal" && $vsig ne "r" && $esp ne 1) { | |
$impres= "r"; | |
$rasgo = "r"; | |
} | |
elsif ($rasgo ne "vocal" && $esp eq 0) { | |
$impres= "ř"; | |
$rasgo = "r"; | |
} | |
elsif ($esp eq 1 && $rasgo ne "R") { | |
$impres= "ř"; | |
$rasgo = "R"; | |
} | |
elsif ($esp eq 1 && $rasgo eq "R") { | |
$impres= "r"; | |
$rasgo ="R"; | |
$esp= 0;} | |
else{ | |
$impres= "*"; | |
} | |
} | |
if ($c eq "s") { | |
if ($vsig eq "b" || $vsig eq "v"|| $vsig eq "d"|| ($vsig eq "g" && ($vsigg ne "e" && $vsigg ne "i"))||$vsig eq "l"|| $vsig eq "m" || $vsig eq "n") { | |
$impres= "z"; | |
$rasgo = "vocal";} | |
else { | |
$impres= "s"; | |
$rasgo = "s"; } | |
} | |
if ($c eq "t") { | |
$impres= "t"; | |
$rasgo = "t"; | |
} | |
if ($c eq "u") { | |
if ($rasgo eq "vocal" && $voc ne "ï") | |
{ | |
$impres= "w"; | |
$rasgo = "vocal"; | |
$voc = "w"; | |
} | |
elsif ($vsig=~/[aeouáéó]/) { | |
$impres= "w";} | |
else { | |
$impres= "u"; | |
$rasgo = "vocal"; | |
$voc = "u";} | |
$esp = 0; | |
} | |
if ($c eq "v") | |
{ | |
if ($rasgo eq "vocal" || $rasgo eq "l" || $rasgo eq "r") | |
{ | |
if ($vsig=~/[aeiouáéíóúrl]/) { | |
$impres="β"; | |
$rasgo ="B";} | |
else | |
{ | |
$impres= "b"; | |
} | |
} | |
else | |
{ | |
$impres= "b"; | |
} | |
$rasgo = "b"; | |
} | |
if ($c eq "w") { | |
$impres= "w"; | |
$rasgo = "w"; | |
} | |
if ($c eq "x") { | |
$impres= "ks"; | |
$rasgo = "x" } | |
if ($c eq "y") { | |
if ($vsig =~/[aeiouáéíóú]/ && $esps eq 0) { | |
$impres= "y"; | |
$rasgo= "vocal"; | |
$voc="ï"; | |
} | |
elsif ($rasgo eq "vocal" || $esps eq 1) { | |
if (($rasgo eq "vocal")) | |
{ | |
$impres= "i"; ##aproximante | |
$rasgo = "vocal"; | |
$voc = "ï"; | |
} | |
else { | |
$impres= "i"; | |
$rasgo = "vocal"; | |
$voc = "i"; | |
} | |
} | |
else { | |
$impres= "y"; | |
} | |
$esps = 0; | |
} | |
if ($c eq "z") { | |
$impres="θ"; | |
$rasgo = "Z"; } | |
if ($rasgo ne "vocal") | |
{ | |
$voc = 0; | |
} | |
$n++; | |
$transcripcion= $transcripcion.$impres; | |
} | |
return $transcripcion; | |
} | |
1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insolaras | |
insolases | |
insolara | |
insolase | |
insolen | |
insol%E9is | |
insolemos | |
insoles | |
insole | |
insolar%EDan | |
insolar%EDais | |
insolar%EDamos | |
insolar%EDas | |
insolar%EDa | |
insolar%E1n | |
insolar%E9is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment