Skip to content

Commit

Permalink
allow no subcorpora
Browse files Browse the repository at this point in the history
  • Loading branch information
interrogator committed Nov 30, 2019
1 parent e78b5f4 commit 99d5077
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions explorer/parts/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ def _new_table(

sort = sort or "total"

if subcorpora == "_corpus":
subcorpora = None

relative, keyness = _translate_relative(relkey)

# check if there are any validation problems
Expand Down
8 changes: 6 additions & 2 deletions explorer/parts/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def _make_table_name(history):
if history == "initial":
return "Part of speech tags by filename"
specs, show, subcorpora, relative, keyness, sort = history
if subcorpora is None:
subcorpora = "corpus"
subcorpora = (
SHORT_TO_LONG_NAME.get(subcorpora, subcorpora).lower().replace("_", " ")
)
Expand Down Expand Up @@ -105,8 +107,10 @@ def _table_error(show, subcorpora, updating):
errors = []
if not show:
errors.append("No choice made for feature to use as columns.")
if not subcorpora:
errors.append("No choice made for feature to use as index")
# this is now allowed ... can probably remove this function if
# we don't do any extra validations.
# if not subcorpora:
# errors.append("No choice made for feature to use as index")
if not errors:
return ""
return "* " + "\n* ".join(errors)
Expand Down
2 changes: 1 addition & 1 deletion explorer/parts/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _build_frequencies_space(corpus, table, config):
show_check = html.Div(show_check, style=style.TSTYLE)
subcorpora_drop = dcc.Dropdown(
id="subcorpora-for-table",
options=cols,
options=[dict(value="_corpus", label="Entire corpus")] + cols,
placeholder="Feature for index",
style=style.MARGIN_5_MONO,
)
Expand Down

0 comments on commit 99d5077

Please sign in to comment.