Skip to content

Commit 68548eb

Browse files
committed
better stopword file detection
1 parent c1a30fb commit 68548eb

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

python/philologic/Config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@
318318
"comment": "\n".join(
319319
[
320320
"# The stopwords variable defines a file path containing a list of words (one word per line) used for filtering out words",
321-
"# in the collocation report. The file must be located in the defined path. If the file is not found,",
321+
"# in the collocation report. If only a filename is provided, it will look for the file in the /data directory.",
322+
"# The file must be located in the defined path. If the file is not found,",
322323
"# no option for using a stopword list will be displayed in collocation searches.",
323324
]
324325
),

python/philologic/loadtime/Loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from json import dump
1616
import csv
1717

18-
import lxml
18+
import lxml.etree
1919
import regex as re
2020
from black import FileMode, format_str
2121
from multiprocess import Pool
@@ -142,7 +142,7 @@ def __init__(self, **loader_options):
142142
already_configured_values = {}
143143
for attribute in dir(config_obj):
144144
if not attribute.startswith("__") and not isinstance(
145-
getattr(config_obj, attribute), collections.Callable
145+
getattr(config_obj, attribute), collections.abc.Callable
146146
):
147147
already_configured_values[attribute] = getattr(config_obj, attribute)
148148
with open(load_config_path, "a") as load_config_copy:

python/philologic/runtime/reports/collocation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,14 @@ def extract_bytes(hit):
126126
def build_filter_list(request, config):
127127
"""set up filtering with stopwords or most frequent terms."""
128128
if config.stopwords and request.colloc_filter_choice == "stopwords":
129-
if os.path.isabs(config.stopwords):
129+
if config.stopwords and "/" not in config.stopwords:
130+
filter_file = os.path.join(config.db_path, "data", config.stopwords)
131+
elif os.path.isabs(config.stopwords):
130132
filter_file = config.stopwords
131133
else:
132134
return ["stopwords list not found"]
135+
if not os.path.exists(filter_file):
136+
return ["stopwords list not found"]
133137
filter_num = float("inf")
134138
else:
135139
filter_file = config.db_path + "/data/frequencies/word_frequencies"

www/app/src/components/TextNavigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ body {
10981098
vertical-align: 0.3em;
10991099
font-size: 0.7em;
11001100
background-color: $button-color;
1101-
color: #fff;
1101+
color: #fff !important;
11021102
padding: 0 0.2rem;
11031103
border-radius: 50%;
11041104
}

0 commit comments

Comments
 (0)