Skip to content

Commit f3f191a

Browse files
committed
data path
1 parent 07f8de3 commit f3f191a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ As an alternative to downloading models, you can set environment variables so th
6565

6666
* `HARMONY_CLASSIFIER_ENDPOINT` - this can be an Azure Functions deployment of the text triage spaCy model. Example: https://twspacytest.azurewebsites.net/api/triage
6767
* `HARMONY_NER_ENDPOINT` - this can be an Azure Functions deployment of the NER spaCy model. Example: https://twspacytest.azurewebsites.net/api/ner
68-
* `HARMONY_DATA_PATH` - determines where model files are stored. Defaults to `HOME DIRECTORY/harmony`
68+
* `HARMONY_SPACY_PATH` - determines where model files are stored. Defaults to `HOME DIRECTORY/harmony`
69+
* `HARMONY_DATA_PATH` - determines where data files are stored. Defaults to `HOME DIRECTORY/harmony`
6970
* `HARMONY_NO_PARSING` - set to 1 to import a lightweight variant of Harmony which doesn't support PDF parsing.
7071
* `HARMONY_NO_MATCHING` - set to 1 to import a lightweight variant of Harmony which doesn't support matching.
7172

src/harmony/parsing/text_extraction/ensemble_named_entity_recogniser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
def load_spacy_models():
2525
if spacy_models["ner"] is None:
2626
if os.environ.get("HARMONY_NER_ENDPOINT") is None or os.environ.get("HARMONY_NER_ENDPOINT") == "":
27-
path = os.getenv("HARMONY_DATA_PATH", os.path.expanduser("~") + "/harmony") + '/harmony_spacy_models/11_ner_0_spacy/model-best'
27+
path = os.getenv("HARMONY_SPACY_PATH", os.path.expanduser("~") + "/harmony") + '/harmony_spacy_models/11_ner_0_spacy/model-best'
2828
if not os.path.isdir(path):
2929
print(f"Could not find model at {path}")
3030
print("Please run:\nfrom harmony import download_models\ndownload_models()")
@@ -33,7 +33,7 @@ def load_spacy_models():
3333

3434
if spacy_models["classifier"] is None:
3535
if os.environ.get("HARMONY_CLASSIFIER_ENDPOINT") is None or os.environ.get("HARMONY_CLASSIFIER_ENDPOINT") == "":
36-
path = os.getenv("HARMONY_DATA_PATH", os.path.expanduser("~") + "/harmony") + '/harmony_spacy_models/29_classifier_spacy/model-best'
36+
path = os.getenv("HARMONY_SPACY_PATH", os.path.expanduser("~") + "/harmony") + '/harmony_spacy_models/29_classifier_spacy/model-best'
3737
if not os.path.isdir(path):
3838
print(f"Could not find model at {path}")
3939
print ("Please run:\nfrom harmony import download_models\ndownload_models()")

src/harmony/util/model_downloader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ def download_models(is_force=False):
1313
"""
1414
Downloads spaCy models to local.
1515
"""
16-
local_path = os.getenv("HARMONY_DATA_PATH", os.path.expanduser("~") + "/harmony")
16+
local_path = os.getenv("HARMONY_SPACY_PATH", os.path.expanduser("~") + "/harmony")
1717

1818
print(
19-
"Downloading spaCy models to " + local_path + ".\nSet environment variable HARMONY_DATA_PATH if you want to change model file location.")
19+
"Downloading spaCy models to " + local_path + ".\nSet environment variable HARMONY_SPACY_PATH if you want to change model file location.")
2020

2121
# Base URL of the model files in Azure Blob Storage static hosted site.
2222
url = "https://harmonyapistorage.z33.web.core.windows.net/harmony_spacy_models.tar.bz2"
@@ -57,4 +57,4 @@ def download_models(is_force=False):
5757
is_force = False
5858
if len(sys.argv) > 1 and "force" in sys.argv[1]:
5959
is_force = True
60-
download_models(is_force)
60+
download_models(is_force)

0 commit comments

Comments
 (0)