|
11 | 11 | from email.mime.text import MIMEText
|
12 | 12 | from unicodedata import normalize
|
13 | 13 |
|
14 |
| -#'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' |
15 |
| -arrayLetras = ('z') |
| 14 | +# |
| 15 | +# Executadas - 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w' |
| 16 | +arrayLetras = ('x','y','z') |
16 | 17 |
|
17 | 18 | def enviaEmail(texto):
|
18 | 19 |
|
@@ -41,7 +42,6 @@ def remover_acentos(txt, codif='utf-8'):
|
41 | 42 | return normalize('NFKD', txt.decode(codif)).encode('ASCII','ignore')
|
42 | 43 |
|
43 | 44 | def usarReplace(palavra):
|
44 |
| - #palavra = palavra.replace('não', '').replace('para ', '').replace('eu','').replace('voc','').replace(' ele/ela','').replace('vocs','').replace('tu','').replace('vs','').replace('no','').replace('ns','').replace('eles/elas','').replace('ele/ela','').replace(' s','').replace(' ','').replace('ês', '').replace('vós', '').replace('nós', '') |
45 | 45 | pattern = re.compile('[ / ]([ a-zà-ú]+)$')
|
46 | 46 | palavra_new = re.sub(pattern, '', palavra)
|
47 | 47 | pattern = re.compile('(ê)$')
|
@@ -149,41 +149,42 @@ def getVerbosConjugados(listaVerbos):
|
149 | 149 | soup = getConvertObjectSoup('http://www.conjuga-me.net/verbo-'+verbo, 'iso8859-1')
|
150 | 150 |
|
151 | 151 | for s in soup.find_all('td', attrs = { 'class' : 'output'}):
|
152 |
| - if s.text and s.text != None and s.text != '' and s.text != '\t' and s.text != '\n' and s.text != ' ' and s.text != '–' and s.text != ' - ': |
153 |
| - palavra = usarReplace(s.text.encode('utf-8')) |
154 |
| - cursor.execute('select id_verbos from verbos where nome = "'+ verbo.strip() +'"') |
155 |
| - if palavra and re.search('[a-zA-Z]', palavra): |
156 |
| - id_verbo = cursor.fetchone() |
157 |
| - if count[0] == 10 and count_valida in valida: |
158 |
| - print 'id_verbo: '+ str(id_verbo[0]) + ' - ' + palavra |
159 |
| - sql = 'insert into conjulgacao_verbal (nome_conjulgacao, id_tempo_verbal, id_verbo) value (%s, %s, %s)' |
160 |
| - db.commit() |
161 |
| - cursor.execute(sql, (palavra, count[num], id_verbo[0])) |
162 |
| - if count[0] != 10: |
163 |
| - print 'id_verbo: '+ str(id_verbo[0]) + ' - ' + palavra |
164 |
| - sql = 'insert into conjulgacao_verbal (nome_conjulgacao, id_tempo_verbal, id_verbo) value (%s, %s, %s)' |
165 |
| - db.commit() |
166 |
| - cursor.execute(sql, (palavra, count[num], id_verbo[0])) |
167 |
| - |
168 |
| - |
169 |
| - num += 1 |
170 |
| - if num == 3: |
171 |
| - num = 0 |
172 |
| - contador += 1 |
173 |
| - if contador == 18: |
174 |
| - count = [4, 6, 5] |
175 |
| - if contador == 36: |
176 |
| - count = [7, 9, 8] |
177 |
| - if contador == 54: |
178 |
| - count = [10, 10, 10] |
179 |
| - if contador == 72: |
180 |
| - contador = 0 |
181 |
| - count = [1, 3, 2] |
182 |
| - |
183 |
| - if count[0] == 10 and count[1] == 10 and count[2] == 10: |
184 |
| - count_valida += 1 |
185 |
| - if count_valida == 18: |
186 |
| - count_valida = 0 |
| 152 | + #if s.text and s.text != None and s.text != '' and s.text != '\t' and s.text != '\n' and s.text != ' ' and s.text != '–' and s.text != ' - ': |
| 153 | + palavra = usarReplace(s.text.encode('utf-8')) |
| 154 | + cursor.execute('select id_verbos from verbos where nome = "'+ verbo.strip() +'"') |
| 155 | + #if palavra and re.search('[a-zA-Z]', palavra): |
| 156 | + #if re.search('[a-zA-Z\s]', palavra): |
| 157 | + id_verbo = cursor.fetchone() |
| 158 | + if count[0] == 10 and count_valida in valida: |
| 159 | + print 'id_verbo: '+ str(id_verbo[0]) + ' - ' + palavra |
| 160 | + sql = 'insert into conjulgacao_verbal (nome_conjulgacao, id_tempo_verbal, id_verbo) value (%s, %s, %s)' |
| 161 | + db.commit() |
| 162 | + cursor.execute(sql, (palavra, count[num], id_verbo[0])) |
| 163 | + if count[0] != 10: |
| 164 | + print 'id_verbo: '+ str(id_verbo[0]) + ' - ' + palavra |
| 165 | + sql = 'insert into conjulgacao_verbal (nome_conjulgacao, id_tempo_verbal, id_verbo) value (%s, %s, %s)' |
| 166 | + db.commit() |
| 167 | + cursor.execute(sql, (palavra, count[num], id_verbo[0])) |
| 168 | + |
| 169 | + |
| 170 | + num += 1 |
| 171 | + if num == 3: |
| 172 | + num = 0 |
| 173 | + contador += 1 |
| 174 | + if contador == 18: |
| 175 | + count = [4, 6, 5] |
| 176 | + if contador == 36: |
| 177 | + count = [7, 9, 8] |
| 178 | + if contador == 54: |
| 179 | + count = [10, 10, 10] |
| 180 | + if contador == 72: |
| 181 | + contador = 0 |
| 182 | + count = [1, 3, 2] |
| 183 | + |
| 184 | + if count[0] == 10 and count[1] == 10 and count[2] == 10: |
| 185 | + count_valida += 1 |
| 186 | + if count_valida == 18: |
| 187 | + count_valida = 0 |
187 | 188 |
|
188 | 189 |
|
189 | 190 | cursor.close()
|
|
0 commit comments