mirror of https://github.com/explosion/spaCy.git
Update Language serialization docs (see #2628) [ci skip]
Add note on using from_disk and from_bytes via subclasses and add example
This commit is contained in:
parent
3834f4146d
commit
8c47da1f19
|
@ -513,11 +513,19 @@ p
|
|||
p
|
||||
| Loads state from a directory. Modifies the object in place and returns
|
||||
| it. If the saved #[code Language] object contains a model, the
|
||||
| #[strong model will be loaded].
|
||||
| model will be loaded. Note that this method is commonly used via the
|
||||
| subclasses like #[code English] or #[code German] to make
|
||||
| language-specific functionality like the
|
||||
| #[+a("/usage/adding-languages#lex-attrs") lexical attribute getters]
|
||||
| available to the loaded object.
|
||||
|
||||
+aside-code("Example").
|
||||
from spacy.language import Language
|
||||
nlp = Language().from_disk('/path/to/models')
|
||||
nlp = Language().from_disk('/path/to/model')
|
||||
|
||||
# using language-specific subclass
|
||||
from spacy.lang.en import English
|
||||
nlp = English().from_disk('/path/to/en_model')
|
||||
|
||||
+table(["Name", "Type", "Description"])
|
||||
+row
|
||||
|
@ -575,7 +583,12 @@ p Serialize the current state to a binary string.
|
|||
+h(2, "from_bytes") Language.from_bytes
|
||||
+tag method
|
||||
|
||||
p Load state from a binary string.
|
||||
p
|
||||
| Load state from a binary string. Note that this method is commonly used
|
||||
| via the subclasses like #[code English] or #[code German] to make
|
||||
| language-specific functionality like the
|
||||
| #[+a("/usage/adding-languages#lex-attrs") lexical attribute getters]
|
||||
| available to the loaded object.
|
||||
|
||||
+aside-code("Example").
|
||||
from spacy.lang.en import English
|
||||
|
|
Loading…
Reference in New Issue