spaCy/website/docs/api/stringstore.jade

76 lines
1.6 KiB
Plaintext
Raw Normal View History

2016-10-31 18:04:15 +00:00
//- 💫 DOCS > API > STRINGSTORE
include ../../_includes/_mixins
p Map strings to and from integer IDs.
+h(2, "init") StringStore.__init__
+tag method
p Create the #[code StringStore].
+table(["Name", "Type", "Description"])
+row
+cell #[code strings]
+cell -
+cell A sequence of unicode strings to add to the store.
+footrow
+cell returns
2016-10-31 18:04:15 +00:00
+cell #[code StringStore]
+cell The newly constructed object.
+h(2, "len") StringStore.__len__
+tag method
p Get the number of strings in the store.
+table(["Name", "Type", "Description"])
+footrow
+cell returns
2016-10-31 18:04:15 +00:00
+cell int
+cell The number of strings in the store.
+h(2, "getitem") StringStore.__getitem__
+tag method
p Retrieve a string from a given integer ID, or vice versa.
+table(["Name", "Type", "Description"])
+row
+cell #[code string_or_id]
+cell bytes / unicode / int
+cell The value to encode.
+footrow
+cell returns
2016-10-31 18:04:15 +00:00
+cell unicode / int
+cell The value to retrieved.
+h(2, "contains") StringStore.__contains__
+tag method
p Check whether a string is in the store.
+table(["Name", "Type", "Description"])
+row
+cell #[code string]
+cell unicode
+cell The string to check.
+footrow
+cell returns
2016-10-31 18:04:15 +00:00
+cell bool
+cell Whether the store contains the string.
+h(2, "iter") StringStore.__iter__
+tag method
p Iterate over the strings in the store, in order.
+table(["Name", "Type", "Description"])
+footrow
+cell yields
2016-10-31 18:04:15 +00:00
+cell unicode
+cell A string in the store.