mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Add Language.path
This commit is contained in:
parent
4a06eddb5f
commit
3484174e48
|
@ -127,6 +127,7 @@ class Language(object):
|
|||
RETURNS (Language): The newly constructed object.
|
||||
"""
|
||||
self._meta = dict(meta)
|
||||
self._path = None
|
||||
if vocab is True:
|
||||
factory = self.Defaults.create_vocab
|
||||
vocab = factory(self, **meta.get('vocab', {}))
|
||||
|
@ -142,6 +143,10 @@ class Language(object):
|
|||
bytes_data = self.to_bytes(vocab=False)
|
||||
return (unpickle_language, (self.vocab, self.meta, bytes_data))
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def meta(self):
|
||||
self._meta.setdefault('lang', self.vocab.lang)
|
||||
|
@ -611,6 +616,7 @@ class Language(object):
|
|||
if not (path / 'vocab').exists():
|
||||
exclude['vocab'] = True
|
||||
util.from_disk(path, deserializers, exclude)
|
||||
self._path = path
|
||||
return self
|
||||
|
||||
def to_bytes(self, disable=[], **exclude):
|
||||
|
|
|
@ -609,6 +609,14 @@ p Load state from a binary string.
|
|||
| Custom meta data for the Language class. If a model is loaded,
|
||||
| contains meta data of the model.
|
||||
|
||||
+row
|
||||
+cell #[code path]
|
||||
+tag-new(2)
|
||||
+cell #[code Path]
|
||||
+cell
|
||||
| Path to the model data directory, if a model is loaded. Otherwise
|
||||
| #[code None].
|
||||
|
||||
+h(2, "class-attributes") Class attributes
|
||||
|
||||
+table(["Name", "Type", "Description"])
|
||||
|
|
Loading…
Reference in New Issue
Block a user