Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,8 +128,14 @@ def consultar_ddgp(termo):
|
|
| 128 |
if res: html += res
|
| 129 |
return html
|
| 130 |
|
|
|
|
|
|
|
|
|
|
| 131 |
def analisar_texto(texto):
|
|
|
|
| 132 |
if not texto: return None, None, "0", "0", "0", "0", "0", ""
|
|
|
|
|
|
|
| 133 |
doc = nlp(texto)
|
| 134 |
dados = []
|
| 135 |
lexico_html = ""
|
|
@@ -140,13 +146,21 @@ def analisar_texto(texto):
|
|
| 140 |
l_norm = normalizar_grego(l_orig)
|
| 141 |
pos_pt = TAG_MAP.get(token.pos_, token.pos_)
|
| 142 |
|
|
|
|
|
|
|
|
|
|
| 143 |
if token.pos_ not in ['PUNCT', 'SYM', 'SPACE'] and l_norm not in lemas_vistos:
|
| 144 |
res = consultar_ddgp(l_norm)
|
| 145 |
if "não localizado" not in res:
|
| 146 |
lexico_html += res
|
| 147 |
lemas_vistos.add(l_norm)
|
| 148 |
|
| 149 |
-
dados.append({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
df = pd.DataFrame(dados)
|
| 152 |
|
|
|
|
| 128 |
if res: html += res
|
| 129 |
return html
|
| 130 |
|
| 131 |
+
# Adicione esta variável global no topo do arquivo (abaixo dos imports)
|
| 132 |
+
CONSULTAS_CONTADOR = 0
|
| 133 |
+
|
| 134 |
def analisar_texto(texto):
|
| 135 |
+
global CONSULTAS_CONTADOR
|
| 136 |
if not texto: return None, None, "0", "0", "0", "0", "0", ""
|
| 137 |
+
|
| 138 |
+
CONSULTAS_CONTADOR += 1 # Incrementa o contador da sessão
|
| 139 |
doc = nlp(texto)
|
| 140 |
dados = []
|
| 141 |
lexico_html = ""
|
|
|
|
| 146 |
l_norm = normalizar_grego(l_orig)
|
| 147 |
pos_pt = TAG_MAP.get(token.pos_, token.pos_)
|
| 148 |
|
| 149 |
+
# Extração da Morfologia detalhada
|
| 150 |
+
morph_raw = str(token.morph) if str(token.morph) else "-"
|
| 151 |
+
|
| 152 |
if token.pos_ not in ['PUNCT', 'SYM', 'SPACE'] and l_norm not in lemas_vistos:
|
| 153 |
res = consultar_ddgp(l_norm)
|
| 154 |
if "não localizado" not in res:
|
| 155 |
lexico_html += res
|
| 156 |
lemas_vistos.add(l_norm)
|
| 157 |
|
| 158 |
+
dados.append({
|
| 159 |
+
'Palavra': token.text,
|
| 160 |
+
'Lema': l_orig,
|
| 161 |
+
'Classe': pos_pt,
|
| 162 |
+
'Análise Morfológica': morph_raw # NOVA COLUNA
|
| 163 |
+
})
|
| 164 |
|
| 165 |
df = pd.DataFrame(dados)
|
| 166 |
|