├── voices └── pieroni │ └── samples │ ├── THLS_PTBR_1000_FRA_0014.wav │ ├── THLS_PTBR_1000_FRA_0245.wav │ ├── THLS_PTBR_1000_FRA_0314.wav │ ├── THLS_PTBR_1000_FRA_0352.wav │ ├── THLS_PTBR_1000_FRA_0606.wav │ ├── THLS_PTBR_1000_FRA_0639.wav │ ├── THLS_PTBR_1000_FRA_0642.wav │ ├── THLS_PTBR_1000_FRA_0761.wav │ ├── THLS_PTBR_1000_FRA_0774.wav │ └── THLS_PTBR_1000_FRA_0976.wav ├── dict ├── lexicon │ ├── README.md │ ├── setup.sh │ ├── compile_lexicon.sh │ ├── list2annotator.sh │ └── annotator2raw_lexicon.sh └── lts │ ├── reduizir_por_largura.sh │ └── lts.sh ├── vox_files ├── INST_pt_VOX_char_phone_map.scm ├── unicode_sampa_mapping.scm ├── all.desc ├── INST_pt_VOX_phoneset.scm └── INST_pt_VOX_lexicon.scm ├── LICENSE.txt ├── scripts ├── make_tts_utils.sh ├── make_pm_wave_reaper └── make_f0_model ├── original_files ├── unitsel.desc ├── make_pm_wave ├── INST_LANG_VOX_phoneset.scm ├── build_lts_rules ├── make_f0_model ├── build_lts └── INST_LANG_VOX_lexicon.scm └── README.md /voices/pieroni/samples/THLS_PTBR_1000_FRA_0014.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0014.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0245.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0245.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0314.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0314.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0352.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0352.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0606.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0606.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0639.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0639.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0642.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0642.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0761.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0761.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0774.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0774.wav -------------------------------------------------------------------------------- /voices/pieroni/samples/THLS_PTBR_1000_FRA_0976.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pallas1303/FestPB/HEAD/voices/pieroni/samples/THLS_PTBR_1000_FRA_0976.wav -------------------------------------------------------------------------------- /dict/lexicon/README.md: -------------------------------------------------------------------------------- 1 | # Fontes: 2 | 3 | ## Léxico lexicon.utf8.dic: 4 | https://gitlab.com/fb-nlp/nlp-resources/-/tree/master?ref_type=heads 5 | 6 | Contido na pasta ```res/lexicon.utf8.dic.tar.gz``` 7 | -------------------------------------------------------------------------------- /dict/lexicon/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Baixar dicionário fonético feito pelo Falabrasil. 4 | 5 | if [ -e lexicon.utf8.dict.gz ] 6 | then 7 | gzip -d lexicon.utf8.dict.gz 8 | else 9 | if [ ! -e lexicon.utf8.dict ] 10 | then 11 | wget https://gitlab.com/fb-nlp/nlp-resources/-/raw/master/res/lexicon.utf8.dict.gz?ref_type=heads&inline=false 12 | gzip -d lexicon.utf8.dic.gz 13 | fi 14 | fi 15 | 16 | echo "Deseja converter o dicionário do Falabrasil para um novo dicionário compatível com Festival Speech Synthesis?" 17 | echo "s para sim e n para não" 18 | read resposta 19 | 20 | if [ $resposta = "s" ] 21 | then 22 | bash annotator2raw_lexicon.sh lexicon.utf8.dict 23 | else 24 | exit 0 25 | fi 26 | -------------------------------------------------------------------------------- /vox_files/INST_pt_VOX_char_phone_map.scm: -------------------------------------------------------------------------------- 1 | ("a" u097p ) 2 | ("a~" u097p ) 3 | ("b" u098p ) 4 | ("d" u100p ) 5 | ("dZ" u100p ) 6 | ("e" u101p ) 7 | ("e~" u101p ) 8 | ("E" u069p ) 9 | ("f" u102p ) 10 | ("g" u103p ) 11 | ("i" u105p ) 12 | ("i~" u105p ) 13 | ("j" u106p ) 14 | ("j~" u106p ) 15 | ("J" u074p ) 16 | ("k" u107p ) 17 | ("l" u108p ) 18 | ("L" u076p ) 19 | ("m" u109p ) 20 | ("n" u110p ) 21 | ("o" u111p ) 22 | ("o~" u111p ) 23 | ("O" u079p ) 24 | ("p" u112p ) 25 | ("r" u114p ) 26 | ("R" u082p ) 27 | ("s" u115p ) 28 | ("S" u083p ) 29 | ("t" u116p ) 30 | ("tS" u116p ) 31 | ("u" u117p ) 32 | ("u~" u117p ) 33 | ("v" u118p ) 34 | ("w" u119p ) 35 | ("w~" u119p ) 36 | ("X" u088p ) 37 | ("z" u122p ) 38 | ("Z" u090p ) 39 | -------------------------------------------------------------------------------- /vox_files/unicode_sampa_mapping.scm: -------------------------------------------------------------------------------- 1 | ( set! unicode_sampa_mapping '( 2 | ( u097p (( a ))) 3 | ( u097p (( a~ ))) 4 | ( u098p (( b ))) 5 | ( u100p (( d ))) 6 | ( u100p (( dZ ))) 7 | ( u101p (( e ))) 8 | ( u101p (( e~ ))) 9 | ( u069p (( E ))) 10 | ( u102p (( f ))) 11 | ( u103p (( g ))) 12 | ( u105p (( i ))) 13 | ( u105p (( i~ ))) 14 | ( u106p (( j ))) 15 | ( u106p (( j~ ))) 16 | ( u074p (( J ))) 17 | ( u107p (( k ))) 18 | ( u108p (( l ))) 19 | ( u076p (( L ))) 20 | ( u109p (( m ))) 21 | ( u110p (( n ))) 22 | ( u111p (( o ))) 23 | ( u111p (( o~ ))) 24 | ( u079p (( O ))) 25 | ( u112p (( p ))) 26 | ( u114p (( r ))) 27 | ( u082p (( R ))) 28 | ( u115p (( s ))) 29 | ( u083p (( S ))) 30 | ( u116p (( t ))) 31 | ( u116p (( tS ))) 32 | ( u117p (( u ))) 33 | ( u117p (( u~ ))) 34 | ( u118p (( v ))) 35 | ( u119p (( w ))) 36 | ( u119p (( w~ ))) 37 | ( u088p (( X ))) 38 | ( u122p (( z ))) 39 | ( u090p (( Z ))) 40 | )) -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Pallas da Silva Guedes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /dict/lexicon/compile_lexicon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source $FESTPB/tts_utils/utils.source 4 | #Compila o dicionário fonético convertido, para ser usado no Festival Speech Synthesis. 5 | 6 | if [ $# = 0 ] 7 | then 8 | echo -e "Compilar dicionário convertido para ser usado no Festival Speech Synthesis.\nFaça compile_lexicon.sh help para receber ajuda." 9 | exit 1 10 | fi 11 | 12 | if [ $1 = help ] 13 | then 14 | echo -e "bash compile_lexicon.sh dicionário_convertido nome_do_dicionário_compilado.\nPara usar um dicionário gerando pelo annotator use annotator2raw_lexicon.sh" 15 | exit 1 16 | fi 17 | 18 | if [ -e $1 ] 19 | then 20 | FILE_INPUT=$1 21 | else 22 | echo "Por favor, informe a localização do dicionário convertido!" 23 | exit 1 24 | fi 25 | 26 | if [ ! $2 ] 27 | then 28 | FILE_OUTPUT=$FILE_INPUT.out 29 | echo "Seu dicionário compilado será salvo em: $FILE_OUTPUT" 30 | else 31 | FILE_OUTPUT=$2 32 | echo "Seu dicionário compilado será salvo em: $FILE_OUPUT" 33 | fi 34 | 35 | echo "Compilando $FILE_INPUT" 36 | echo " isso pode demorar algum tempo..." 37 | $ESTDIR/../festival/bin/festival -b '(lex.compile "'$FILE_INPUT'" "'$FILE_OUTPUT'")' 38 | 39 | if [ ! -e $FILE_OUPUT ] 40 | then 41 | echo "Ocorreu um erro inesperado, por favor verifique que $FILE_INPUT seja um dicionário aceito pelo Festival Speech Synthesis.\n Caso for um dicionário feito usado Annotator, use o script annotator2raw_lexicon" 42 | fi 43 | -------------------------------------------------------------------------------- /dict/lts/reduizir_por_largura.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Reduzir um dicionário convertido com base no tamanho das palavras. 4 | 5 | if [ $# = 0 ] 6 | then 7 | echo "Reduzir um dicionário fonético convertido com base no tamanho das palavras." 8 | echo "Use bash reduizir_por_largura.sh help para mais informações." 9 | exit 1 10 | fi 11 | 12 | if [ $1 = help ] 13 | then 14 | echo "bash reduizir_por_largura.sh nome_do_dicionário_convertido nome_do_dicionário_reduzindo largura" 15 | echo -e "Avisos: Por padrão, a largura é definida como 4, o padrão vai ser usado caso a largura não for definida ao comando.\n Esse processo irá ocorrer em um thread, no futuro coloacarei suporte a multithered." 16 | exit 1 17 | fi 18 | 19 | if [ -e $1 ] 20 | then 21 | FILE_INPUT=$1 22 | else 23 | echo "Por favor, informe a localização do ddicionário convertido" 24 | exit 1 25 | fi 26 | 27 | if [ ! $# = 2 ] 28 | then 29 | FILE_OUTPUT="reduzindo_$FILE_INPUT" 30 | echo "Seu dicionário será salvo em $FILE_OUTPUT" 31 | else 32 | FILE_OUTPUT=$2 33 | echo "Seu dicionário será salvo em $FILE_OUTPUT" 34 | fi 35 | 36 | re='[0-9]' 37 | if [ ! $# = 3 ] 38 | then 39 | LARGURA=4 40 | else 41 | if [[ ! $3 =~ $re ]] 42 | then 43 | LARGURA=4 44 | else 45 | LARGURA=$3 46 | fi 47 | fi 48 | 49 | 50 | for palavras in $(awk '{print $1}' < $FILE_INPUT | tr -d '"' | tr -d '('); do 51 | 52 | CH=$(echo $palavras | wc -m) 53 | 54 | if [ ! $CH -le $LARGURA ] 55 | then 56 | grep -w $palavras $FILE_INPUT >> $FILE_OUTPUT 57 | echo "Palavra: $palavras com largura de $CH será salva em $FILE_OUTPUT" 58 | fi 59 | done -------------------------------------------------------------------------------- /dict/lts/lts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Teinar modelo LTS (Letter to Sound) 4 | source $FESTPB/tts_utils/utils.source 5 | if [ $# = 0 ] 6 | then 7 | echo "Treinar um modelo LTS (Letter to Sound) a partir de um dicionário fonético convertindo." 8 | echo "Faça lts.sh help para saber mais." 9 | exit 1 10 | fi 11 | 12 | if [ $1 = help ] 13 | then 14 | echo "bash lts.sh nome_do_dicionário_convertido" 15 | echo -e "Avisos: O script criará uma pasta lts_+nome_do_dicionário_convertido com modelo LTS criado usado o dicionário fornecido.\nUsado esse script com uma pasta já existente, todo o conteúdo será substituído e reescrito.\nTenha cuidado ao usar esse script." 16 | exit 1 17 | fi 18 | 19 | if [ -e $1 ] 20 | then 21 | FILE_INPUT=$1 22 | else 23 | echo "Por favor, informe a localização do dicionário convertido!" 24 | exit 1 25 | fi 26 | 27 | LTS="lts_$FILE_INPUT" 28 | 29 | if [ -d $LTS ] 30 | then 31 | echo "Existe uma pasta com o mesmo nome do seu dicionário. Isso fará que o conteúdo dessa pasta seja substituído e reescrito." 32 | echo -e "Deseja continuar isso? [s para sim, n para não]\n" 33 | read -p resposta 34 | if [ ! $resposta = "n" ] 35 | then 36 | exit 1 37 | else 38 | echo "Limpando a pasta $LTS, para evitar erros no processo de treinamento..." 39 | rm $LTS -rf 40 | fi 41 | fi 42 | 43 | mkdir $LTS 44 | echo "Copiando $FILE_INPUT para $LTS, com fins de isolamento." 45 | cp $FILE_INPUT $LTS 46 | 47 | cd $LTS/ 48 | bash $FESTVOXDIR/src/lts/build_lts setup $FILE_INPUT utf8 49 | ./build_lts "make_allowables" 50 | ./build_lts 51 | 52 | cd ../ 53 | 54 | echo "Seu modelo LTS treinado a partir do dicionário $FILE_INPUT está em $LTS/lex_lts_rules.scm" 55 | 56 | -------------------------------------------------------------------------------- /dict/lexicon/list2annotator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Gerar um dicionário fonético a partir de uma lista de palavras usado o Annotator. Para ser usado em outros scripts. 4 | source $FESTPB/tts_utils/utils.source 5 | 6 | if [ $# = 0 ] 7 | then 8 | echo "Gerar dicionário fonético a partir de uma liata de palavras usado Annotator." 9 | echo "Use list2annotator.sh help para mais informações." 10 | exit 1 11 | fi 12 | 13 | if [ $1 = help ] 14 | then 15 | echo "bash list2annotator.sh lista_de_ppalavra nome_do_lexicon_de_saida numero_de_threads" 16 | echo -e "Avisos: O arquivo com a lista de palavras devem ser em codificação UTF-8.\nCaso houve um arquivo com mesmo nome do nome_do_lexicon_de_saida esse arquivo será reescrito.\nCaso o número for igual á 0 ou não informado, será processando como 1" 17 | exit 1 18 | fi 19 | 20 | if [ -e $1 ] 21 | then 22 | FILE_INPUT=$1 23 | else 24 | echo "Por favor, informe a localização da lista de palavras." 25 | exit 1 26 | fi 27 | 28 | if [ ! $2 ] 29 | then 30 | FILE_OUTPUT=$FILE_INPUT.dic 31 | echo "Seu dicionário será salvo em: $FILE_OUTPUT" 32 | else 33 | FILE_OUTPUT=$2 34 | echo "Seu dicionário será salvo em: $FILE_OUTPUT" 35 | fi 36 | 37 | re='[0-9]' 38 | NPROC=$(nproc) 39 | if [[ ! $3 =~ $re ]] 40 | then 41 | CPUS=1 42 | echo $3 $CPUS 43 | else 44 | if [[ ! $3 < $NPROC ]] 45 | then 46 | echo "Você definiu um número muito maior de threads. Defindo automáticamente para 1." 47 | CPUS=1 48 | else 49 | CPUS=$3 50 | fi 51 | fi 52 | 53 | echo "Gerando dicionário fonético usado Annotator. Caso o número de threads ser maior que 1, o processamento será feito em parallel" 54 | 55 | java -jar $G2P_PB -i $FILE_INPUT -o $FILE_OUTPUT -g -t $CPUS 56 | 57 | echo "Dicionário fonético em formato Annotator salvo em $FILE_OUPUT" 58 | 59 | -------------------------------------------------------------------------------- /scripts/make_tts_utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Fonte original: http://festvox.org/do_install 4 | 5 | chmod +x scripts/* 6 | mkdir tts_utils/ 7 | cd tts_utils/ 8 | 9 | # Ubuntu (and related) prerequisites: 10 | echo "Instalando os pacotes necessários para as ferramentas" 11 | sleep 2 12 | 13 | sudo apt-get install git build-essential libncurses5-dev sox cmake openjdk-8-jdk openjdk-8-jre 14 | sudo apt-get install csh doxygen xsltproc graphviz 15 | 16 | # Get source (unstable) 17 | echo "Baixado e compilado: Festival Speech Synthesis, Speech Tools, Festvox, Flite e SPTK" 18 | git clone https://github.com/festvox/speech_tools 19 | git clone https://github.com/festvox/festival 20 | git clone https://github.com/festvox/festvox 21 | git clone https://github.com/festvox/flite 22 | 23 | wgeth https://festvox.org/packed/SPTK-3.6.tar.gz 24 | tar zxvf SPTK-3.6.tar.gz 25 | 26 | export ESTDIR=`pwd`/speech_tools 27 | export FLITEDIR=`pwd`/flite 28 | export FESTVOXDIR=`pwd`/festvox 29 | export SPTKDIR=`pwd`/SPTK 30 | 31 | # Compile source 32 | mkdir SPTK 33 | patch -p0 > utils.source 87 | echo "FLITEDIR=$FLITEDIR" >> utils.source 88 | echo "FESTVOXDIR=$FESTVOXDIR" >> utils.source 89 | echo "SPTKDIR=$SPTKDIR" >> utils.source 90 | echo "REAPER=`pwd`/REAPER/build/reaper" >> utils.source 91 | echo "G2P_PB=`pwd`/annotator/fb_nlplib.jar" >> utils.source 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /dict/lexicon/annotator2raw_lexicon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Converter dicionário fonético gerado pelo Annotator em um formato compatível com Festival Speech Synthesis. Usado sed. 4 | 5 | #Caso nenhum parâmetro foi informado 6 | if [ $# = 0 ] 7 | then 8 | echo "Converter dicionário fonético gerado pelo annotator para o formato compatível compatível com Festival Speech Synthesis." 9 | exit 1 10 | fi 11 | 12 | #Mostra mensagem de ajuda, caso o primeiro parâmetro for "help" 13 | if [ $1 = help ] 14 | then 15 | echo "annotator2raw_lexicon.sh arquivo_gerado_pelo_annotator nome_do_novo_arquivo_em_formato_festival" 16 | echo "Caso a saida não for definida: arquivo_gerado_pelo_annotator.raw" 17 | exit 1 18 | fi 19 | 20 | #Se o arquivo informado pelo usuário existe define a variável FILE_INPUT. Se não, mostrar mensagem de erro. 21 | if [ -e $1 ] 22 | then 23 | FILE_INPUT=$1 24 | else 25 | echo "Por favor, informe a localização do dicionário gerado pelo Annotator!" 26 | exit 1 27 | fi 28 | 29 | #Se o arquivo de saída não for definido, defini a vivariável FILE_OUTPUT como FILE_INPUT+.raw. Caso for definido, definir a variável FILE_OUTPUT. Ambas os casos, mostrar como será salvo o dicionário convertindo. 30 | if [ ! $2 ] 31 | then 32 | FILE_OUTPUT=$FILE_INPUT.raw 33 | echo "Seu dicionário convertindo será salvo em: $FILE_OUTPUT" 34 | else 35 | FILE_OUTPUT=$2 36 | echo "Seu dicionário convertindo será salvo em: $FILE_OUTPUT" 37 | fi 38 | 39 | #Copia arquivo definido pela variável FILE_INPUT, em um arquivo temporário. Para ser usado para processo de conversão. 40 | cp $FILE_INPUT $FILE_OUTPUT.tmp 41 | 42 | #Usar for para fazer o loop, em casa palavras que esteja na primeira coluna. Usar awk para isso. 43 | for word in $(awk '{printf "\n"$1}' $FILE_INPUT); do 44 | 45 | #Variável com a expressão de substituição. 46 | #( "palavra" nil ( 47 | SED="( /$word/ nil (" 48 | 49 | #Usar sed para fazer o substituição, usar essa expressão para evitar que a substituição ocorra em outras palavras que contenham a palavra que vai ser substruida. 50 | #Exemplo: palavra é "a" 51 | # A -> ( "A" nil 52 | # aa -> ( "a" nil ( "a" nil ( = erro 53 | 54 | sed -e "/$word/{s|$word|$SED|;:a;N;ba}" -i $FILE_OUTPUT.tmp 55 | done 56 | 57 | #Após executar a primeira parte da conversão, completar os parênteses em cada final da linha. 58 | #Exemplo: 59 | #( "palavra" nil ( para ( "palavra" nil (aqui fica a transcrição fonética)) 60 | SED_1="))" 61 | sed -i "s|$|$SED_1|g" $FILE_OUTPUT.tmp 62 | 63 | #Usar tr para subtrair as barras / por aspas " duplas. Usou // eu não achei como usar sem que o código/comando quebre e salvando para um novo arquivo com o dicionário pronto em fonético compatível com Festival Speech Synthesis. 64 | 65 | tr '/' '"' < $FILE_OUTPUT.tmp > $FILE_OUTPUT 66 | #sed '$d' -i $FILE_OUTPUT 67 | #Apagando o arquivo temporário. 68 | rm $FILE_OUTPUT.tmp 69 | 70 | 71 | 72 | #Referências para fazer esse script: 73 | 74 | #https://pt.stackoverflow.com/questions/158102/utilizando-vari%C3%A1vel-com-o-comando-sed 75 | 76 | #https://shell-script.yahoogrupos.com.narkive.com/SZ7Fh1rM/sed-troca-apenas-da-primeira-ocorrencia 77 | -------------------------------------------------------------------------------- /original_files/unitsel.desc: -------------------------------------------------------------------------------- 1 | ( 2 | ( occurid cluster ) 3 | ( p.name 4 | 0 "aa" "ae" "ah" "ao" "aw" "ax" "axr" "ay" "b" "brth" "ch" "d" "dh" 5 | "dx" "eh" "el" "em" "en" "er" "ey" "f" "g" "h#" "hh" "hv" "ih" "iy" 6 | "jh" "k" "l" "m" "n" "ng" "nx" "ow" "oy" "p" "pau" "r" "s" "sh" "t" 7 | "th" "uh" "uw" "v" "w" "y" "z" "zh" 8 | ) 9 | ( p.ph_vc 10 | + 11 | - 12 | 0 13 | ) 14 | ( p.ph_ctype 15 | 0 16 | a 17 | f 18 | l 19 | n 20 | r 21 | s 22 | ) 23 | ( p.ph_vheight 24 | 0 25 | 1 26 | 2 27 | 3 28 | ) 29 | ( p.ph_vlng 30 | 0 31 | a 32 | d 33 | l 34 | s 35 | ) 36 | ( p.ph_vfront 37 | 0 38 | 1 39 | 2 40 | 3 41 | ) 42 | ( p.ph_vrnd 43 | + 44 | - 45 | 0 46 | ) 47 | ( p.ph_cplace 48 | 0 49 | a 50 | b 51 | d 52 | g 53 | l 54 | p 55 | v 56 | ) 57 | ( p.ph_cvox 58 | + 59 | - 60 | 0 61 | ) 62 | ( n.name ignore 63 | 0 "aa" "ae" "ah" "ao" "aw" "ax" "axr" "ay" "b" "brth" "ch" "d" "dh" 64 | "dx" "eh" "el" "em" "en" "er" "ey" "f" "g" "h#" "hh" "hv" "ih" "iy" 65 | "jh" "k" "l" "m" "n" "ng" "nx" "ow" "oy" "p" "pau" "r" "s" "sh" "t" 66 | "th" "uh" "uw" "v" "w" "y" "z" "zh" 67 | ) 68 | ( n.ph_vc 69 | + 70 | - 71 | 0 72 | ) 73 | ( n.ph_ctype 74 | 0 75 | a 76 | f 77 | l 78 | n 79 | r 80 | s 81 | ) 82 | ( n.ph_vheight 83 | 0 84 | 1 85 | 2 86 | 3 87 | ) 88 | ( n.ph_vlng 89 | 0 90 | a 91 | d 92 | l 93 | s 94 | ) 95 | ( n.ph_vfront 96 | 0 97 | 1 98 | 2 99 | 3 100 | ) 101 | ( n.ph_vrnd 102 | + 103 | - 104 | 0 105 | ) 106 | ( n.ph_cplace 107 | 0 108 | a 109 | b 110 | d 111 | g 112 | l 113 | p 114 | v 115 | ) 116 | ( n.ph_cvox 117 | + 118 | - 119 | 0 120 | ) 121 | ( segment_duration ignore float) 122 | ( seg_pitch ignore float ) 123 | ( p.seg_pitch ignore float ) 124 | ( n.seg_pitch ignore float ) 125 | ( R:SylStructure.parent.stress 126 | 0 127 | 1 128 | ) 129 | ( seg_onsetcoda 130 | coda 131 | onset 132 | ) 133 | ( n.seg_onsetcoda 134 | 0 135 | coda 136 | onset 137 | ) 138 | ( p.seg_onsetcoda 139 | 0 140 | coda 141 | onset 142 | ) 143 | ( R:SylStructure.parent.accented 144 | 0 145 | 1 146 | ) 147 | ( pos_in_syl 148 | 0 149 | 1 150 | 2 151 | 3 152 | 4 153 | 5 154 | 6 155 | 7 156 | 8 157 | ) 158 | ( syl_initial 159 | 0 160 | 1 161 | ) 162 | ( syl_final 163 | 0 164 | 1 165 | ) 166 | ( R:SylStructure.parent.lisp_cg_break 167 | 0 168 | 1 169 | 2 170 | 3 171 | 4 172 | ) 173 | ( R:SylStructure.parent.R:Syllable.p.lisp_cg_break 174 | 0 175 | 1 176 | 2 177 | 3 178 | 4 179 | ) 180 | ( R:SylStructure.parent.position_type 181 | 0 182 | initial 183 | single 184 | final 185 | mid 186 | ) 187 | ( pp.name ignore 188 | 0 "aa" "ae" "ah" "ao" "aw" "ax" "axr" "ay" "b" "brth" "ch" "d" "dh" 189 | "dx" "eh" "el" "em" "en" "er" "ey" "f" "g" "h#" "hh" "hv" "ih" "iy" 190 | "jh" "k" "l" "m" "n" "ng" "nx" "ow" "oy" "p" "pau" "r" "s" "sh" "t" 191 | "th" "uh" "uw" "v" "w" "y" "z" "zh" 192 | ) 193 | ( pp.ph_vc ignore 194 | + 195 | - 196 | 0 197 | ) 198 | ( pp.ph_ctype ignore 199 | 0 200 | a 201 | f 202 | l 203 | n 204 | r 205 | s 206 | ) 207 | ( pp.ph_vheight ignore 208 | 0 209 | 1 210 | 2 211 | 3 212 | ) 213 | ( pp.ph_vlng ignore 214 | 0 215 | a 216 | d 217 | l 218 | s 219 | ) 220 | ( pp.ph_vfront ignore 221 | 0 222 | 1 223 | 2 224 | 3 225 | ) 226 | ( pp.ph_vrnd ignore 227 | + 228 | - 229 | 0 230 | ) 231 | ( pp.ph_cplace ignore 232 | 0 233 | a 234 | b 235 | d 236 | g 237 | l 238 | p 239 | v 240 | ) 241 | ( pp.ph_cvox ignore 242 | + 243 | - 244 | 0 245 | ) 246 | ( n.lisp_is_pau 0 1) 247 | ( p.lisp_is_pau 0 1) 248 | ( R:SylStructure.parent.parent.gpos 249 | 0 250 | aux 251 | cc 252 | content 253 | det 254 | in 255 | md 256 | pps 257 | to 258 | wp 259 | punc 260 | ) 261 | ( R:SylStructure.parent.parent.R:Word.p.gpos 262 | 0 263 | aux 264 | cc 265 | content 266 | det 267 | in 268 | md 269 | pps 270 | to 271 | wp 272 | punc 273 | ) 274 | ( R:SylStructure.parent.parent.R:Word.n.gpos 275 | 0 276 | aux 277 | cc 278 | content 279 | det 280 | in 281 | md 282 | pps 283 | to 284 | wp 285 | punc 286 | ) 287 | ) 288 | -------------------------------------------------------------------------------- /original_files/make_pm_wave: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## Carnegie Mellon University and ## 5 | ## Alan W Black and Kevin A. Lenzo ## 6 | ## Copyright (c) 1998-2000 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ### ## 35 | ### Generate (filled) pitchmark file from waveform files ## 36 | ### ## 37 | ############################################################################ 38 | 39 | LANG=C; export LANG 40 | 41 | if [ $# = 0 ] 42 | then 43 | echo "Make pm files from waveforms" 44 | echo "Usage: bin/make_pm_wave wav/*.wav" 45 | echo "This will require editing of parameters to get a good result" 46 | exit 1 47 | fi 48 | 49 | if [ ! "$ESTDIR" ] 50 | then 51 | echo "environment variable ESTDIR is unset" 52 | echo "set it to your local speech tools directory e.g." 53 | echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 54 | echo or 55 | echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 56 | exit 1 57 | fi 58 | 59 | FEMALE_ARGS='-min 0.00333 -max 0.0075 -def 0.006 -wave_end -lx_lf 220 -lx_lo 121 -lx_hf 80 -lx_ho 51 -med_o 0' 60 | 61 | PM_ARGS='-min 0.0057 -max 0.012 -def 0.01 -wave_end -lx_lf 140 -lx_lo 111 -lx_hf 80 -lx_ho 51 -med_o 0' 62 | 63 | PROMPTFILE=etc/txt.done.data 64 | if [ $# = 1 ] 65 | then 66 | PROMPTFILE=$1 67 | fi 68 | 69 | awk '{print $2}' $PROMPTFILE | 70 | while read i 71 | do 72 | fname=$i 73 | echo $i PM_WAVE 74 | $ESTDIR/bin/ch_wave -scaleN 0.9 wav/$i.wav -F 16000 -o tmp$$.wav 75 | # You may (or may not) require -inv and many of the parameters here 76 | # may be worth modifying, see the section on Extracting pitchmarks from 77 | # waveforms in the document 78 | $ESTDIR/bin/pitchmark tmp$$.wav -o pm/$fname.pm -otype est $PM_ARGS -fill 79 | rm -f tmp$$.wav 80 | done 81 | 82 | -------------------------------------------------------------------------------- /original_files/INST_LANG_VOX_phoneset.scm: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;; ;;; 3 | ;;; Carnegie Mellon University ;;; 4 | ;;; and Alan W Black and Kevin Lenzo ;;; 5 | ;;; Copyright (c) 1998-2000 ;;; 6 | ;;; All Rights Reserved. ;;; 7 | ;;; ;;; 8 | ;;; Permission is hereby granted, free of charge, to use and distribute ;;; 9 | ;;; this software and its documentation without restriction, including ;;; 10 | ;;; without limitation the rights to use, copy, modify, merge, publish, ;;; 11 | ;;; distribute, sublicense, and/or sell copies of this work, and to ;;; 12 | ;;; permit persons to whom this work is furnished to do so, subject to ;;; 13 | ;;; the following conditions: ;;; 14 | ;;; 1. The code must retain the above copyright notice, this list of ;;; 15 | ;;; conditions and the following disclaimer. ;;; 16 | ;;; 2. Any modifications must be clearly marked as such. ;;; 17 | ;;; 3. Original authors' names are not deleted. ;;; 18 | ;;; 4. The authors' names are not used to endorse or promote products ;;; 19 | ;;; derived from this software without specific prior written ;;; 20 | ;;; permission. ;;; 21 | ;;; ;;; 22 | ;;; CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ;;; 23 | ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;; 24 | ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;; 25 | ;;; SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ;;; 26 | ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;; 27 | ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;; 28 | ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;; 29 | ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;; 30 | ;;; THIS SOFTWARE. ;;; 31 | ;;; ;;; 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 | ;;; 34 | ;;; Phonset for INST_LANG 35 | ;;; 36 | 37 | ;;; Feeel free to add new feature values, or new features to this 38 | ;;; list to make it more appropriate to your language 39 | 40 | ;; This is where it'll fall over if you haven't defined a 41 | ;; a phoneset yet, if you have, delete this, if you haven't 42 | ;; define one then delete this error message 43 | (error "You have not yet defined a phoneset for LANG (and others things ?)\n Define it in festvox/INST_LANG_VOX_phoneset.scm\n") 44 | 45 | (defPhoneSet 46 | INST_LANG 47 | ;;; Phone Features 48 | (;; vowel or consonant 49 | (clst + - 0) 50 | (vc + - 0) 51 | ;; vowel length: short long dipthong schwa 52 | (vlng s l d a 0) 53 | ;; vowel height: high mid low 54 | (vheight 1 2 3 0 -) 55 | ;; vowel frontness: front mid back 56 | (vfront 1 2 3 0 -) 57 | ;; lip rounding 58 | (vrnd + - 0) 59 | ;; consonant type: stop fricative affricative nasal liquid approximant 60 | (ctype s f a n l r 0) 61 | ;; place of articulation: labial alveolar palatal 62 | ;; labio-dental dental velar glottal 63 | (cplace l a p b d v g 0) 64 | ;; consonant voicing 65 | (cvox + - 0) 66 | (asp + - 0) 67 | (nuk + - 0) 68 | ) 69 | ( 70 | ( pau - - 0 0 0 0 0 0 - - - ) 71 | 72 | ;; insert the phones here, see examples in 73 | ;; festival/lib/*_phones.scm 74 | 75 | ) 76 | ) 77 | 78 | (PhoneSet.silences '(pau)) 79 | 80 | (define (INST_LANG_VOX::select_phoneset) 81 | "(INST_LANG_VOX::select_phoneset) 82 | Set up phone set for INST_LANG." 83 | (Parameter.set 'PhoneSet 'INST_LANG) 84 | (PhoneSet.select 'INST_LANG) 85 | ) 86 | 87 | (define (INST_LANG_VOX::reset_phoneset) 88 | "(INST_LANG_VOX::reset_phoneset) 89 | Reset phone set for INST_LANG." 90 | t 91 | ) 92 | 93 | (provide 'INST_LANG_VOX_phoneset) 94 | -------------------------------------------------------------------------------- /original_files/build_lts_rules: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## ## 5 | ## Language Technologies Institute ## 6 | ## Carnegie Mellon University ## 7 | ## Copyright (c) 1998-2004 ## 8 | ## All Rights Reserved. ## 9 | ## ## 10 | ## Permission is hereby granted, free of charge, to use and distribute ## 11 | ## this software and its documentation without restriction, including ## 12 | ## without limitation the rights to use, copy, modify, merge, publish, ## 13 | ## distribute, sublicense, and/or sell copies of this work, and to ## 14 | ## permit persons to whom this work is furnished to do so, subject to ## 15 | ## the following conditions: ## 16 | ## 1. The code must retain the above copyright notice, this list of ## 17 | ## conditions and the following disclaimer. ## 18 | ## 2. Any modifications must be clearly marked as such. ## 19 | ## 3. Original authors' names are not deleted. ## 20 | ## 4. The authors' names are not used to endorse or promote products ## 21 | ## derived from this software without specific prior written ## 22 | ## permission. ## 23 | ## ## 24 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 25 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 26 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 27 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 28 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 29 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 30 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 31 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 32 | ## THIS SOFTWARE. ## 33 | ## ## 34 | ########################################################################### 35 | 36 | 37 | LANG=C 38 | echo "((Relation.LTS.down.name" >ltsLTS.desc 39 | awk '{print $1}' lex.feats | sort -u >> ltsLTS.desc 40 | echo ') (p.p.p.p.name ignore ' >>ltsLTS.desc 41 | awk '{print $2}' lex.feats | sort -u >> ltsLTS.desc 42 | echo ') (p.p.p.name ' >>ltsLTS.desc 43 | awk '{print $3}' lex.feats | sort -u >> ltsLTS.desc 44 | echo ') (p.p.name ' >>ltsLTS.desc 45 | awk '{print $4}' lex.feats | sort -u >> ltsLTS.desc 46 | echo ') (p.name ' >>ltsLTS.desc 47 | awk '{print $5}' lex.feats | sort -u >> ltsLTS.desc 48 | echo ') (name ' >>ltsLTS.desc 49 | awk '{print $6}' lex.feats | sort -u >> ltsLTS.desc 50 | echo ') (n.name ' >>ltsLTS.desc 51 | awk '{print $7}' lex.feats | sort -u >> ltsLTS.desc 52 | echo ') (n.n.name ' >>ltsLTS.desc 53 | awk '{print $8}' lex.feats | sort -u >> ltsLTS.desc 54 | echo ') (n.n.n.name ' >>ltsLTS.desc 55 | awk '{print $9}' lex.feats | sort -u >> ltsLTS.desc 56 | echo ') (n.n.n.n.name ignore' >>ltsLTS.desc 57 | awk '{print $10}' lex.feats | sort -u >> ltsLTS.desc 58 | echo ') (pos ignore' >>ltsLTS.desc 59 | awk 'BEGIN {print "n"} {print $11}' lex.feats | sort -u >> ltsLTS.desc 60 | echo '))' >>ltsLTS.desc 61 | 62 | for i in `awk '{print $6}' lex.feats | sort -u` 63 | do 64 | # Stop value for wagon 65 | STOP=3 66 | 67 | # Find training set for letter $i 68 | if [ -f lex.feats.train ] 69 | then 70 | echo letter $i STOP $STOP TRAIN SET 71 | cat lex.feats.train | 72 | awk '{if ($6 == "'$i'") print $0}' >ltsdataTRAIN.$i.feats 73 | else 74 | echo letter $i STOP $STOP ALL 75 | cat lex.feats | 76 | awk '{if ($6 == "'$i'") print $0}' >ltsdataTRAIN.$i.feats 77 | fi 78 | 79 | $ESTDIR/bin/wagon -data ltsdataTRAIN.$i.feats -test ltsdataTRAIN.$i.feats \ 80 | -desc ltsLTS.desc -stop $STOP -output lts.$i.tree 81 | 82 | done 83 | -------------------------------------------------------------------------------- /scripts/make_pm_wave_reaper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## Carnegie Mellon University and ## 5 | ## Alan W Black and Kevin A. Lenzo ## 6 | ## Copyright (c) 1998-2000 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ### ## 35 | ### Generate (filled) pitchmark file from waveform files using REAPER ## 36 | ### ## 37 | ############################################################################ 38 | source $FESTPB/tts_utils/utils.source 39 | #LANG=C; export LANG 40 | 41 | if [ $# = 0 ] 42 | then 43 | echo "Make pm files from waveforms using RREAPER" 44 | echo "Usage: bin/make_pm_wave_reaper wav/*.wav" 45 | echo "This will require editing of parameters to get a good result" 46 | exit 1 47 | fi 48 | 49 | if [ ! "$ESTDIR" ] 50 | then 51 | echo "environment variable ESTDIR is unset" 52 | echo "set it to your local speech tools directory e.g." 53 | echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 54 | echo or 55 | echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 56 | exit 1 57 | fi 58 | 59 | #FEMALE_ARGS='-min 0.00333 -max 0.0075 -def 0.006 -wave_end -lx_lf 220 -lx_lo 121 -lx_hf 80 -lx_ho 51 -med_o 0' 60 | 61 | #PM_ARGS='-min 0.0033 -max 0.012 -def 0.01 -wave_end -lx_lf 35 -lx_lo 35 -lx_hf 80 -lx_ho 51 -med_o 0' 62 | 63 | PROMPTFILE=etc/txt.done.data 64 | if [ $# = 1 ] 65 | then 66 | PROMPTFILE=$1 67 | fi 68 | 69 | awk '{print $2}' $PROMPTFILE | 70 | while read i 71 | do 72 | fname=$i 73 | echo $i PM_WAVE_REAPER 74 | # $ESTDIR/bin/ch_wave -scaleN 0.9 wav/$i.wav -F 16000 -o tmp$$.wav 75 | # You may (or may not) require -inv and many of the parameters here 76 | # may be worth modifying, see the section on Extracting pitchmarks from 77 | # waveforms in the document 78 | # $ESTDIR/bin/pitchmark tmp$$.wav -o pm/$fname.pm -otype est $PM_ARGS -fill 79 | $REAPER -i wav/$fname.wav -p pm/$fname.pm -a 80 | done 81 | cp pm pm_old -r 82 | 83 | 84 | for i in $(awk '{printf $2}' $PROMPTFILE); do 85 | fname=$i 86 | echo $i PM_WAVE_REAPER 87 | cut -f3 -d" " --complement < pm_old/$i > pm/$fname 88 | done 89 | -------------------------------------------------------------------------------- /vox_files/all.desc: -------------------------------------------------------------------------------- 1 | 2 | ( 3 | ( occurid cluster ) 4 | ( p.name 5 | 0 "a" "a~" "b" "d" "dZ" "e" "e~" "E" "f" "g" "i" "i~" "j" "j~" "J" "k" "l" "L" "m" "n" "o" "o~" "O" "p" "r" "R" "s" "S" "t" "tS" "u" "u~" "v" "w" "w~" "X" "z" "Z" "pau" 6 | ) 7 | ( p.ph_vc 8 | + 9 | - 10 | 0 11 | ) 12 | ( p.ph_ctype 13 | 0 14 | a 15 | f 16 | l 17 | n 18 | r 19 | s 20 | ) 21 | ( p.ph_vheight 22 | - 23 | 0 24 | 1 25 | 2 26 | 3 27 | ) 28 | ( p.ph_vlng 29 | - 30 | 0 31 | a 32 | d 33 | l 34 | s 35 | ) 36 | ( p.ph_vfront 37 | - 38 | 0 39 | 1 40 | 2 41 | 3 42 | ) 43 | ( p.ph_vrnd 44 | + 45 | - 46 | 0 47 | ) 48 | ( p.ph_cplace 49 | 0 50 | a 51 | b 52 | d 53 | g 54 | l 55 | p 56 | v 57 | ) 58 | ( p.ph_cvox 59 | + 60 | - 61 | 0 62 | ) 63 | ( n.name 64 | - 0 "a" "a~" "b" "d" "dZ" "e" "e~" "E" "f" "g" "i" "i~" "j" "j~" "J" "k" "l" "L" "m" "n" "o" "o~" "O" "p" "r" "R" "s" "S" "t" "tS" "u" "u~" "v" "w" "w~" "X" "z" "Z" "pau" 65 | ) 66 | ( n.ph_vc 67 | + 68 | - 69 | 0 70 | ) 71 | ( n.ph_ctype 72 | 0 73 | a 74 | f 75 | l 76 | n 77 | r 78 | s 79 | ) 80 | ( n.ph_vheight 81 | - 82 | 0 83 | 1 84 | 2 85 | 3 86 | ) 87 | ( n.ph_vlng 88 | - 89 | 0 90 | a 91 | d 92 | l 93 | s 94 | ) 95 | ( n.ph_vfront 96 | - 97 | 0 98 | 1 99 | 2 100 | 3 101 | ) 102 | ( n.ph_vrnd 103 | + 104 | - 105 | 0 106 | ) 107 | ( n.ph_cplace 108 | 0 109 | a 110 | b 111 | d 112 | g 113 | l 114 | p 115 | v 116 | ) 117 | ( n.ph_cvox 118 | + 119 | - 120 | 0 121 | ) 122 | ( segment_duration float ) 123 | ( seg_pitch float ) 124 | ( p.seg_pitch float ) 125 | ( n.seg_pitch float ) 126 | ( R:SylStructure.parent.stress float 127 | 0 128 | 1 129 | 2 130 | 3 131 | 4 132 | 5 133 | 6 134 | 7 135 | 8 136 | 9 137 | 10 138 | 11 139 | 12 140 | 13 141 | 14 142 | 15 143 | 16 144 | 17 145 | 18 146 | 19 147 | 20 148 | ) 149 | ( seg_onsetcoda float 150 | 0 151 | 1 152 | 2 153 | 3 154 | 4 155 | 5 156 | 6 157 | 7 158 | 8 159 | 9 160 | 10 161 | 11 162 | 12 163 | 13 164 | 14 165 | 15 166 | 16 167 | 17 168 | 18 169 | 19 170 | 20 171 | coda 172 | onset 173 | seg_onsetcoda 174 | ) 175 | ( n.seg_onsetcoda float 176 | 0 177 | 1 178 | 2 179 | 3 180 | 4 181 | 5 182 | 6 183 | 7 184 | 8 185 | 9 186 | 10 187 | 11 188 | 12 189 | 13 190 | 14 191 | 15 192 | 16 193 | 17 194 | 18 195 | 19 196 | 20 197 | coda 198 | onset 199 | seg_onsetcoda 200 | ) 201 | ( p.seg_onsetcoda float 202 | coda 203 | onset 204 | seg_onsetcoda 205 | 0 206 | 1 207 | 2 208 | 3 209 | 4 210 | 5 211 | 6 212 | 7 213 | 8 214 | 9 215 | 10 216 | 11 217 | 12 218 | 13 219 | 14 220 | 15 221 | 16 222 | 17 223 | 18 224 | 19 225 | 20 226 | ) 227 | ( R:SylStructure.parent.accented float 228 | 0 229 | 1 230 | 2 231 | 3 232 | 4 233 | 5 234 | 6 235 | 7 236 | 8 237 | 9 238 | 10 239 | 11 240 | 12 241 | 13 242 | 14 243 | 15 244 | 16 245 | 17 246 | 18 247 | 19 248 | 20 249 | ) 250 | ( pos_in_syl float 251 | 0 252 | 1 253 | 2 254 | 3 255 | 4 256 | 5 257 | 6 258 | 7 259 | 8 260 | 9 261 | 10 262 | 11 263 | 12 264 | 13 265 | 14 266 | 15 267 | 16 268 | 17 269 | 20 270 | ) 271 | ( syl_initial float 272 | 0 273 | 1 274 | 2 275 | 3 276 | 4 277 | 5 278 | 6 279 | 7 280 | 8 281 | 9 282 | 10 283 | 11 284 | 12 285 | 13 286 | 14 287 | 15 288 | 16 289 | 17 290 | 18 291 | 19 292 | 20 293 | ) 294 | ( syl_final float 295 | 0 296 | 1 297 | 2 298 | 3 299 | 4 300 | 5 301 | 6 302 | 7 303 | 8 304 | 9 305 | 10 306 | 11 307 | 12 308 | 13 309 | 14 310 | 15 311 | 16 312 | 17 313 | 18 314 | 19 315 | 20 316 | ) 317 | ( R:SylStructure.parent.syl_break float 318 | 0 319 | 1 320 | 3 321 | 4 322 | 5 323 | 6 324 | 7 325 | 8 326 | 9 327 | 10 328 | 11 329 | 12 330 | 13 331 | 14 332 | 15 333 | 16 334 | 17 335 | 18 336 | 19 337 | 20 338 | ) 339 | ( R:SylStructure.parent.R:Syllable.p.syl_break float 340 | 0 341 | 1 342 | 3 343 | 4 344 | 5 345 | 6 346 | 7 347 | 8 348 | 9 349 | 10 350 | 11 351 | 12 352 | 13 353 | 14 354 | 15 355 | 16 356 | 17 357 | 18 358 | 19 359 | 20 360 | ) 361 | ( pp.name 362 | 0 "a" "a~" "b" "d" "dZ" "e" "e~" "E" "f" "g" "i" "i~" "j" "j~" "J" "k" "l" "L" "m" "n" "o" "o~" "O" "p" "r" "R" "s" "S" "t" "tS" "u" "u~" "v" "w" "w~" "X" "z" "Z" "pau" 363 | ) 364 | ( pp.ph_vc 365 | + 366 | - 367 | 0 368 | ) 369 | ( pp.ph_ctype 370 | - 371 | 0 372 | a 373 | f 374 | l 375 | n 376 | r 377 | s 378 | ) 379 | ( pp.ph_vheight 380 | - 381 | 0 382 | 1 383 | 2 384 | 3 385 | ) 386 | ( pp.ph_vlng 387 | - 388 | 0 389 | a 390 | d 391 | l 392 | s 393 | ) 394 | ( pp.ph_vfront 395 | - 396 | 0 397 | 1 398 | 2 399 | 3 400 | ) 401 | ( pp.ph_vrnd 402 | + 403 | - 404 | 0 405 | ) 406 | ( pp.ph_cplace 407 | 0 408 | a 409 | b 410 | d 411 | g 412 | l 413 | p 414 | v 415 | ) 416 | ( pp.ph_cvox 417 | + 418 | - 419 | 0 420 | ) 421 | ( R:SylStructure.parent.parent.R:Word.word_out float 422 | 0 423 | 1 424 | 2 425 | 3 426 | 4 427 | 5 428 | 6 429 | 7 430 | 8 431 | 9 432 | 10 433 | 11 434 | 12 435 | 13 436 | 14 437 | 15 438 | 16 439 | 17 440 | 18 441 | 19 442 | 20 443 | ) 444 | ( R:SylStructure.parent.syl_in 0 float 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100) 445 | ( R:SylStructure.parent.syl_out 0 float 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100) 446 | ( R:SylStructure.parent.parent.phr_pos content tag001 tag002 tag003 tag004 tag005 tag006 tag007 tag008 tag009 tag010 tag011 tag012 tag013 0 nil) 447 | ) 448 | -------------------------------------------------------------------------------- /vox_files/INST_pt_VOX_phoneset.scm: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;; ;;; 3 | ;;; Carnegie Mellon University ;;; and Alan W 4 | ;;; Black and Kevin Lenzo ;;; 5 | ;;; Copyright (c) 1998-2000 ;;; 6 | ;;; All Rights Reserved. ;;; 7 | ;;; ;;; 8 | ;;; Permission is hereby granted, free of charge, to use and distribute ;;; 9 | ;;; this software and its documentation without restriction, including ;;; 10 | ;;; without limitation the rights to use, copy, modify, merge, publish, ;;; 11 | ;;; distribute, sublicense, and/or sell copies of this work, and to ;;; 12 | ;;; permit persons to whom this work is furnished to do so, subject to ;;; 13 | ;;; the following conditions: ;;; 14 | ;;; 1. The code must retain the above copyright notice, this list of ;;; 15 | ;;; conditions and the following disclaimer. ;;; 16 | ;;; 2. Any modifications must be clearly marked as such. ;;; 17 | ;;; 3. Original authors' names are not deleted. ;;; 18 | ;;; 4. The authors' names are not used to endorse or promote products ;;; 19 | ;;; derived from this software without specific prior written ;;; 20 | ;;; permission. ;;; 21 | ;;; ;;; 22 | ;;; CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ;;; 23 | ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;; 24 | ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;; 25 | ;;; SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ;;; 26 | ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;; 27 | ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;; 28 | ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;; 29 | ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;; 30 | ;;; THIS SOFTWARE. ;;; 31 | ;;; ;;; 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 | ;;; 34 | ;;; Phonset for INST_pt 35 | ;;; 36 | 37 | ;;; Feeel free to add new feature values, or new features to this 38 | ;;; list to make it more appropriate to your ptuage 39 | 40 | ;; This is where it'll fall over if you haven't defined a 41 | ;; a phoneset yet, if you have, delete this, if you haven't 42 | ;; define one then delete this error message 43 | ;(error "You have not yet defined a phoneset for pt (and others things ?)\n Define it in festvox/INST_pt_VOX_phoneset.scm\n") 44 | 45 | (defPhoneSet 46 | INST_pt 47 | ( ;;; Phone Features 48 | (vc + - 0) 49 | (clst + - 0) ;;Usar ambos 0 para semivogal 50 | 51 | ;; vowel length: short long dipthong schwa (Comprimento de vogal: Curta, Longa, Ditongo, Schwa) 52 | ;; O som de Schwa não há na língua portuguesa brasileira 53 | (vlng s l d a - 0) 54 | 55 | ;; vowel height: high mid low (Altura de Vogal: Alta, Média, baixa) 56 | (vheight 1 2 3 0 -) 57 | 58 | ;; vowel frontness: front mid back 59 | (vfront 1 2 3 0 -) 60 | ;; lip rounding 61 | (vrnd + - 0) 62 | ;; consonant type: stop fricative affricative nasal liquid approximant 63 | (ctype s f a n l r 0) 64 | ;; place of articulation: labial alveolar palatal 65 | ;; labio-dental dental velar glottal 66 | (cplace l a p b d v g 0) 67 | ;; consonant voicing 68 | (cvox + - 0) 69 | ; (asp + - 0) 70 | ; (nuk + - 0) 71 | ) 72 | 73 | ( 74 | 75 | (pau - - 0 0 0 0 0 0 0) 76 | ;;Vogais Orais 77 | (a + - - 3 2 - 0 0 0) 78 | (o + - - 2 3 + 0 0 0) 79 | (O + - - 2 3 + 0 0 0) 80 | (u + - - 1 3 + 0 0 0) 81 | (e + - - 2 1 - 0 0 0) 82 | (E + - - 2 1 - 0 0 0) 83 | (i + - - 1 1 - 0 0 0) 84 | 85 | ;; Vogais nasais 86 | (a~ + - - 3 2 - 0 0 0) 87 | (e~ + - - 2 1 - 0 0 0) 88 | (i~ + - - 1 1 - 0 0 0) 89 | (o~ + - - 2 3 + 0 0 0) 90 | (u~ + - - 1 3 + 0 0 0) 91 | 92 | ;; Semivogais 93 | (w 0 0 - - 0 0 0 0 0) 94 | (j 0 0 - - 0 0 0 0 0) 95 | (w~ 0 0 - - 0 0 0 0 0) 96 | (j~ 0 0 - - 0 0 0 0 0) 97 | 98 | ;;Consoantes 99 | 100 | (p - + 0 - - - s 0 -) 101 | (R - + 0 - - - l 0 +) 102 | (b - + 0 - - - s 0 +) 103 | (t - + 0 - - - s 0 -) 104 | (d - + 0 - - - s 0 +) 105 | (k - + 0 - - - s v -) 106 | (f - + 0 - - - f b -) 107 | (v - + 0 - - - f b +) 108 | (s - + 0 - - - f p -) 109 | (z - + 0 - - - f a +) 110 | (S - + 0 - - - f p -) 111 | (Z - + 0 - - - f p +) 112 | (m - + 0 - - - n 0 +) 113 | (n - + 0 - - - n 0 +) 114 | (J - + 0 - - - n p +) ;; Exemplo: Banho > b a~ j o (J > nh) 115 | (l - + 0 - - - l a +) 116 | (L - + 0 - - - l p +) ;; Exemplo: Trabalho > t r a b a L u (L > lh) 117 | (r - + 0 - - - l a +) 118 | (X - + 0 - - - 0 v +) 119 | (tS - + 0 - - - a 0 -) 120 | (g - + 0 - - - s v +) 121 | (dZ - + 0 - - - a 0 +) 122 | ;; insert the phones here, see examples in 123 | ;; festival/lib/*_phones.scm 124 | 125 | ) 126 | ) 127 | (PhoneSet.silences '(pau)) 128 | 129 | (define (INST_pt_VOX::select_phoneset) 130 | "(INST_pt_VOX::select_phoneset) 131 | Set up phone set for INST_pt." 132 | (Parameter.set 'PhoneSet 'INST_pt) 133 | (PhoneSet.select 'INST_pt) 134 | ) 135 | 136 | (define (INST_pt_VOX::reset_phoneset) 137 | "(INST_pt_VOX::reset_phoneset) 138 | Reset phone set for INST_pt." 139 | t 140 | ) 141 | 142 | (provide 'INST_pt_VOX_phoneset) 143 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FestPB é um projeto com objetivo de oferecer suporte ao Português Brasileiro ao software Text-to-Speech Festival Speech Synthesis. Com opções de baixar vozes. 2 | 3 | **Conteúdo da página:** 4 | * [Tutorial](#tutorial) 5 | * [Sobre dicionário e fonemas usados.](#sobre-dicionário-e-fonemas-usados) 6 | * [Recados Importantes](#recados-importantes) 7 | * [To-Do](#to-do) 8 | * [Tokenização](#tokenização) 9 | 10 | 11 | **Rescursos disponíveis no momento:** 12 | - Script para construção de dicionário do idioma Português Brasileiro. 13 | - Scripts para construção de modelos LTS (Lettng to Sound - Letras para Som) para Festival Speech Synthesis. 14 | - PhoneSet com fonemas do Português Brasileiro. 15 | - Script para geração de pitchmarck usado [REAPER](https://github.com/google/REAPER) 16 | - Script para construção desses seguintes programas (Festvox, Festival, Speech Tools e REAPER) e instalação de um G2P. 17 | - G2P usado [Annotator](https://github.com/falabrasil/annotator) 18 | - Arquivos para o suporte de fonemas do português brasileiro ao Festival Speech Synthesis. 19 | 20 | ## Tutorial 21 | 22 | Aqui tem um tutorial básico de como fazer o download do repositório e instalação das ferramentas. 23 | 24 | **Clone o repositório e entre em seu diretório:** 25 | ```bash 26 | git clone https://github.com/Pallas1303/FestPB 27 | cd FestPB 28 | ``` 29 | 30 | **Aviso:** A instalação são para distribuições baseadas em Debian. 31 | 32 | **Executar instalação das ferramentas:** 33 | ```bash 34 | bash scripts/make_tts_utils.sh 35 | ``` 36 | 37 | **Agora definar a variável FESTPB onde está armazenado o projeto e salve em arquivo. No caso o armazenamento é o caminho atual:** 38 | ```bash 39 | echo "FESTPB=$PWD" >> tts_utils/utils.source 40 | ``` 41 | 42 | **Aviso:** Caso a variável **FESTPB** não for definida corretamente todos os scripts do projeto não funcionaram. 43 | ## Sobre dicionário e fonemas usados. 44 | 45 | Dicionário fonético e fonemas são fornecidos pelo grupo Falabrasil com seu software G2P chamado annotator. Os fonemas estão em codificação UTF-8. 46 | 47 | Para construção do Phoneset foi usado como base o seguinte artigo: 48 | 49 | *Síntese de Fala em Português Brasileiro Baseada em 50 | Modelos Ocultos de Markov" feito por Carlos Francisco Soares de Souza.* 51 | 52 | Houve algumas pesquisas, mas as suas fontes estão perdidas. As características fonéticas dos fonemas marcadas no Phoneset podem estar incorretas em algumas partes. 53 | 54 | Caso houve erros, por favor faça uma contribuição 55 | ## Recados Importantes 56 | 57 | **No seguinte momento não á:** 58 | - Tutorial ou mesmo documentação para construir/instalar uma voz em português brasileiro. Sendo necessário conhecimento e familiaridade com Festival Speech Synthesis. 59 | - Conversão de números, emojis e símbolos. 60 | - Sem modelo POS Tagging em português brasileiro para Festival Speech Synthesis. 61 | - Scripts para construção automática de vozes. 62 | - Sem vozes de outros bancos de dados conhecidos. 63 | - Sem *stress* ao dicionário fonético. 64 | 65 | As vozes disponíveis aqui para fazer o download foram construídas usado o método concatenativo "Unit Selection" para obter naturalidade na geração de fala mas em alguns casos podem existir falhas nas geração de algumas frases ou mesmo palavras. 66 | 67 | No momento o meu ambiente de desenvolvimento não tem capacidade computacional para tarefas mais grandes como a construção de vozes com o método "Statistical Parametric Speech Synthesis" baseada em modelos HMM e construção de modelo LTS robusto. 68 | 69 | Ficarei feliz em receber qualquer apoio disponível para esse projeto. Como correção de problemas, vozes robustas construídas a partir dos métodos citados acima, modelo LTS robusto já compilado ou mesmo financeira. 70 | 71 | Os apoiadores terão seus nomes e suas ações mencionadas em novas atualizações. 72 | 73 | Muito obrigada por ler até aqui! 74 | 75 | ## To-Do 76 | 77 | Aqui será uma lista com os recursos que irão ser implementados. Com o passar das atualizações, os itens serão marcados. 78 | 79 | Isso pode sofrer mudanças ao decorrer do tempo. 80 | 81 | ### Tokenização 82 | 1. [ ] **Conversão de números em palavras:** 83 | 1. [ ] Fazer código para conversão numérica 84 | 3. [ ] Testar código. 85 | 4. [ ] Lançar no repositório 86 | 2. [ ] **Conversão de emojis em palavras:** 87 | 1. [ ] Encontrar banco de emoji com suas transcrições em PT-BR. 88 | 2. [ ] Criar um dicionário fonético ser apenas usados para os emojis. 89 | 3. [ ] Fazer que o dicionário seja usado com dicionário fonético principal e o modelo lts. 90 | 4. [ ] Testar com lista de emojis. 91 | 5. [ ] Lançar ao repositório 92 | 6. [ ] Colocar origem do banco de emojis e informações extras e seus autores originais ao repositório do projeto. 93 | 3. **Abreviaturas:** 94 | 1. [ ] Procurar as abreviaturas mais usadas no PT-BR. Incluindo as formais e informais como o intenteis. 95 | 2. [ ] Adicionar essas abreviaturas ao um dicionário de exceções. 96 | 3. [ ] Procurar um método para prever abreviaturas. 97 | 4. [ ] Procurar um método para tratar essas abreviaturas. Transformar na sua forma de pronunciar. 98 | 5. [ ] Fazer um "código próprio" para essa tarefa. 99 | 6. [ ] Testar com textos com várias abreviaturas mais usadas e também desconhecidas. 100 | 7. [ ] Lançar ao repositório. 101 | 8. [ ] Colocar as informações referente a essa etapa. Ex: Origem da lista de abreviaturas mais usadas, método, etc. 102 | 103 | **Aviso:** Infelizmente no momento não é possível fazer essas etapas de tokenizacão. Devido a complicações presentes no projeto. Qualquer contribuição referente a essa parte ou demais do projeto serão bem-vinda ao projeto. 104 | 105 | Mais recursos serão colocados ao TO-DO com decorrer do tempo. Quando completo as etapas em desenvolvimento ex. Conversão de números em palavras, conversão de emoji em palavras e etc. serão feitas nas atualizações nas vozes presentes do repositório. 106 | 107 | -------------------------------------------------------------------------------- /original_files/make_f0_model: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ########################################################################### 3 | ## ## 4 | ## Carnegie Mellon University and ## 5 | ## Alan W Black and Kevin A. Lenzo ## 6 | ## Copyright (c) 1998-2000 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ## ## 35 | ## Build an F0 model ## 36 | ## ## 37 | ## This model has almost no assumptions about the language hence this ## 38 | ## is just an example, but may be reasonable as a first pass of an ## 39 | ## intonation system. No accents are dealt with in this model ## 40 | ## ## 41 | ## Builds CART tree that predicts F0 at beginning, mid-vowel and end ## 42 | ## of syllables ## 43 | ## ## 44 | ########################################################################### 45 | 46 | # if [ $# != 3 ] 47 | # then 48 | # echo "Build a duration model, requires basic utterances to be pre-built" 49 | # echo "Usage: make_dur_model VOX PHONESET SILENCENAME" 50 | # echo "INST is the insstitute building the language, e.g. cmu, cstr, ogi" 51 | # echo " if there isn't an appropriate institute use, net." 52 | # echo "LANG is language identifier, e.g. japan, scotsgaelic" 53 | # echo "VOX is speaker identifier e.g kal, awb" 54 | # exit 1 55 | # fi 56 | 57 | LANG=C; export LANG 58 | 59 | if [ ! "$ESTDIR" ] 60 | then 61 | echo "environment variable ESTDIR is unset" 62 | echo "set it to your local speech tools directory e.g." 63 | echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 64 | echo or 65 | echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 66 | exit 1 67 | fi 68 | 69 | if [ "$SIODHEAPSIZE" = "" ] 70 | then 71 | SIODHEAPSIZE=20000000 72 | export SIODHEAPSIZE 73 | fi 74 | HEAPSIZE=$SIODHEAPSIZE 75 | 76 | SILENCENAME=pau 77 | VOICENAME='(voice_kal_diphone)' 78 | MODELNAME=cmu_us_kal 79 | 80 | DUMPFEATS=$ESTDIR/../festival/examples/dumpfeats 81 | WAGON=$ESTDIR/bin/wagon 82 | WAGON_TEST=$ESTDIR/bin/wagon_test 83 | 84 | ## extract the features 85 | echo ";;; Extracting features from utterances" 86 | $DUMPFEATS -relation Syllable -eval $VOICENAME -feats festival/f0/etc/f0.feats -output festival/f0/feats/%s.feats festival/utts/*.utt 87 | 88 | ## Save all features in one file removing silence phones 89 | echo ";;; Collecting features in training and test data" 90 | cat festival/f0/feats/*.feats >festival/f0/data/f0.data 91 | bin/traintest festival/f0/data/f0.data 92 | bin/traintest festival/f0/data/f0.data.train 93 | 94 | # Build description file 95 | echo ";;; Build feature description file" 96 | $ESTDIR/bin/make_wagon_desc festival/f0/data/f0.data festival/f0/etc/f0.feats festival/f0/etc/f0.desc 97 | festival -b --heap $HEAPSIZE festvox/build_prosody.scm $VOICENAME '(build_f0_feats_desc)' 98 | 99 | STOP=15 100 | PREF=f0 101 | 102 | echo ";;; Build the F0 models themselves" 103 | ( 104 | 105 | echo ";;; Build the syl_start F0 model" 106 | $WAGON -data festival/f0/data/f0.data.train.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.train.test -stop $STOP -output festival/f0/tree/start.$PREF.S$STOP.tree -stepwise -predictee syl_startpitch -ignore '(syl_midpitch syl_endpitch)' 107 | $WAGON_TEST -heap $HEAPSIZE -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/start.$PREF.S$STOP.tree -predictee syl_startpitch 108 | 109 | echo ";;; Build the syl_mid F0 model" 110 | $WAGON -data festival/f0/data/f0.data.train.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.train.test -stop $STOP -output festival/f0/tree/mid.$PREF.S$STOP.tree -stepwise -predictee syl_midpitch -ignore '(syl_startpitch syl_endpitch)' 111 | $WAGON_TEST -heap $HEAPSIZE -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/mid.$PREF.S$STOP.tree -predictee syl_midpitch 112 | 113 | echo ";;; Build the syl_end F0 model" 114 | $WAGON -data festival/f0/data/f0.data.train.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.train.test -stop $STOP -output festival/f0/tree/end.$PREF.S$STOP.tree -stepwise -predictee syl_endpitch -ignore '(syl_startpitch syl_midpitch)' 115 | $WAGON_TEST -heap $HEAPSIZE -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/end.$PREF.S$STOP.tree -predictee syl_endpitch 116 | 117 | ) | tee $PREF.S$STOP.out 118 | 119 | echo ";;; Constructing the f0 model as a loadable scheme file" 120 | $ESTDIR/../festival/bin/festival -b --heap $HEAPSIZE festvox/build_prosody.scm $VOICENAME '(finalize_f0_model "'$MODELNAME'" "'$PREF.S$STOP.tree'")' 121 | 122 | exit 123 | 124 | -------------------------------------------------------------------------------- /scripts/make_f0_model: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ########################################################################### 3 | ## ## 4 | ## Carnegie Mellon University and ## 5 | ## Alan W Black and Kevin A. Lenzo ## 6 | ## Copyright (c) 1998-2000 ## 7 | ## All Rights Reserved. ## 8 | ## ## 9 | ## Permission is hereby granted, free of charge, to use and distribute ## 10 | ## this software and its documentation without restriction, including ## 11 | ## without limitation the rights to use, copy, modify, merge, publish, ## 12 | ## distribute, sublicense, and/or sell copies of this work, and to ## 13 | ## permit persons to whom this work is furnished to do so, subject to ## 14 | ## the following conditions: ## 15 | ## 1. The code must retain the above copyright notice, this list of ## 16 | ## conditions and the following disclaimer. ## 17 | ## 2. Any modifications must be clearly marked as such. ## 18 | ## 3. Original authors' names are not deleted. ## 19 | ## 4. The authors' names are not used to endorse or promote products ## 20 | ## derived from this software without specific prior written ## 21 | ## permission. ## 22 | ## ## 23 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 24 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 25 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 26 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 27 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 28 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 29 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 30 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 31 | ## THIS SOFTWARE. ## 32 | ## ## 33 | ########################################################################### 34 | ## ## 35 | ## Build an F0 model ## 36 | ## ## 37 | ## This model has almost no assumptions about the language hence this ## 38 | ## is just an example, but may be reasonable as a first pass of an ## 39 | ## intonation system. No accents are dealt with in this model ## 40 | ## ## 41 | ## Builds CART tree that predicts F0 at beginning, mid-vowel and end ## 42 | ## of syllables ## 43 | ## ## 44 | ########################################################################### 45 | 46 | # if [ $# != 3 ] 47 | # then 48 | # echo "Build a duration model, requires basic utterances to be pre-built" 49 | # echo "Usage: make_dur_model VOX PHONESET SILENCENAME" 50 | # echo "INST is the insstitute building the language, e.g. cmu, cstr, ogi" 51 | # echo " if there isn't an appropriate institute use, net." 52 | # echo "LANG is language identifier, e.g. japan, scotsgaelic" 53 | # echo "VOX is speaker identifier e.g kal, awb" 54 | # exit 1 55 | # fi 56 | source $FESTPB/tts_utils/utils.source 57 | LANG=C; export LANG 58 | 59 | if [ ! "$ESTDIR" ] 60 | then 61 | echo "environment variable ESTDIR is unset" 62 | echo "set it to your local speech tools directory e.g." 63 | echo ' bash$ export ESTDIR=/home/awb/projects/speech_tools/' 64 | echo or 65 | echo ' csh% setenv ESTDIR /home/awb/projects/speech_tools/' 66 | exit 1 67 | fi 68 | 69 | if [ "$SIODHEAPSIZE" = "" ] 70 | then 71 | SIODHEAPSIZE=20000000 72 | export SIODHEAPSIZE 73 | fi 74 | 75 | . etc/voice.defs 76 | SILENCENAME=pau 77 | MODELNAME=$FV_VOICENAME 78 | VOICENAME="(voice_"$FV_VOICENAME"_clunits)" 79 | VOICESCM=${3:-festvox/${MODELNAME}_clunits.scm} 80 | DUMPFEATS=$ESTDIR/../festival/examples/dumpfeats 81 | WAGON=$ESTDIR/bin/wagon 82 | WAGON_TEST=$ESTDIR/bin/wagon_test 83 | 84 | ## extract the features 85 | echo ";;; Extracting features from utterances" 86 | $DUMPFEATS -relation Syllable -eval $VOICESCM -feats festival/f0/etc/f0.feats -output festival/f0/feats/%s.feats festival/utts/*.utt 87 | 88 | ## Save all features in one file removing silence phones 89 | echo ";;; Collecting features in training and test data" 90 | cat festival/f0/feats/*.feats >festival/f0/data/f0.data 91 | bin/traintest festival/f0/data/f0.data 92 | #bin/traintest festival/f0/data/f0.data.train 93 | 94 | # Build description file 95 | echo ";;; Build feature description file" 96 | $ESTDIR/bin/make_wagon_desc festival/f0/data/f0.data festival/f0/etc/f0.feats festival/f0/etc/f0.desc 97 | $ESTDIR/../festival/bin/festival -b festvox/build_prosody.scm $VOICESCM '(build_f0_feats_desc)' 98 | 99 | STOP=20 100 | PREF=f0 101 | 102 | echo ";;; Build the F0 models themselves" 103 | ( 104 | 105 | echo ";;; Build the syl_start F0 model" 106 | $WAGON -data festival/f0/data/f0.data.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.test -stop $STOP -output festival/f0/tree/start.$PREF.S$STOP.tree -predictee syl_startpitch -ignore '(syl_midpitch syl_endpitch)' -omp_nthreads 8 107 | $WAGON_TEST -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/start.$PREF.S$STOP.tree -predictee syl_startpitch 108 | 109 | echo ";;; Build the syl_mid F0 model" 110 | $WAGON -data festival/f0/data/f0.data.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.test -stop $STOP -output festival/f0/tree/mid.$PREF.S$STOP.tree -predictee syl_midpitch -ignore '(syl_startpitch syl_endpitch)' -omp_nthreads 8 111 | $WAGON_TEST -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/mid.$PREF.S$STOP.tree -predictee syl_midpitch 112 | 113 | echo ";;; Build the syl_end F0 model" 114 | $WAGON -data festival/f0/data/f0.data.train -desc festival/f0/etc/f0.desc -test festival/f0/data/f0.data.test -stop $STOP -output festival/f0/tree/end.$PREF.S$STOP.tree -predictee syl_endpitch -ignore '(syl_startpitch syl_midpitch)' -omp_nthreads 8 115 | $WAGON_TEST -data festival/f0/data/f0.data.test -desc festival/f0/etc/f0.desc -tree festival/f0/tree/end.$PREF.S$STOP.tree -predictee syl_endpitch 116 | 117 | ) | tee $PREF.S$STOP.out 118 | 119 | echo ";;; Constructing the f0 model as a loadable scheme file" 120 | $ESTDIR/../festival/bin/festival -b festvox/build_prosody.scm $VOICESCM '(finalize_f0_model "'$MODELNAME'" "'$PREF.S$STOP.tree'")' 121 | 122 | exit 123 | 124 | -------------------------------------------------------------------------------- /original_files/build_lts: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #####################################################-*-mode:shell-script-*- 3 | ## ## 4 | ## ## 5 | ## Language Technologies Institute ## 6 | ## Carnegie Mellon University ## 7 | ## Copyright (c) 1998-2004 ## 8 | ## All Rights Reserved. ## 9 | ## ## 10 | ## Permission is hereby granted, free of charge, to use and distribute ## 11 | ## this software and its documentation without restriction, including ## 12 | ## without limitation the rights to use, copy, modify, merge, publish, ## 13 | ## distribute, sublicense, and/or sell copies of this work, and to ## 14 | ## permit persons to whom this work is furnished to do so, subject to ## 15 | ## the following conditions: ## 16 | ## 1. The code must retain the above copyright notice, this list of ## 17 | ## conditions and the following disclaimer. ## 18 | ## 2. Any modifications must be clearly marked as such. ## 19 | ## 3. Original authors' names are not deleted. ## 20 | ## 4. The authors' names are not used to endorse or promote products ## 21 | ## derived from this software without specific prior written ## 22 | ## permission. ## 23 | ## ## 24 | ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ## 25 | ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ## 26 | ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ## 27 | ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ## 28 | ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ## 29 | ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ## 30 | ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ## 31 | ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ## 32 | ## THIS SOFTWARE. ## 33 | ## ## 34 | ########################################################################### 35 | 36 | 37 | LANG=C 38 | if [ "$FESTIVALDIR" = "" ] 39 | then 40 | FESTIVALDIR=$ESTDIR/../festival 41 | fi 42 | FESTIVAL=$FESTIVALDIR/bin/festival 43 | 44 | if [ "$SIODHEAPSIZE" = "" ] 45 | then 46 | SIODHEAPSIZE=999999 47 | export SIODHEAPSIZE 48 | fi 49 | HEAPSIZE=$SIODHEAPSIZE 50 | 51 | if [ $# = 0 ] 52 | then 53 | $0 cummulate 54 | $0 align 55 | $0 traintest 56 | $0 build 57 | $0 merge 58 | $0 test 59 | exit 0 60 | fi 61 | 62 | if [ "$1" = "setup" ] 63 | then 64 | 65 | cp -p $FESTVOXDIR/src/lts/build_lts_rules . 66 | cp -p $FESTVOXDIR/src/lts/build_lts . 67 | mkdir lts_scratch 68 | 69 | LTYPE=utf8 70 | # if [ $# = 3 ] 71 | # then 72 | # asis or utf8 73 | # LTYPE=$3 74 | # fi 75 | 76 | $FESTIVAL -b "(require 'lts_build)" '(dump-flat-entries "'$2'" "lts_scratch/lex_entries.out" "'$LTYPE'")' 77 | exit 0 78 | fi 79 | 80 | if [ "$1" = "make_allowables" ] 81 | then 82 | # Automatic build of allowables 83 | if [ -f allowables.scm ] 84 | then 85 | cp -p allowables.scm allowables.scm-old 86 | fi 87 | 88 | $FESTIVAL --heap $SIODHEAPSIZE -b "(require 'lts_build)" '(dump-lets-phones "lts_scratch/lex_entries.out")' 89 | 90 | $FESTVOXDIR/src/lts/make_allows >allowables.scm 91 | 92 | exit 0 93 | fi 94 | 95 | if [ "$1" = "make_allowables_smt" ] 96 | then 97 | # Automatic build of allowables 98 | if [ -f allowables.scm ] 99 | then 100 | cp -p allowables.scm allowables.scm-old 101 | fi 102 | 103 | $FESTIVAL --heap $SIODHEAPSIZE -b "(require 'lts_build)" '(dump-lets-phones "lts_scratch/lex_entries.out")' 104 | 105 | $FESTVOXDIR/src/lts/make_allows-smt >allowables.scm 106 | 107 | exit 0 108 | fi 109 | 110 | if [ "$1" = "cummulate" ] 111 | then 112 | 113 | if [ ! -f "lts_scratch/lex_entries.out" ] 114 | then 115 | echo "can't find lts_scratch/lex_entries.out" 116 | exit 117 | fi 118 | 119 | echo Find probabilities of letter-phone pairs 120 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm '(begin 121 | (cummulate-pairs "lts_scratch/lex_entries.out") 122 | (save-table "lts_scratch/lex-") )' 123 | exit 0 124 | fi 125 | 126 | 127 | if [ "$1" = "align" ] 128 | then 129 | 130 | echo Align letter-phone pairs with best path 131 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex-pl-tablesp.scm '(begin 132 | (aligndata "lts_scratch/lex_entries.out" "lts_scratch/lex.align") 133 | (build-feat-file "lts_scratch/lex.align" "lts_scratch/lex.feats"))' | 134 | tee align.log 135 | exit 0 136 | fi 137 | 138 | if [ "$1" = "align_p" ] 139 | then 140 | 141 | echo Align letter-phone pairs with best path -- in parallel 142 | numlines=`cat lts_scratch/lex_entries.out | awk 'END { printf("%d\n",(NR+6)/6)}'` 143 | split --lines=$numlines lts_scratch/lex_entries.out lts_scratch/lex_entries.out. 144 | for i in aa ab ac ad ae af 145 | do 146 | echo lts_scratch/lex_entries.out.$i 147 | done >all.cmd 148 | cat all.cmd | xargs -n 1 -P 8 $0 align_part 1> align.log 2> align.log 149 | cat lts_scratch/lex_entries.out.*.align >lts_scratch/lex.align 150 | 151 | rm -f lts_scratch/lex.feats 152 | for i in aa ab ac ad ae af 153 | do 154 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex-pl-tablesp.scm '(begin 155 | (build-feat-file "lts_scratch/lex_entries.out.'$i'.align" "lts_scratch/lex.feats.part"))' 156 | cat lts_scratch/lex.feats.part >>lts_scratch/lex.feats 157 | done 158 | exit 0 159 | fi 160 | 161 | if [ "$1" = "align_part" ] 162 | then 163 | echo Align letter-phone pairs with best path -- part 164 | 165 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex-pl-tablesp.scm '(begin 166 | (aligndata "'$2'" "'$2.align'"))' | 167 | tee align.log 168 | exit 0 169 | fi 170 | 171 | if [ "$1" = "traintest" ] 172 | then 173 | echo "Split into training and test sets" 174 | $FESTVOXDIR/src/general/traintest lts_scratch/lex.align 175 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex-pl-tablesp.scm '(begin 176 | (build-feat-file "lts_scratch/lex.align.train" "lts_scratch/lex.feats.train"))' 177 | exit 0 178 | fi 179 | 180 | 181 | if [ "$1" = "build" ] 182 | then 183 | 184 | echo Build letter to phone CART trees 185 | if [ -f lts_scratch/lex.align.train ] 186 | then 187 | echo "With traintest split" 188 | fi 189 | (cd lts_scratch; ../build_lts_rules ) >lts_scratch/lts.build.out 190 | 191 | exit 0 192 | fi 193 | 194 | if [ "$1" = "merge" ] 195 | then 196 | echo Build complete model 197 | (cd lts_scratch; 198 | $FESTIVAL -b --heap $SIODHEAPSIZE ../allowables.scm '(begin 199 | (merge_models "lex_lts_rules" "lex_lts_rules.scm" allowables))') 200 | cp -p lts_scratch/lex_lts_rules.scm ./lex_lts_rules.scm 201 | exit 0 202 | fi 203 | 204 | if [ "$1" = "test" ] 205 | then 206 | echo Test model 207 | if [ -f lts_scratch/lex.align.test ] 208 | then 209 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex_lts_rules.scm '(lts_testset "lts_scratch/lex.align.test" lex_lts_rules)' | tee lts_test.log 210 | echo "with TEST set" 211 | else 212 | $FESTIVAL -b --heap $SIODHEAPSIZE allowables.scm lts_scratch/lex_lts_rules.scm '(lts_testset "lts_scratch/lex.align" lex_lts_rules)' | tee lts_test.log 213 | echo "with ALL data -- no held out test set" 214 | fi 215 | exit 0 216 | fi 217 | 218 | if [ "$1" = "tidyup" ] 219 | then 220 | rm -rf lts_scratch 221 | exit 0 222 | fi 223 | 224 | echo $0 unknown option $* 225 | exit 1 226 | 227 | -------------------------------------------------------------------------------- /original_files/INST_LANG_VOX_lexicon.scm: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;; ;;; 3 | ;;; Carnegie Mellon University ;;; 4 | ;;; and Alan W Black and Kevin Lenzo ;;; 5 | ;;; Copyright (c) 1998-2000 ;;; 6 | ;;; All Rights Reserved. ;;; 7 | ;;; ;;; 8 | ;;; Permission is hereby granted, free of charge, to use and distribute ;;; 9 | ;;; this software and its documentation without restriction, including ;;; 10 | ;;; without limitation the rights to use, copy, modify, merge, publish, ;;; 11 | ;;; distribute, sublicense, and/or sell copies of this work, and to ;;; 12 | ;;; permit persons to whom this work is furnished to do so, subject to ;;; 13 | ;;; the following conditions: ;;; 14 | ;;; 1. The code must retain the above copyright notice, this list of ;;; 15 | ;;; conditions and the following disclaimer. ;;; 16 | ;;; 2. Any modifications must be clearly marked as such. ;;; 17 | ;;; 3. Original authors' names are not deleted. ;;; 18 | ;;; 4. The authors' names are not used to endorse or promote products ;;; 19 | ;;; derived from this software without specific prior written ;;; 20 | ;;; permission. ;;; 21 | ;;; ;;; 22 | ;;; CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ;;; 23 | ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;; 24 | ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;; 25 | ;;; SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ;;; 26 | ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;; 27 | ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;; 28 | ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;; 29 | ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;; 30 | ;;; THIS SOFTWARE. ;;; 31 | ;;; ;;; 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 | ;;; 34 | ;;; Lexicon, LTS and Postlexical rules for INST_LANG 35 | ;;; 36 | 37 | ;;; Load any necessary files here 38 | 39 | (define (INST_LANG_addenda) 40 | "(INST_LANG_addenda) 41 | Basic lexicon should (must ?) have basic letters, symbols and punctuation." 42 | 43 | ;;; Pronunciation of letters in the alphabet 44 | ;(lex.add.entry '("a" nn (((a) 0)))) 45 | ;(lex.add.entry '("b" nn (((b e) 0)))) 46 | ;(lex.add.entry '("c" nn (((th e) 0)))) 47 | ;(lex.add.entry '("d" nn (((d e) 0)))) 48 | ;(lex.add.entry '("e" nn (((e) 0)))) 49 | ; ... 50 | 51 | ;;; Symbols ... 52 | ;(lex.add.entry 53 | ; '("*" n (((a s) 0) ((t e) 0) ((r i1 s) 1) ((k o) 0)))) 54 | ;(lex.add.entry 55 | ; '("%" n (((p o r) 0) ((th i e1 n) 1) ((t o) 0)))) 56 | 57 | ;; Basic punctuation must be in with nil pronunciation 58 | (lex.add.entry '("." punc nil)) 59 | ;(lex.add.entry '("." nn (((p u1 n) 1) ((t o) 0)))) 60 | (lex.add.entry '("'" punc nil)) 61 | (lex.add.entry '(":" punc nil)) 62 | (lex.add.entry '(";" punc nil)) 63 | (lex.add.entry '("," punc nil)) 64 | ;(lex.add.entry '("," nn (((k o1) 1) ((m a) 0)))) 65 | (lex.add.entry '("-" punc nil)) 66 | (lex.add.entry '("\"" punc nil)) 67 | (lex.add.entry '("`" punc nil)) 68 | (lex.add.entry '("?" punc nil)) 69 | (lex.add.entry '("!" punc nil)) 70 | ) 71 | 72 | (require 'lts) 73 | 74 | ;;; Function called when word not found in lexicon 75 | ;;; and you've trained letter to sound rules 76 | (define (INST_LANG_lts_function word features) 77 | "(INST_LANG_lts_function WORD FEATURES) 78 | Return pronunciation of word not in lexicon." 79 | 80 | ;; If you have nothing ... 81 | (format t "Unknown word %s\n" word) 82 | (list word features nil) 83 | 84 | ;; If you have lts rules (trained or otherwise) 85 | ; (if (not boundp 'INST_LANG_lts_rules) 86 | ; (require 'INST_LANG_lts_rules)) 87 | ; (let ((dword (downcase word)) (phones) (syls)) 88 | ; (set! phones (lts_predict dword INST_LANG_lts_rules)) 89 | ; (set! syls (INST_LANG_lex_syllabify_phstress phones)) 90 | ; (list word features syls)) 91 | ) 92 | 93 | (define (INST_LANG_map_modify ps) 94 | (cond 95 | ((null ps) nil) 96 | ((null (cdr ps)) ps) 97 | ((assoc_string (string-append (car ps) (cadr ps)) 98 | INST_LANG_VOX_char_phone_map) 99 | (cons 100 | (string-append (car ps) (cadr ps)) 101 | (INST_LANG_map_modify (cddr ps)))) 102 | (t 103 | (cons 104 | (car ps) 105 | (INST_LANG_map_modify (cdr ps)))))) 106 | 107 | (define (INST_LANG_map_phones p) 108 | (cond 109 | ((null p) nil) 110 | (t 111 | (let ((a (assoc_string (car p) INST_LANG_VOX_char_phone_map))) 112 | (cond 113 | (a (cons (cadr a) (INST_LANG_map_phones (cdr p)))) 114 | (t (INST_LANG_map_phones (cdr p)))))))) 115 | 116 | (define (INST_LANG_is_vowel x) 117 | (string-equal "+" (phone_feature x "vc"))) 118 | 119 | (define (INST_LANG_contains_vowel l) 120 | (member_string 121 | t 122 | (mapcar (lambda (x) (INST_LANG_is_vowel x)) l))) 123 | 124 | (define (INST_LANG_lex_sylbreak currentsyl remainder) 125 | "(INST_LANG_lex_sylbreak currentsyl remainder) 126 | t if this is a syl break, nil otherwise." 127 | (cond 128 | ((not (INST_LANG_contains_vowel remainder)) 129 | nil) 130 | ((not (INST_LANG_contains_vowel currentsyl)) 131 | nil) 132 | (t 133 | ;; overly naive, I mean wrong 134 | t)) 135 | ) 136 | 137 | (define (INST_LANG_lex_syllabify_phstress phones) 138 | (let ((syl nil) (syls nil) (p phones) (stress 0)) 139 | (while p 140 | (set! syl nil) 141 | (set! stress 0) 142 | (while (and p (not (INST_LANG_lex_sylbreak syl p))) 143 | (if (string-matches (car p) "xxxx") 144 | (begin 145 | ;; whatever you do to identify stress 146 | (set! stress 1) 147 | (set syl (cons (car p-stress) syl))) 148 | (set! syl (cons (car p) syl))) 149 | (set! p (cdr p))) 150 | (set! syls (cons (list (reverse syl) stress) syls))) 151 | (reverse syls))) 152 | 153 | (if (probe_file (path-append INST_LANG_VOX::dir "festvox/lex_lts_rules.scm")) 154 | (begin 155 | (load (path-append INST_LANG_VOX::dir "festvox/lex_lts_rules.scm")) 156 | (set! INST_LANG_lts_rules lex_lts_rules))) 157 | 158 | ;; utf8-sampa map based on unitran 159 | (if (probe_file (path-append INST_LANG_VOX::dir "festvox/INST_LANG_VOX_char_phone_map.scm")) 160 | (begin 161 | (set! INST_LANG_VOX_char_phone_map 162 | (load (path-append INST_LANG_VOX::dir 163 | "festvox/INST_LANG_VOX_char_phone_map.scm") t)) 164 | (load (path-append INST_LANG_VOX::dir 165 | "festvox/unicode_sampa_mapping.scm")) 166 | 167 | ;; utf8-indic-sampa letter based one 168 | (define (INST_LANG_lts_function word features) 169 | "(INST_LANG_lts_function WORD FEATURES) 170 | Return pronunciation of word not in lexicon." 171 | (let ((dword word) (phones) (syls) (aphones)) 172 | (if (boundp 'INST_LANG_lts_rules) 173 | (set! phones (lts_predict (utf8explode dword) INST_LANG_lts_rules)) 174 | (begin 175 | (set! aphones (INST_LANG_map_modify (utf8explode dword))) 176 | (set! phones (INST_LANG_map_phones aphones)) 177 | (set! phones (sampa_lookup phones)))) 178 | ; (set! phones (indic_unicode_lts sphones)) 179 | (set! syls (INST_LANG_lex_syllabify_phstress phones)) 180 | (list word features syls))) 181 | )) 182 | 183 | (define (sampa_lookup gphones) 184 | (let ((phlist nil) (sp nil)) 185 | (mapcar 186 | (lambda (gg) 187 | (set! sp (assoc_string gg unicode_sampa_mapping)) 188 | (if sp 189 | (set! phlist (append (reverse (car (cadr sp))) phlist)) 190 | (set! phlist (cons gg phlist)))) 191 | gphones) 192 | (reverse phlist))) 193 | 194 | (define (indic_unicode_lts phlist) 195 | (set! finallist (list)) 196 | (set! graphemecount 0) 197 | (set! prevgrapheme (list)) 198 | (set! totgcnt (- (length phlist) 1)) 199 | (mapcar (lambda (ggg) 200 | (if (symbol? (car ggg)) 201 | (begin 202 | (cond 203 | ;; schwa deletion for the last consonant 204 | ((equal? graphemecount totgcnt) 205 | (begin 206 | (if (string-equal (phone_feature (car ggg) 'vc) "-") 207 | (begin 208 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") 209 | (set! finallist (append finallist prevgrapheme))) 210 | ;(set! finallist (append finallist (list (car ggg)))) ;appropriate for hindi 211 | (set! finallist (append finallist ggg)) ; for generic (non-schwa final) indic 212 | ) 213 | (begin 214 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") 215 | (set! finallist (append finallist (list (car prevgrapheme))))) 216 | (set! finallist (append finallist (list (car ggg)))) 217 | )) 218 | )) 219 | ;; generic treatment for an intermediate grapheme 220 | ((and (> graphemecount 0) (< graphemecount totgcnt)) 221 | (begin 222 | (cond 223 | ;; If current is vowel, remove the previous schwa 224 | ((and (string-equal (phone_feature (car ggg) 'vc) "+") (string-equal (phone_feature (car prevgrapheme) 'vc) "-")) 225 | (begin 226 | (set! finallist (append finallist (list (car prevgrapheme)))) 227 | (set! finallist (append finallist (list (car ggg)))) 228 | )) 229 | ;; If current is consonant and previous is consonant, dump all of previous 230 | ((and (string-equal (phone_feature (car ggg) 'vc) "-") (string-equal (phone_feature (car prevgrapheme) 'vc) "-")) 231 | (set! finallist (append finallist prevgrapheme))) 232 | (t 233 | t) 234 | ) 235 | )) 236 | ((and (eq? graphemecount 0) (string-equal (phone_feature (car ggg) 'vc) "+")) 237 | (set! finallist (list (car ggg))) 238 | ) 239 | (t 240 | t) 241 | ) 242 | (set! graphemecount (+ 1 graphemecount)) 243 | (set! prevgrapheme ggg) 244 | ) 245 | (begin 246 | (cond 247 | ((equal? (car ggg) '(P)) 248 | (set! finallist (append finallist (list (car prevgrapheme)))) 249 | (set! prevgrapheme (list)) 250 | ) 251 | ((equal? (car ggg) '(M)) 252 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") (set! finallist (append finallist prevgrapheme))) 253 | (set! finallist (append finallist (list "nB"))) 254 | (set! prevgrapheme (list)) 255 | ) 256 | ((equal? (car ggg) '(CD)) 257 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") (set! finallist (append finallist prevgrapheme))) 258 | (set! finallist (append finallist (list "nB"))) 259 | (set! prevgrapheme (list)) 260 | ) 261 | (t 262 | t) 263 | ;(format t "debug: todo \n") 264 | ) 265 | (set! graphemecount (+ 1 graphemecount)) 266 | ) 267 | ) 268 | ) phlist) 269 | finallist) 270 | 271 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 272 | ;;; 273 | ;;; OR: Hand written letter to sound rules 274 | ;;; 275 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 276 | 277 | ; ;;; Function called when word not found in lexicon 278 | ; (define (INST_LANG_lts_function word features) 279 | ; "(INST_LANG_lts_function WORD FEATURES) 280 | ; Return pronunciation of word not in lexicon." 281 | ; (format stderr "failed to find pronunciation for %s\n" word) 282 | ; (let ((dword (downcase word))) 283 | ; ;; Note you may need to use a letter to sound rule set to do 284 | ; ;; casing if the language has non-ascii characters in it. 285 | ; (if (lts.in.alphabet word 'INST_LANG) 286 | ; (list 287 | ; word 288 | ; features 289 | ; ;; This syllabification is almost certainly wrong for 290 | ; ;; this language (its not even very good for English) 291 | ; ;; but it will give you something to start off with 292 | ; (lex.syllabify.phstress 293 | ; (lts.apply word 'INST_LANG))) 294 | ; (begin 295 | ; (format stderr "unpronouncable word %s\n" word) 296 | ; ;; Put in a word that means "unknown" with its pronunciation 297 | ; '("nepoznat" nil (((N EH P) 0) ((AO Z) 0) ((N AA T) 0)))))) 298 | ; ) 299 | 300 | ; ;; You may or may not be able to write a letter to sound rule set for 301 | ; ;; your language. If its largely lexicon based learning a rule 302 | ; ;; set will be better and easier that writing one (probably). 303 | ; (lts.ruleset 304 | ; INST_LANG 305 | ; ( (Vowel WHATEVER) ) 306 | ; ( 307 | ; ;; LTS rules 308 | ; )) 309 | 310 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 311 | ;;; 312 | ;;; Postlexical Rules 313 | ;;; 314 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 315 | 316 | (define (INST_LANG::postlex_rule1 utt) 317 | "(INST_LANG::postlex_rule1 utt) 318 | A postlexical rule form correcting phenomena over word boundaries." 319 | (mapcar 320 | (lambda (s) 321 | ;; do something 322 | ) 323 | (utt.relation.items utt 'Segment)) 324 | utt) 325 | 326 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 327 | ;;; 328 | ;;; Lexicon definition 329 | ;;; 330 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 331 | 332 | (lex.create "INST_LANG") 333 | (lex.set.phoneset "INST_LANG") 334 | (lex.set.lts.method 'INST_LANG_lts_function) 335 | (if (probe_file (path-append INST_LANG_VOX::dir "festvox/INST_LANG_lex.out")) 336 | (lex.set.compile.file (path-append INST_LANG_VOX::dir 337 | "festvox/INST_LANG_lex.out"))) 338 | (INST_LANG_addenda) 339 | (if (probe_file (path-append INST_LANG_VOX::dir "festvox/INST_LANG_addenda.scm")) 340 | (load (path-append INST_LANG_VOX::dir "festvox/INST_LANG_addenda.scm"))) 341 | 342 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 343 | ;;; 344 | ;;; Lexicon setup 345 | ;;; 346 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 347 | 348 | (define (INST_LANG_VOX::select_lexicon) 349 | "(INST_LANG_VOX::select_lexicon) 350 | Set up the lexicon for INST_LANG." 351 | (lex.select "INST_LANG") 352 | 353 | ;; Post lexical rules 354 | (set! postlex_rules_hooks (list INST_LANG::postlex_rule1)) 355 | ) 356 | 357 | (define (INST_LANG_VOX::reset_lexicon) 358 | "(INST_LANG_VOX::reset_lexicon) 359 | Reset lexicon information." 360 | t 361 | ) 362 | 363 | (provide 'INST_LANG_VOX_lexicon) 364 | -------------------------------------------------------------------------------- /vox_files/INST_pt_VOX_lexicon.scm: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;; ;;; 3 | ;;; Carnegie Mellon University ;;; 4 | ;;; and Alan W Black and Kevin Lenzo ;;; 5 | ;;; Copyright (c) 1998-2000 ;;; 6 | ;;; All Rights Reserved. ;;; 7 | ;;; ;;; 8 | ;;; Permission is hereby granted, free of charge, to use and distribute ;;; 9 | ;;; this software and its documentation without restriction, including ;;; 10 | ;;; without limitation the rights to use, copy, modify, merge, publish, ;;; 11 | ;;; distribute, sublicense, and/or sell copies of this work, and to ;;; 12 | ;;; permit persons to whom this work is furnished to do so, subject to ;;; 13 | ;;; the following conditions: ;;; 14 | ;;; 1. The code must retain the above copyright notice, this list of ;;; 15 | ;;; conditions and the following disclaimer. ;;; 16 | ;;; 2. Any modifications must be clearly marked as such. ;;; 17 | ;;; 3. Original authors' names are not deleted. ;;; 18 | ;;; 4. The authors' names are not used to endorse or promote products ;;; 19 | ;;; derived from this software without specific prior written ;;; 20 | ;;; permission. ;;; 21 | ;;; ;;; 22 | ;;; CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ;;; 23 | ;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;; 24 | ;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;; 25 | ;;; SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ;;; 26 | ;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;; 27 | ;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;; 28 | ;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;; 29 | ;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;; 30 | ;;; THIS SOFTWARE. ;;; 31 | ;;; ;;; 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 | ;;; 34 | ;;; Lexicon, LTS and Postlexical rules for INST_pt 35 | ;;; 36 | 37 | ;;; Load any necessary files here 38 | 39 | (define (INST_pt_addenda) 40 | "(INST_pt_addenda) 41 | Basic lexicon should (must ?) have basic letters, symbols and punctuation." 42 | 43 | ;;; Pronunciation of letters in the alphabet 44 | ;(lex.add.entry '("a" nn (((a) 0)))) 45 | ;(lex.add.entry '("b" nn (((b e) 0)))) 46 | ;(lex.add.entry '("c" nn (((th e) 0)))) 47 | ;(lex.add.entry '("d" nn (((d e) 0)))) 48 | ;(lex.add.entry '("e" nn (((e) 0)))) 49 | ; ... 50 | (lex.add.entry '("a" nil (((a) 0)))) 51 | (lex.add.entry '("b" nil (((b e) 0)))) 52 | (lex.add.entry '("c" nil (((s e) 0)))) 53 | (lex.add.entry '("d" nil (((d e) 0)))) 54 | (lex.add.entry '("e" nil (((E) 0)))) 55 | (lex.add.entry '("f" nil (((E) 0) ((f i) 0)))) 56 | (lex.add.entry '("g" nil (((g e) 0)))) 57 | (lex.add.entry '("h" nil (((a) 0) ((g a) 0)))) 58 | (lex.add.entry '("i" nil (((i) 0)))) 59 | (lex.add.entry '("j" nil (((Z O) 0) ((t a) 0)))) 60 | (lex.add.entry '("k" nil (((k a) 0)))) 61 | (lex.add.entry '("l" nil (((E) 0) ((l i) 0)))) 62 | (lex.add.entry '("m" nil (((e) 0) ((m i) 0)))) 63 | (lex.add.entry '("n" nil (((e) 0) ((n i) 0)))) 64 | (lex.add.entry '("o" nil (((O) 0)))) 65 | (lex.add.entry '("p" nil (((p e) 0)))) 66 | (lex.add.entry '("q" nil (((k u) 0) ((e) 0)))) 67 | (lex.add.entry '("r" nil (((E) 0) ((R i) 0)))) 68 | (lex.add.entry '("s" nil (((E) 0) ((s i) 0)))) 69 | (lex.add.entry '("t" nil (((t e) 0)))) 70 | (lex.add.entry '("u" nil (((u) 0)))) 71 | (lex.add.entry '("v" nil (((v e) 0)))) 72 | (lex.add.entry '("w" nil (((d a) 0) ((b l i w) 0)))) 73 | (lex.add.entry '("x" nil (((S i j s) 0)))) 74 | (lex.add.entry '("y" nil (((i p) 0) ((s i) 0) ((l o~) 0)))) 75 | (lex.add.entry '("z" nil (((z e) 0)))) 76 | 77 | ;;; Symbols ... 78 | ;(lex.add.entry 79 | ; '("*" n (((a s) 0) ((t e) 0) ((r i1 s) 1) ((k o) 0)))) 80 | ;(lex.add.entry 81 | ; '("%" n (((p o r) 0) ((th i e1 n) 1) ((t o) 0)))) 82 | 83 | ;; Basic punctuation must be in with nil pronunciation 84 | (lex.add.entry '("." punc nil)) 85 | ;(lex.add.entry '("." nn (((p u1 n) 1) ((t o) 0)))) 86 | (lex.add.entry '("'" punc nil)) 87 | (lex.add.entry '(":" punc nil)) 88 | (lex.add.entry '(";" punc nil)) 89 | (lex.add.entry '("," punc nil)) 90 | ;(lex.add.entry '("," nn (((k o1) 1) ((m a) 0)))) 91 | (lex.add.entry '("-" punc nil)) 92 | (lex.add.entry '("\"" punc nil)) 93 | (lex.add.entry '("`" punc nil)) 94 | (lex.add.entry '("?" punc nil)) 95 | (lex.add.entry '("!" punc nil)) 96 | ) 97 | 98 | (require 'lts) 99 | 100 | ;;; Function called when word not found in lexicon 101 | ;;; and you've trained letter to sound rules 102 | (define (INST_pt_lts_function word features) 103 | "(INST_pt_lts_function WORD FEATURES) 104 | Return pronunciation of word not in lexicon." 105 | 106 | ;; If you have nothing ... 107 | (format t "Unknown word %s\n" word) 108 | (list word features nil) 109 | 110 | ;; If you have lts rules (trained or otherwise) 111 | ; (if (not boundp 'INST_pt_lts_rules) 112 | ; (require 'INST_pt_lts_rules)) 113 | ; (let ((dword (downcase word)) (phones) (syls)) 114 | ; (set! phones (lts_predict dword INST_pt_lts_rules)) 115 | ; (set! syls (INST_pt_lex_syllabify_phstress phones)) 116 | ; (list word features syls)) 117 | ) 118 | 119 | (define (INST_pt_map_modify ps) 120 | (cond 121 | ((null ps) nil) 122 | ((null (cdr ps)) ps) 123 | ((assoc_string (string-append (car ps) (cadr ps)) 124 | INST_pt_VOX_char_phone_map) 125 | (cons 126 | (string-append (car ps) (cadr ps)) 127 | (INST_pt_map_modify (cddr ps)))) 128 | (t 129 | (cons 130 | (car ps) 131 | (INST_pt_map_modify (cdr ps)))))) 132 | 133 | (define (INST_pt_map_phones p) 134 | (cond 135 | ((null p) nil) 136 | (t 137 | (let ((a (assoc_string (car p) INST_pt_VOX_char_phone_map))) 138 | (cond 139 | (a (cons (cadr a) (INST_pt_map_phones (cdr p)))) 140 | (t (INST_pt_map_phones (cdr p)))))))) 141 | 142 | (define (INST_pt_is_vowel x) 143 | (string-equal "+" (phone_feature x "vc"))) 144 | 145 | (define (INST_pt_contains_vowel l) 146 | (member_string 147 | t 148 | (mapcar (lambda (x) (INST_pt_is_vowel x)) l))) 149 | 150 | (define (INST_pt_lex_sylbreak currentsyl remainder) 151 | "(INST_pt_lex_sylbreak currentsyl remainder) 152 | t if this is a syl break, nil otherwise." 153 | (cond 154 | ((not (INST_pt_contains_vowel remainder)) 155 | nil) 156 | ((not (INST_pt_contains_vowel currentsyl)) 157 | nil) 158 | (t 159 | ;; overly naive, I mean wrong 160 | t)) 161 | ) 162 | 163 | (define (INST_pt_lex_syllabify_phstress phones) 164 | (let ((syl nil) (syls nil) (p phones) (stress 0)) 165 | (while p 166 | (set! syl nil) 167 | (set! stress 0) 168 | (while (and p (not (INST_pt_lex_sylbreak syl p))) 169 | (if (string-matches (car p) "xxxx") 170 | (begin 171 | ;; whatever you do to identify stress 172 | (set! stress 1) 173 | (set syl (cons (car p-stress) syl))) 174 | (set! syl (cons (car p) syl))) 175 | (set! p (cdr p))) 176 | (set! syls (cons (list (reverse syl) stress) syls))) 177 | (reverse syls))) 178 | 179 | (if (probe_file (path-append INST_pt_VOX::dir "festvox/lex_lts_rules.scm")) 180 | (begin 181 | (load (path-append INST_pt_VOX::dir "festvox/lex_lts_rules.scm")) 182 | (set! INST_pt_lts_rules lex_lts_rules))) 183 | 184 | ;; utf8-sampa map based on unitran 185 | (if (probe_file (path-append INST_pt_VOX::dir "festvox/INST_pt_VOX_char_phone_map.scm")) 186 | (begin 187 | (set! INST_pt_VOX_char_phone_map 188 | (load (path-append INST_pt_VOX::dir 189 | "festvox/INST_pt_VOX_char_phone_map.scm") t)) 190 | (load (path-append INST_pt_VOX::dir 191 | "festvox/unicode_sampa_mapping.scm")) 192 | 193 | ;; utf8-indic-sampa letter based one 194 | (define (INST_pt_lts_function word features) 195 | "(INST_pt_lts_function WORD FEATURES) 196 | Return pronunciation of word not in lexicon." 197 | (let ((dword (downcase word)) (phones) (syls) (aphones)) 198 | (if (boundp 'INST_pt_lts_rules) 199 | (set! phones (lts_predict (utf8explode dword) INST_pt_lts_rules)) 200 | (begin 201 | (set! aphones (INST_pt_map_modify (utf8explode dword))) 202 | (set! phones (INST_pt_map_phones aphones)) 203 | (set! phones (sampa_lookup phones)))) 204 | ; (set! phones (indic_unicode_lts sphones)) 205 | (set! syls (INST_pt_lex_syllabify_phstress phones)) 206 | (list word features syls))) 207 | )) 208 | 209 | (define (sampa_lookup gphones) 210 | (let ((phlist nil) (sp nil)) 211 | (mapcar 212 | (lambda (gg) 213 | (set! sp (assoc_string gg unicode_sampa_mapping)) 214 | (if sp 215 | (set! phlist (append (reverse (car (cadr sp))) phlist)) 216 | (set! phlist (cons gg phlist)))) 217 | gphones) 218 | (reverse phlist))) 219 | 220 | (define (indic_unicode_lts phlist) 221 | (set! finallist (list)) 222 | (set! graphemecount 0) 223 | (set! prevgrapheme (list)) 224 | (set! totgcnt (- (length phlist) 1)) 225 | (mapcar (lambda (ggg) 226 | (if (symbol? (car ggg)) 227 | (begin 228 | (cond 229 | ;; schwa deletion for the last consonant 230 | ((equal? graphemecount totgcnt) 231 | (begin 232 | (if (string-equal (phone_feature (car ggg) 'vc) "-") 233 | (begin 234 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") 235 | (set! finallist (append finallist prevgrapheme))) 236 | ;(set! finallist (append finallist (list (car ggg)))) ;appropriate for hindi 237 | (set! finallist (append finallist ggg)) ; for generic (non-schwa final) indic 238 | ) 239 | (begin 240 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") 241 | (set! finallist (append finallist (list (car prevgrapheme))))) 242 | (set! finallist (append finallist (list (car ggg)))) 243 | )) 244 | )) 245 | ;; generic treatment for an intermediate grapheme 246 | ((and (> graphemecount 0) (< graphemecount totgcnt)) 247 | (begin 248 | (cond 249 | ;; If current is vowel, remove the previous schwa 250 | ((and (string-equal (phone_feature (car ggg) 'vc) "+") (string-equal (phone_feature (car prevgrapheme) 'vc) "-")) 251 | (begin 252 | (set! finallist (append finallist (list (car prevgrapheme)))) 253 | (set! finallist (append finallist (list (car ggg)))) 254 | )) 255 | ;; If current is consonant and previous is consonant, dump all of previous 256 | ((and (string-equal (phone_feature (car ggg) 'vc) "-") (string-equal (phone_feature (car prevgrapheme) 'vc) "-")) 257 | (set! finallist (append finallist prevgrapheme))) 258 | (t 259 | t) 260 | ) 261 | )) 262 | ((and (eq? graphemecount 0) (string-equal (phone_feature (car ggg) 'vc) "+")) 263 | (set! finallist (list (car ggg))) 264 | ) 265 | (t 266 | t) 267 | ) 268 | (set! graphemecount (+ 1 graphemecount)) 269 | (set! prevgrapheme ggg) 270 | ) 271 | (begin 272 | (cond 273 | ((equal? (car ggg) '(P)) 274 | (set! finallist (append finallist (list (car prevgrapheme)))) 275 | (set! prevgrapheme (list)) 276 | ) 277 | ((equal? (car ggg) '(M)) 278 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") (set! finallist (append finallist prevgrapheme))) 279 | (set! finallist (append finallist (list "nB"))) 280 | (set! prevgrapheme (list)) 281 | ) 282 | ((equal? (car ggg) '(CD)) 283 | (if (string-equal (phone_feature (car prevgrapheme) 'vc) "-") (set! finallist (append finallist prevgrapheme))) 284 | (set! finallist (append finallist (list "nB"))) 285 | (set! prevgrapheme (list)) 286 | ) 287 | (t 288 | t) 289 | ;(format t "debug: todo \n") 290 | ) 291 | (set! graphemecount (+ 1 graphemecount)) 292 | ) 293 | ) 294 | ) phlist) 295 | finallist) 296 | 297 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 298 | ;;; 299 | ;;; OR: Hand written letter to sound rules 300 | ;;; 301 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 302 | 303 | ; ;;; Function called when word not found in lexicon 304 | ; (define (INST_pt_lts_function word features) 305 | ; "(INST_pt_lts_function WORD FEATURES) 306 | ; Return pronunciation of word not in lexicon." 307 | ; (format stderr "failed to find pronunciation for %s\n" word) 308 | ; (let ((dword (downcase word))) 309 | ; ;; Note you may need to use a letter to sound rule set to do 310 | ; ;; casing if the ptuage has non-ascii characters in it. 311 | ; (if (lts.in.alphabet word 'INST_pt) 312 | ; (list 313 | ; word 314 | ; features 315 | ; ;; This syllabification is almost certainly wrong for 316 | ; ;; this ptuage (its not even very good for English) 317 | ; ;; but it will give you something to start off with 318 | ; (lex.syllabify.phstress 319 | ; (lts.apply word 'INST_pt))) 320 | ; (begin 321 | ; (format stderr "unpronouncable word %s\n" word) 322 | ; ;; Put in a word that means "unknown" with its pronunciation 323 | ; '("nepoznat" nil (((N EH P) 0) ((AO Z) 0) ((N AA T) 0)))))) 324 | ; ) 325 | 326 | ; ;; You may or may not be able to write a letter to sound rule set for 327 | ; ;; your ptuage. If its largely lexicon based learning a rule 328 | ; ;; set will be better and easier that writing one (probably). 329 | ; (lts.ruleset 330 | ; INST_pt 331 | ; ( (Vowel WHATEVER) ) 332 | ; ( 333 | ; ;; LTS rules 334 | ; )) 335 | 336 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 337 | ;;; 338 | ;;; Postlexical Rules 339 | ;;; 340 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 341 | 342 | (define (INST_pt::postlex_rule1 utt) 343 | "(INST_pt::postlex_rule1 utt) 344 | A postlexical rule form correcting phenomena over word boundaries." 345 | (mapcar 346 | (lambda (s) 347 | ;; do something 348 | ) 349 | (utt.relation.items utt 'Segment)) 350 | utt) 351 | 352 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 353 | ;;; 354 | ;;; Lexicon definition 355 | ;;; 356 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 357 | 358 | (lex.create "INST_pt") 359 | (lex.set.phoneset "INST_pt") 360 | (lex.set.lts.method 'INST_pt_lts_function) 361 | (if (probe_file (path-append INST_pt_VOX::dir "festvox/INST_pt_lex.out")) 362 | (lex.set.compile.file (path-append INST_pt_VOX::dir 363 | "festvox/INST_pt_lex.out"))) 364 | (INST_pt_addenda) 365 | (if (probe_file (path-append INST_pt_VOX::dir "festvox/INST_pt_addenda.scm")) 366 | (load (path-append INST_pt_VOX::dir "festvox/INST_pt_addenda.scm"))) 367 | 368 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 369 | ;;; 370 | ;;; Lexicon setup 371 | ;;; 372 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 373 | 374 | (define (INST_pt_VOX::select_lexicon) 375 | "(INST_pt_VOX::select_lexicon) 376 | Set up the lexicon for INST_pt." 377 | (lex.select "INST_pt") 378 | 379 | ;; Post lexical rules 380 | (set! postlex_rules_hooks (list INST_pt::postlex_rule1)) 381 | ) 382 | 383 | (define (INST_pt_VOX::reset_lexicon) 384 | "(INST_pt_VOX::reset_lexicon) 385 | Reset lexicon information." 386 | t 387 | ) 388 | 389 | (provide 'INST_pt_VOX_lexicon) 390 | --------------------------------------------------------------------------------