mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 09:14:32 +03:00
Add docstring and todo note
This commit is contained in:
parent
5c5f8c0a72
commit
97647c46cd
|
@ -107,6 +107,13 @@ def read_json(location):
|
||||||
|
|
||||||
|
|
||||||
def parse_package_meta(package_path, package, require=True):
|
def parse_package_meta(package_path, package, require=True):
|
||||||
|
"""
|
||||||
|
Check if a meta.json exists in a package and return its contents as a
|
||||||
|
dictionary. If require is set to True, raise an error if no meta.json found.
|
||||||
|
"""
|
||||||
|
# TODO: Allow passing in full model path and only require one argument
|
||||||
|
# instead of path and package name. This lets us avoid passing in an awkward
|
||||||
|
# empty string in spacy.load() if user supplies full model path.
|
||||||
location = package_path / package / 'meta.json'
|
location = package_path / package / 'meta.json'
|
||||||
if location.is_file():
|
if location.is_file():
|
||||||
return read_json(location)
|
return read_json(location)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user