Skip to content

Commit

Permalink
Fix user-facing display of links
Browse files Browse the repository at this point in the history
  • Loading branch information
memgonzales committed Aug 30, 2023
1 parent 1a721b2 commit 9c3a10a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/assets/1-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ i {
body.modal-open {
overflow: inherit;
padding-right: 0 !important;
}

.link-primary {
cursor: pointer !important;
}
13 changes: 0 additions & 13 deletions src/callbacks/home/embeddings/util.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
from sklearn.decomposition import PCA


def sanitize_embeddings(embeddings):
if embeddings:
if embeddings != 'nan':
embeddings = embeddings[1:-1]
embeddings = embeddings.split()
embeddings = [eval(e.strip())
for e in embeddings] # change string to float

return embeddings

return ''


def load_embeddings(embeddings_list):
if embeddings_list:

Expand Down
4 changes: 2 additions & 2 deletions src/callbacks/home/network/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dash import Input, Output, dcc, html
from dash import Input, Output, html
from plotly.graph_objs import *
from dash.exceptions import PreventUpdate
from ..api_query import *
Expand Down Expand Up @@ -40,7 +40,7 @@ def search_word(word):
def display_co_occurring_words(word, sense_id):
for entry in get_netsci_word(API_URL, word):
if entry['sense_id'] == f'ns_{word}_{sense_id}':
cooccurring_words = [dcc.Link(cooccurring_word, href='', style={'text-decoration': 'none'})
cooccurring_words = [html.Span(cooccurring_word, className='link-primary', style={'text-decoration': 'none'})
for cooccurring_word in entry['community']]

ret_val = []
Expand Down
19 changes: 12 additions & 7 deletions src/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
# ========

network = dbc.Row([
html.H2('Co-Occurring Words', style={'marginTop': '5em'}),
html.H2('Co-Occurring Words'),
html.Br(),
html.Br(),
html.Div([
Expand All @@ -90,11 +90,10 @@

dcc.Dropdown(
id='communities-dropdown',
value='Sense 1'
value='Sense 1',
className='mb-4'
),

html.Br(),

dcc.Loading(html.Div(id='network-cooccurring-words'))
])
])
Expand Down Expand Up @@ -234,13 +233,19 @@
# =======

export = dbc.Row([
html.H4('Export Data'),
html.H4('Export Data', className='mt-3'),
html.Br(),
html.Br(),
html.Ul([
html.Li('Word Senses and Sample Sentences (JSON)'),
html.Li('Embeddings (CSV)'),
], style={'marginLeft': '2em'}),
html.Li(html.Span('Embeddings (CSV)',
className='link-primary', n_clicks=0,
id='export-embeddings')),
], style={'marginLeft': '2em'}, className='mt-2'),

dcc.Download(
id='download-embeddings'
),
])


Expand Down

0 comments on commit 9c3a10a

Please sign in to comment.