|
Mostrar Mensajes
|
Páginas: 1 2 3 [4] 5 6 7 8
|
31
|
Programación / Scripting / Re: [PYTHON] Reconocimiento de voz
|
en: 30 Septiembre 2017, 21:08 pm
|
fijate que a la linea de reconocedor de google le agregué el parametro lenguaje y le puse es-ES que corresponde a español-España, si vas a usar otro lenguaje o un acento diferente al español (ej peruano) tienes que cambiarle el parametro (ej es-PE)
Muchisimas graciaaaaas ya me lo reconoce en castellano y ahora ya no confunde palabras con el ingles xD Ahora lo he entendido todo, muchisimas gracias
|
|
|
33
|
Programación / Scripting / [PYTHON] Reconocimiento de voz
|
en: 30 Septiembre 2017, 18:40 pm
|
Hola buenas, estoy trabajando con reconocimiento de voz en python y el codigo de el modulo es este: import speech_recognition as sr def callback(recognizer, audio): # received audio data, now we'll recognize it using Google Speech Recognition try: # for testing purposes, we're just using the default API key # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")` # instead of `r.recognize_google(audio)` texto = recognizer.recognize_google(audio) #print("Has dicho, " + texto) s.send(texto.encode()) except sr.UnknownValueError: #print('No entiendo.') s.send(b"No entiendo.") except sr.RequestError as e: print("Could not request results from Google Speech Recognition service; {0}".format(e)) #s.send("No se reciben datos del servicio de reconocimiento de voz.") #s.close() r = sr.Recognizer() m = sr.Microphone() with m as source: r.adjust_for_ambient_noise(source) # we only need to calibrate once, before we start listening # start listening in the background (note that we don't have to do this inside a `with` statement) stop_listening = r.listen_in_background(m, callback) # `stop_listening` is now a function that, when called, stops background listening
Vale, me va bien y todo eso tengo todo instalado y lo uso, pero el problema es que como la API es de Google y esta en ingles, al decir por ejeplo : Abreme el calendario, reconoce que digo :rudimental in Mario o let me get ice cuando le digo: dime que hora es Hay alguna solcion para esto? (Para que me lo reconozca bien y en español)
|
|
|
34
|
Programación / Scripting / Libros IA python 3
|
en: 5 Septiembre 2017, 19:30 pm
|
Hola!! Me gustaria saber si alguno de vosotros conoce algun libro sobre la IA en Python 3
Si alguno conoce alguno, me podria dejar por aqui el link?..
Gracias!!! Saludos!!!
|
|
|
35
|
Programación / Scripting / Re: [PYTHON] ChatBot que aprende
|
en: 4 Septiembre 2017, 16:50 pm
|
He encontrado este codigo por hay, pero no da respuestas logicas y no aprende muy bien que digamos import re import sqlite3 from collections import Counter from string import punctuation from math import sqrt # initialize the connection to the database connection = sqlite3.connect('chatbot.sqlite') cursor = connection.cursor() # create the tables needed by the program create_table_request_list = [ 'CREATE TABLE words(word TEXT UNIQUE)', 'CREATE TABLE sentences(sentence TEXT UNIQUE, used INT NOT NULL DEFAULT 0)', 'CREATE TABLE associations (word_id INT NOT NULL, sentence_id INT NOT NULL, weight REAL NOT NULL)', ] for create_table_request in create_table_request_list: try: cursor.execute(create_table_request) except: pass def get_id(entityName, text): """Retrieve an entity's unique ID from the database, given its associated text. If the row is not already present, it is inserted. The entity can either be a sentence or a word.""" tableName = entityName + 's' columnName = entityName cursor.execute('SELECT rowid FROM ' + tableName + ' WHERE ' + columnName + ' = ?', (text,)) row = cursor.fetchone() if row: return row[0] else: cursor.execute('INSERT INTO ' + tableName + ' (' + columnName + ') VALUES (?)', (text,)) return cursor.lastrowid def get_words(text): """Retrieve the words present in a given string of text. The return value is a list of tuples where the first member is a lowercase word, and the second member the number of time it is present in the text.""" wordsRegexpString = '(?:\w+|[' + re.escape(punctuation) + ']+)' wordsRegexp = re.compile(wordsRegexpString) wordsList = wordsRegexp.findall(text.lower()) return Counter(wordsList).items() B = 'Hello!' while True: # output bot's message print('B: ' + B) # ask for user input; if blank line, exit the loop H = raw_input('H: ').strip() if H == '': break # store the association between the bot's message words and the user's response words = get_words(B) words_length = sum([n * len(word) for word, n in words]) sentence_id = get_id('sentence', H) for word, n in words: word_id = get_id('word', word) weight = sqrt(n / float(words_length)) cursor.execute('INSERT INTO associations VALUES (?, ?, ?)', (word_id, sentence_id, weight)) connection.commit() # retrieve the most likely answer from the database cursor.execute('CREATE TEMPORARY TABLE results(sentence_id INT, sentence TEXT, weight REAL)') words = get_words(H) words_length = sum([n * len(word) for word, n in words]) for word, n in words: weight = sqrt(n / float(words_length)) cursor.execute('INSERT INTO results SELECT associations.sentence_id, sentences.sentence, ?*associations.weight/(4+sentences.used) FROM words INNER JOIN associations ON associations.word_id=words.rowid INNER JOIN sentences ON sentences.rowid=associations.sentence_id WHERE words.word=?', (weight, word,)) # if matches were found, give the best one cursor.execute('SELECT sentence_id, sentence, SUM(weight) AS sum_weight FROM results GROUP BY sentence_id ORDER BY sum_weight DESC LIMIT 1') row = cursor.fetchone() cursor.execute('DROP TABLE results') # otherwise, just randomly pick one of the least used sentences if row is None: cursor.execute('SELECT rowid, sentence FROM sentences WHERE used = (SELECT MIN(used) FROM sentences) ORDER BY RANDOM() LIMIT 1') row = cursor.fetchone() # tell the database the sentence has been used once more, and prepare the sentence B = row[1] cursor.execute('UPDATE sentences SET used=used+1 WHERE rowid=?', (row[0],))
CREDITOS:https://rodic.fr/blog/python-chatbot-1/
|
|
|
36
|
Foros Generales / Foro Libre / Re: Exmilitar de EEUU: Tenemos una cárcel secreta para extraterrestres
|
en: 3 Septiembre 2017, 21:06 pm
|
Un consejo gratuito: no se le debería aportar ni un ápice de creedibilidad a aquél individuo que diga haber visto algo y lo primero que hace es sacar un libro ( unos ejemplos serían: J.J. Benitez, David Icke, J.L, y ex-militares... ). En mi opinión ese tipo de actos donde predomina un obvio interés económico hace que estos individuos pierdan toda creedibilidad (si es que había alguna), y si alguien de nosotros por ingenuidad cae en el error de entregarle confianza a alguien así, y luego nos llega la noticia de que ese individuo piensa sacar un libro, o peor, salir en programas de la TV o en la radio (pero cobrando. de lo contrario no pasa nada)... entonces hay que admitir el error y dejar de seguir entregándole confianza a ese individuo. Y ya ni te cuento de los individuos que sacan libro tras libro tras libro... como para montarse una estantería y poder llenarla solo con los libros de ese "iluminado" ( como sería el ejemplo del señor David Icke con sus más de 12 libros de supuesto conocimiento Illuminati y de reptilianos y más mierd@s... )
Saludos!
Estoy completamente de acuerdo con Elektro
|
|
|
38
|
Programación / Scripting / [PYTHON] ChatBot que aprende
|
en: 3 Septiembre 2017, 14:36 pm
|
Hola buenas!! Estoy intentando hacer un chat bot en Python en el que tu le dices algo y te contesta "inteligentemente" (Se que eso es IA pero esque noo tengo ni idea de como programarla ) Por ejemplo: Yo Hola Bot Hola Yo cuanto tiempo bot (respuesta)
y mantener una conversacion "fluida" todo lo posible, tengo una parte hecha pero...alguien sabria como hacerlo aunque sea unas pocas lineas y yo lo sigo? Gracias!!
|
|
|
39
|
Programación / Scripting / Re: Duda - Una funcion para limpiar la pantalla en Python
|
en: 1 Agosto 2017, 11:35 am
|
pues vas a tener que implementar una función que detecte el sistema operativo, ya que no hay una sola función para todos los sitemas. basicamente: windows: import os os.system('cls')
linux: os.system('clear')
en otos sistemas no tengo la menor idea, te toca buscar lo que falta. Trabajo con Python 3 en mac y ese exactamente la misma que en windows. Saludos
|
|
|
40
|
Seguridad Informática / Hacking / Re: Recuperar una cuenta gmail
|
en: 31 Julio 2017, 22:02 pm
|
hay algo raro en lo que cuentas,
si tienes asociada la cuenta con el movil, no hay forma de que puedan cambiarla sin pedir confirmación via movil,
ahora si perdiste el número telefonico y no tienes forma de acceder a él para poder hacer la verificación de 2 pasos de gmail entonces, ya no hay nada que hacer.
No esque haya algo raro, esque ya ha hecho 2 post casi iguales y seguramente quiera conseguir la cuenta de otra persona...
|
|
|
|
|
|
|