From 7fa9dbbeade9ce040f047db4da1e5a49b36b5812 Mon Sep 17 00:00:00 2001 From: Erickson Silva Date: Tue, 24 Feb 2015 14:36:24 -0300 Subject: [PATCH] Corrige AplicaSinonimos (tipo de entrada única }) --- install/linux/aelius_install.sh | 57 --------------------------------------------------------- install/linux/translate_install.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/new/AplicaSinonimos.py | 6 +----- 3 files changed, 58 insertions(+), 62 deletions(-) delete mode 100755 install/linux/aelius_install.sh create mode 100755 install/linux/translate_install.sh diff --git a/install/linux/aelius_install.sh b/install/linux/aelius_install.sh deleted file mode 100755 index f3c8bfb..0000000 --- a/install/linux/aelius_install.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -read -r -p "Deseja fazer o download das dependências? [Y/n] " response - response=${response,,} # tolower - if [[ $response =~ ^(yes|y| ) ]]; then - mkdir ~/vlibras-libs - cd ~/vlibras-libs - - mkdir aelius - cd aelius - - wget 150.165.204.30:8080/translate/linux/aelius-install.tar.gz - - read -r -p "Deseja instalar as dependências? [Y/n] " response - response=${response,,} # tolower - if [[ $response =~ ^(yes|y| ) ]]; then - echo -e "\n# Extraindo...\n" - tar -xf aelius-install.tar.gz -C . - - echo -e "# Instalando dependências...\n" - sudo apt-get install -y python-dev python-setuptools python-yaml python-numpy python-matplotlib - sudo pip install nltk nltk_tgrep - - fi - - read -r -p "Deseja limpar os arquivos temporários? [Y/n] " response - response=${response,,} # tolower - if [[ $response =~ ^(yes|y| ) ]]; then - rm ~/vlibras-libs/aelius/aelius-install.tar.gz - fi - - fi - - -read -r -p "Deseja criar as variáveis de ambiente? [Y/n] " response - response=${response,,} # tolower - if [[ $response =~ ^(yes|y| ) ]]; then - # path to Hunpos Tag - echo -e "\nHUNPOS_TAGGER=\"$HOME/vlibras-libs/aelius/bin/hunpos-tag\"" >> ~/.bashrc - echo -e "export HUNPOS_TAGGER" >> ~/.bashrc - - # path to Aelius Data - echo -e "\nAELIUS_DATA=\"$HOME/vlibras-libs/aelius/aelius_data\"" >> ~/.bashrc - echo -e "export AELIUS_DATA" >> ~/.bashrc - - # path to NLTK Data - echo -e "\nNLTK_DATA=\"$HOME/vlibras-libs/aelius/nltk_data\"" >> ~/.bashrc - echo -e "export NLTK_DATA" >> ~/.bashrc - - # path to Aelius and Translate package (new version) - echo -e "\nPYTHONPATH=\"${PYTHONPATH}:$HOME/vlibras-libs/aelius:$HOME/vlibras-translate/src\"" >> ~/.bashrc - echo -e "export PYTHONPATH\n" >> ~/.bashrc - - echo -e "\n## Execute o seguinte comando para concluir:\n\n$ source ~/.bashrc\n" - fi - -echo -e "### Instalação finalizada!" \ No newline at end of file diff --git a/install/linux/translate_install.sh b/install/linux/translate_install.sh new file mode 100755 index 0000000..f3c8bfb --- /dev/null +++ b/install/linux/translate_install.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +read -r -p "Deseja fazer o download das dependências? [Y/n] " response + response=${response,,} # tolower + if [[ $response =~ ^(yes|y| ) ]]; then + mkdir ~/vlibras-libs + cd ~/vlibras-libs + + mkdir aelius + cd aelius + + wget 150.165.204.30:8080/translate/linux/aelius-install.tar.gz + + read -r -p "Deseja instalar as dependências? [Y/n] " response + response=${response,,} # tolower + if [[ $response =~ ^(yes|y| ) ]]; then + echo -e "\n# Extraindo...\n" + tar -xf aelius-install.tar.gz -C . + + echo -e "# Instalando dependências...\n" + sudo apt-get install -y python-dev python-setuptools python-yaml python-numpy python-matplotlib + sudo pip install nltk nltk_tgrep + + fi + + read -r -p "Deseja limpar os arquivos temporários? [Y/n] " response + response=${response,,} # tolower + if [[ $response =~ ^(yes|y| ) ]]; then + rm ~/vlibras-libs/aelius/aelius-install.tar.gz + fi + + fi + + +read -r -p "Deseja criar as variáveis de ambiente? [Y/n] " response + response=${response,,} # tolower + if [[ $response =~ ^(yes|y| ) ]]; then + # path to Hunpos Tag + echo -e "\nHUNPOS_TAGGER=\"$HOME/vlibras-libs/aelius/bin/hunpos-tag\"" >> ~/.bashrc + echo -e "export HUNPOS_TAGGER" >> ~/.bashrc + + # path to Aelius Data + echo -e "\nAELIUS_DATA=\"$HOME/vlibras-libs/aelius/aelius_data\"" >> ~/.bashrc + echo -e "export AELIUS_DATA" >> ~/.bashrc + + # path to NLTK Data + echo -e "\nNLTK_DATA=\"$HOME/vlibras-libs/aelius/nltk_data\"" >> ~/.bashrc + echo -e "export NLTK_DATA" >> ~/.bashrc + + # path to Aelius and Translate package (new version) + echo -e "\nPYTHONPATH=\"${PYTHONPATH}:$HOME/vlibras-libs/aelius:$HOME/vlibras-translate/src\"" >> ~/.bashrc + echo -e "export PYTHONPATH\n" >> ~/.bashrc + + echo -e "\n## Execute o seguinte comando para concluir:\n\n$ source ~/.bashrc\n" + fi + +echo -e "### Instalação finalizada!" \ No newline at end of file diff --git a/src/new/AplicaSinonimos.py b/src/new/AplicaSinonimos.py index aa7b198..f2f1030 100644 --- a/src/new/AplicaSinonimos.py +++ b/src/new/AplicaSinonimos.py @@ -19,12 +19,8 @@ class AplicaSinonimos(object): self.dicionarios = LerDicionarios() # Itera sobre os tokens obtendo os sinonimos - def aplicar_sinonimos(self, analise): - lista_anotada = analise + def aplicar_sinonimos(self, lista_anotada): lista_corrigida = [] - if type(analise) is not list: - lista_anotada = Tree.leaves(analise) - for tupla in lista_anotada: sinonimo = self.verificar_sinonimo(tupla[0]) lista_corrigida.append(sinonimo) -- libgit2 0.21.2