Commit a244cf66c3b6b333fe018422d92a0853354dc6ba
1 parent
80da8535
Exists in
master
and in
1 other branch
Remove arquivo de chave (~) do pyTradutor
Showing
1 changed file
with
0 additions
and
57 deletions
Show diff stats
tradutor/src/pyTradutor.cpp~
| ... | ... | @@ -1,57 +0,0 @@ |
| 1 | -//***************************************************************** | |
| 2 | -/* | |
| 3 | - VLibras: Automatic contents translator from Portuguese to LIBRAS | |
| 4 | - | |
| 5 | - Copyright (c) 2015 Gustavo Sobral, Erickson Silva, Leonardo Araújo | |
| 6 | - VLibras-Core group at LAViD, Federal University of Paraiba | |
| 7 | -*/ | |
| 8 | -//***************************************************************** | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * \file pyTradutor.cpp | |
| 12 | - * \authors Erickson Silva, Gustavo Sobral | |
| 13 | - * \date Janeiro 2015 | |
| 14 | - */ | |
| 15 | - | |
| 16 | -#include "../include/pyTradutor.hpp" | |
| 17 | - | |
| 18 | -PyTradutor::PyTradutor() | |
| 19 | -{ | |
| 20 | - // Initialize the Python interpreter | |
| 21 | - Py_Initialize(); | |
| 22 | - // Type conversion between C++ string to Py string | |
| 23 | - pName = PyString_FromString("PortGlosa"); | |
| 24 | - assert(pName!=NULL); | |
| 25 | - // Loads the script name saved in 'pName' | |
| 26 | - pModule = PyImport_Import(pName); | |
| 27 | - PyErr_Print(); | |
| 28 | - assert(pModule!=NULL); | |
| 29 | - // Returns the dictionary object that implements the namespace pModule | |
| 30 | - pDict = PyModule_GetDict(pModule); | |
| 31 | - PyErr_Print(); | |
| 32 | - assert(pDict!=NULL); | |
| 33 | - // Return the object from dictionary pDict which has a key 'iniciar' | |
| 34 | - pFunc = PyDict_GetItemString(pDict, "traduzir"); | |
| 35 | - PyErr_Print(); | |
| 36 | - assert(pFunc!=NULL); | |
| 37 | -} | |
| 38 | - | |
| 39 | -PyTradutor::~PyTradutor() | |
| 40 | -{ | |
| 41 | - // Free the allocated memory and finalize the Python interpreter | |
| 42 | - Py_Finalize(); | |
| 43 | -} | |
| 44 | - | |
| 45 | -char * PyTradutor::convertStringToGlosa(const char * input) | |
| 46 | -{ | |
| 47 | - // Generates a new Tuple object with size '1' and value 'input' (converted) | |
| 48 | - pArgs = PyTuple_Pack(1, PyString_FromString(input)); | |
| 49 | - PyErr_Print(); | |
| 50 | - assert(pArgs!=NULL); | |
| 51 | - // Call the callable object 'pFunc' with arguments given by the tuple 'pArgs' | |
| 52 | - pResult = PyObject_CallObject(pFunc, pArgs); | |
| 53 | - PyErr_Print(); | |
| 54 | - assert(pResult!=NULL); | |
| 55 | - // Converts the string Python type to C++ | |
| 56 | - return PyString_AsString(pResult); | |
| 57 | -} |