-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (26 loc) · 878 Bytes
/
main.py
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
import requests
import random
# Making input version agnostic
try:
input = raw_input
except NameError:
pass
# Generates a question and a response based on a given word
# TODO recognition of gender | tell a little small talk introduction
def gen(word):
resp = input("Conhece o(a) %s? (S/N) " % word)
if resp in ['S', 's']:
print(':(')
elif resp in ['N', 'n']:
print("Que " + find_expr(word))
# Match an given word to an expression which rhymes
# TODO map person names to things names (dictionary API? http://www.dicionario-aberto.net/estaticos/api.html )
def find_expr(word):
URI = 'https://api.dicionario-aberto.net/suffix/%s?like=%s' % (word[-4:], word.lower())
r = requests.get(URI)
l = r.json()
random.shuffle(l)
return 'encheu seu cu de ' + l[0]['word']
# x = raw_input('Digite um nome: ')
# gen(x)
gen('Aguinaldo')