Commit ·
8cc92c2
1
Parent(s): 54ea372
First commit
Browse files- .gitattributes +1 -0
- app.py +139 -0
- busca.html +0 -0
- contato.html +6 -0
- index.html +49 -0
- publicacoes.html +28 -0
- style.css +51 -0
- verbnetbr.db +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.db filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import sqlite3
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
DB = "verbnetbr.db"
|
| 6 |
+
|
| 7 |
+
# --- Estilos CSS Customizados ---
|
| 8 |
+
css = """
|
| 9 |
+
.top-header { background-color: #f8f9fa; border-bottom: 1px solid #dee2e6; }
|
| 10 |
+
.site-title { font-weight: bold; color: #114278; margin: 0; }
|
| 11 |
+
.content-area { padding: 30px 10px; min-height: 400px; font-family: Arial, sans-serif; }
|
| 12 |
+
.alphabet-btn { min-width: 35px !important; margin: 2px !important; }
|
| 13 |
+
.search-container { background-color: #f0f4f8; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #d1d9e0; }
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
# --- Funções de Base de Dados ---
|
| 17 |
+
|
| 18 |
+
def buscar_por_texto(termo):
|
| 19 |
+
if not termo or len(termo.strip()) < 2:
|
| 20 |
+
return [["Aviso", "Digite pelo menos 2 caracteres para buscar."]]
|
| 21 |
+
|
| 22 |
+
con = sqlite3.connect(DB)
|
| 23 |
+
cur = con.cursor()
|
| 24 |
+
# Busca por parte do verbo OU parte da classe
|
| 25 |
+
query = """
|
| 26 |
+
SELECT verbo, classe FROM candidatos
|
| 27 |
+
WHERE (verbo LIKE ? OR classe LIKE ?) AND exp1=1
|
| 28 |
+
ORDER BY verbo
|
| 29 |
+
"""
|
| 30 |
+
cur.execute(query, (f'%{termo}%', f'%{termo}%'))
|
| 31 |
+
rows = cur.fetchall()
|
| 32 |
+
con.close()
|
| 33 |
+
return [list(r) for r in rows] if rows else [["-", "Nenhum resultado encontrado"]]
|
| 34 |
+
|
| 35 |
+
def buscar_por_letra(letra):
|
| 36 |
+
con = sqlite3.connect(DB)
|
| 37 |
+
cur = con.cursor()
|
| 38 |
+
cur.execute("SELECT verbo, classe FROM candidatos WHERE verbo LIKE ? AND exp1=1 ORDER BY verbo", (letra+'%',))
|
| 39 |
+
rows = cur.fetchall()
|
| 40 |
+
con.close()
|
| 41 |
+
return [list(r) for r in rows]
|
| 42 |
+
|
| 43 |
+
def buscar_todas_classes():
|
| 44 |
+
con = sqlite3.connect(DB)
|
| 45 |
+
cur = con.cursor()
|
| 46 |
+
cur.execute("SELECT DISTINCT classe FROM candidatos WHERE exp1=1 ORDER BY classe")
|
| 47 |
+
rows = cur.fetchall()
|
| 48 |
+
con.close()
|
| 49 |
+
return [["-", r[0]] for r in rows]
|
| 50 |
+
|
| 51 |
+
def buscar_detalhes(evt: gr.SelectData):
|
| 52 |
+
classe = evt.value
|
| 53 |
+
if classe in ["-", "Nenhum resultado encontrado", "Aviso"]: return ""
|
| 54 |
+
|
| 55 |
+
con = sqlite3.connect(DB)
|
| 56 |
+
cur = con.cursor()
|
| 57 |
+
cur.execute("SELECT verbo FROM candidatos WHERE classe = ? AND exp1=1", (classe,))
|
| 58 |
+
verbos = [r[0] for r in cur.fetchall()]
|
| 59 |
+
cur.execute("SELECT papel FROM papeis WHERE classe = ?", (classe,))
|
| 60 |
+
papeis = [r[0] for r in cur.fetchall()]
|
| 61 |
+
cur.execute("SELECT alternancia, pingles, singles FROM classes WHERE classe = ?", (classe,))
|
| 62 |
+
frames_rows = cur.fetchall()
|
| 63 |
+
con.close()
|
| 64 |
+
|
| 65 |
+
html = f"""
|
| 66 |
+
<div style='margin-top: 30px; border-top: 2px solid #114278; padding-top: 20px;'>
|
| 67 |
+
<center><h2 style="color: #114278;">{classe}</h2></center>
|
| 68 |
+
<b>Classe na VerbNet:</b> <a href="http://verbs.colorado.edu/verb-index/vn/{classe}.php" target="_blank">{classe}</a><br><br>
|
| 69 |
+
<b>Papéis Temáticos:</b> {" ".join(papeis)}<br><br>
|
| 70 |
+
<b>Membros:</b> {", ".join(verbos)}<br><br>
|
| 71 |
+
<table style='width:100%; border-collapse: collapse;'>
|
| 72 |
+
<tr style='color: white; background-color: #114278;'>
|
| 73 |
+
<th style='padding: 10px; text-align: left;'>VerbNet.Br</th>
|
| 74 |
+
<th style='width: 5%; background-color: white;'></th>
|
| 75 |
+
<th style='padding: 10px; text-align: left;'>VerbNet</th>
|
| 76 |
+
</tr>
|
| 77 |
+
"""
|
| 78 |
+
for alt, ping, sing in frames_rows:
|
| 79 |
+
html += f"<tr><td style='padding:10px; border-bottom:1px solid #ddd;'>{alt}</td><td></td><td style='padding:10px; border-bottom:1px solid #ddd;'>{ping} - {sing}</td></tr>"
|
| 80 |
+
html += "</table></div>"
|
| 81 |
+
return html
|
| 82 |
+
|
| 83 |
+
def carregar_html(nome_arquivo):
|
| 84 |
+
if os.path.exists(nome_arquivo):
|
| 85 |
+
with open(nome_arquivo, "r", encoding="utf-8") as f:
|
| 86 |
+
return f.read()
|
| 87 |
+
return f"<p>Arquivo {nome_arquivo} não encontrado.</p>"
|
| 88 |
+
|
| 89 |
+
# --- Interface Gradio ---
|
| 90 |
+
|
| 91 |
+
with gr.Blocks(css=css, head='<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">') as demo:
|
| 92 |
+
|
| 93 |
+
gr.HTML('<header class="top-header py-4"><div class="container"><h1 class="site-title">VerbNet.Br 1.0</h1></div></header>')
|
| 94 |
+
|
| 95 |
+
with gr.Tabs():
|
| 96 |
+
with gr.TabItem("Home"):
|
| 97 |
+
gr.HTML(carregar_html("index.html"))
|
| 98 |
+
|
| 99 |
+
with gr.TabItem("Busca"):
|
| 100 |
+
with gr.Column(elem_classes="container content-area"):
|
| 101 |
+
|
| 102 |
+
# --- NOVO: Campo de busca por texto (idêntico à imagem) ---
|
| 103 |
+
with gr.Column(elem_classes="search-container"):
|
| 104 |
+
gr.HTML('<h3 style="margin-bottom:15px; font-size: 1.2rem; color: #2d5a27;">Digite parte de um verbo ou de uma classe da VerbNet.Br:</h3>')
|
| 105 |
+
with gr.Row():
|
| 106 |
+
input_texto = gr.Textbox(show_label=False, placeholder="Ex: correr, consider...", scale=4)
|
| 107 |
+
btn_buscar = gr.Button("Buscar", variant="primary", scale=1)
|
| 108 |
+
|
| 109 |
+
# Botões de Letras
|
| 110 |
+
gr.HTML('<p style="margin-bottom:5px;">Ou selecione pela letra inicial do verbo:</p>')
|
| 111 |
+
with gr.Row():
|
| 112 |
+
letras = "ABCDEFGHILMNOPQRSTUVXZ"
|
| 113 |
+
btns_alfabeto = [gr.Button(l, elem_classes="alphabet-btn", min_width=35) for l in letras]
|
| 114 |
+
|
| 115 |
+
btn_todas = gr.Button("Ver Todas as Classes da VerbNet.Br", variant="secondary")
|
| 116 |
+
|
| 117 |
+
saida_letra = gr.Dataframe(headers=["Verbo", "Classe"], interactive=False)
|
| 118 |
+
saida_classe = gr.HTML()
|
| 119 |
+
|
| 120 |
+
with gr.TabItem("Publicações"):
|
| 121 |
+
gr.HTML(carregar_html("publicacoes.html"))
|
| 122 |
+
|
| 123 |
+
with gr.TabItem("Contato"):
|
| 124 |
+
gr.HTML(carregar_html("contato.html"))
|
| 125 |
+
|
| 126 |
+
# --- Eventos ---
|
| 127 |
+
# Busca por texto (Enter ou Botão)
|
| 128 |
+
btn_buscar.click(fn=buscar_por_texto, inputs=input_texto, outputs=saida_letra)
|
| 129 |
+
input_texto.submit(fn=buscar_por_texto, inputs=input_texto, outputs=saida_letra)
|
| 130 |
+
|
| 131 |
+
# Letras e Ver Todas
|
| 132 |
+
for btn, letra in zip(btns_alfabeto, letras):
|
| 133 |
+
btn.click(fn=lambda l=letra: buscar_por_letra(l), outputs=saida_letra)
|
| 134 |
+
|
| 135 |
+
btn_todas.click(fn=buscar_todas_classes, outputs=saida_letra)
|
| 136 |
+
saida_letra.select(fn=buscar_detalhes, outputs=saida_classe)
|
| 137 |
+
|
| 138 |
+
if __name__ == "__main__":
|
| 139 |
+
demo.launch()
|
busca.html
ADDED
|
File without changes
|
contato.html
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="container my-5 content-area">
|
| 2 |
+
<h2>Contatos</h2>
|
| 3 |
+
<ul>
|
| 4 |
+
<li>Carolina Scarton - ICMC/USP: carol at icmc usp br - <a href="http://lattes.cnpq.br/3421026578721604" target="_blank">Curriculum Lattes</a></li>
|
| 5 |
+
</ul>
|
| 6 |
+
</div>
|
index.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="container my-5 content-area">
|
| 2 |
+
<h2>Bem-vindo à VerbNet.Br 1.0</h2>
|
| 3 |
+
|
| 4 |
+
<p>
|
| 5 |
+
Neste site, é possível consultar a primeira versão da VerbNet.Br (VerbNet.Br 1.0).
|
| 6 |
+
Este recurso, baseado na VerbNet do inglês, contém informações sobre a interface
|
| 7 |
+
sintático-semântica dos verbos do português do Brasil.
|
| 8 |
+
</p>
|
| 9 |
+
|
| 10 |
+
<p>
|
| 11 |
+
A VerbNet.Br foi construída semiautomaticamente, a partir dos mapeamentos entre a
|
| 12 |
+
VerbNet e a WordNet de Princeton e dos alinhamentos entre a WordNet e a WordNet.Br.
|
| 13 |
+
A VerbNet.Br 1.0 contém 202 classes, 1.766 lemas de verbos e 4.333 sentidos de verbos.
|
| 14 |
+
</p>
|
| 15 |
+
|
| 16 |
+
<p>
|
| 17 |
+
Nesta primeira versão, é possível consultar, para cada classe, os membros selecionados
|
| 18 |
+
pelo método semiautomático, os papéis temáticos e os frames sintáticos definidos manualmente.
|
| 19 |
+
</p>
|
| 20 |
+
|
| 21 |
+
<h4>Formas de busca</h4>
|
| 22 |
+
<ul>
|
| 23 |
+
<li>
|
| 24 |
+
<strong>Glossário:</strong> seleciona-se uma letra e todos os verbos iniciados com
|
| 25 |
+
esta letra são recuperados.
|
| 26 |
+
</li>
|
| 27 |
+
<li>
|
| 28 |
+
<strong>Busca simples:</strong> digita-se parte do início de um verbo ou de uma classe.
|
| 29 |
+
</li>
|
| 30 |
+
<li>
|
| 31 |
+
<strong>Lista de classes:</strong> consulta a lista completa das 202 classes da VerbNet.Br.
|
| 32 |
+
</li>
|
| 33 |
+
</ul>
|
| 34 |
+
|
| 35 |
+
<p>
|
| 36 |
+
Mais informações podem ser encontradas no
|
| 37 |
+
<a href="#">Portal de Recursos Léxicos do Português (PortLex)</a>
|
| 38 |
+
ou no menu <a href="#">Publicações</a>.
|
| 39 |
+
</p>
|
| 40 |
+
|
| 41 |
+
<h4>Referências</h4>
|
| 42 |
+
<ol>
|
| 43 |
+
<li>Kipper, K. (2005). <em>VerbNet: A broad-coverage, comprehensive verb lexicon.</em></li>
|
| 44 |
+
<li>Levin, B. (1993). <em>English Verb Classes and Alternations.</em></li>
|
| 45 |
+
<li>Fellbaum, C. (1998). <em>WordNet: An electronic lexical database.</em></li>
|
| 46 |
+
<li>Dias-da-Silva et al. (2008). Automatic mapping of WordNet relations.</li>
|
| 47 |
+
</ol>
|
| 48 |
+
</div>
|
| 49 |
+
|
publicacoes.html
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="container my-5 content-area">
|
| 2 |
+
<h2>
|
| 3 |
+
Publicações
|
| 4 |
+
</h2>
|
| 5 |
+
<p>
|
| 6 |
+
<ul>
|
| 7 |
+
|
| 8 |
+
<li>Scarton, C. e Aluisio, S. (2012): Towards a cross-linguistic VerbNet-style lexicon to Brazilian Portuguese. In Proceedings of the LREC 2012 Workshop on Creating Cross-language Resources for Disconnected Languages and Styles (CREDISLAS 2012). Istambul, Turquia, pp 11-18. [<a href="http://www-lium.univ-lemans.fr/credislas2012/26.Credislas-Proceedings.pdf" target="_blank">PDF</a>] </br>
|
| 9 |
+
|
| 10 |
+
<li>Zilio, L., Zanette, A. e Scarton, C. (2012): Extração Automática de Estruturas de Subcategorização a partir de corpora em português. Nos Anais do XI Encontro de Linguística de Corpus (ELC 2012). São Carlos-SP, Brasil. [<a href="http://caravelas.icmc.usp.br/elc-ebralc2012/anais/completos/104022.pdf" target="_blank">PDF</a>]</br>
|
| 11 |
+
|
| 12 |
+
<li>Zanette, A., Scarton, C. e Zilio, L. (2012): Automatic extraction of subcategorization frames from corpora: an approach to Portuguese. In Demonstration Session of the International Conference on Computational Processing of Portuguese Language (PROPOR 2012). Coimbra, Portugual. [<a href="http://www.propor2012.org/demos/DemoSubcategorization.pdf" target="_blank">PDF</a>]</br>
|
| 13 |
+
|
| 14 |
+
<li> Scarton, C. E. e Aluísio, S. M. (2011): VerbNet.Br: construção semiautomática de um léxico verbal online e independente de domínio para o português do Brasil. Caderno de Resumos do X Encontro de Linguística de Corpus (ELC 2011). Belo Horizonte - MG, Brasil. [<a href="http://www.letras.ufmg.br/linguisticacorpus2011/data1/arquivos/ELC2011cadernoderesumos.pdf" target="_blank">PDF</a>]</br>
|
| 15 |
+
|
| 16 |
+
<li>Scarton, C. E. (2011): VerbNet.Br: construção semiautomática de um léxico computacional de verbos para o português do Brasil. In Proceedings of the The 8th Brazilian Symposium in Information and Human Language Technology (STIL 2011). Cuiabá, MT, Brazil. [<a href="http://www.lbd.dcc.ufmg.br/colecoes/stil/2011/003.pdf" target="_blank">PDF</a>]<br/>
|
| 17 |
+
|
| 18 |
+
<li> Scarton, C. E. (2011): VerbNet-Br: construção semiautomática de um léxico verbal online e independente de domínio para o português do Brasil. Comunicação Coordenada: "O verbo no Computador" nos anais do I Congresso Internacional de Estudos do Léxico. Salvador-BA, Brasil. [<a href="http://www.iciel.ufba.br/modulos/programacao/pro_visualiza_atividade.asp?ati_codigo=27525" target="_blank">PDF</a>]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
</ul>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
style.css
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {
|
| 2 |
+
font-family: "Times New Roman", Times, serif;
|
| 3 |
+
background-color: #ffffff;
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
/* Header superior */
|
| 7 |
+
.top-header {
|
| 8 |
+
background-color: #343a53;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.site-title {
|
| 12 |
+
color: #ffffff;
|
| 13 |
+
font-size: 2.5rem;
|
| 14 |
+
margin: 0;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/* Barra de navegação */
|
| 18 |
+
.main-navbar {
|
| 19 |
+
background-color: #0d3c6e;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
.main-navbar .nav-link {
|
| 23 |
+
color: #ffffff;
|
| 24 |
+
padding: 10px 18px;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.main-navbar .nav-link:hover,
|
| 28 |
+
.main-navbar .nav-link.active {
|
| 29 |
+
background-color: #ffffff;
|
| 30 |
+
color: #0d3c6e;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/* Conteúdo */
|
| 34 |
+
.content-area h2 {
|
| 35 |
+
margin-top: 1.5rem;
|
| 36 |
+
margin-bottom: 1rem;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.content-area p {
|
| 40 |
+
text-align: justify;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.content-area ul {
|
| 44 |
+
margin-left: 1.5rem;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.content-area a {
|
| 48 |
+
color: #003399;
|
| 49 |
+
text-decoration: underline;
|
| 50 |
+
}
|
| 51 |
+
|
verbnetbr.db
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c17c1f862bcc16e096605ea881db5019a367963f508892a17d4447b013705c19
|
| 3 |
+
size 901120
|