diff --git a/spacy/language.py b/spacy/language.py index c706e532a..933ca772d 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -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): diff --git a/website/api/language.jade b/website/api/language.jade index 668cbadd7..6aa2d7612 100644 --- a/website/api/language.jade +++ b/website/api/language.jade @@ -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"])