mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-16 06:37:04 +03:00
968f6f0bda
## Description This PR adds the most relevant documentation of spaCy's Cython API. (Todo for when we publish this: rewrite `/api/#section-cython` and `/api/#cython` to `/api/cython#conventions`.) ### Types of change docs ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [x] I have submitted the spaCy Contributor Agreement. - [x] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
74 lines
1.9 KiB
Plaintext
74 lines
1.9 KiB
Plaintext
//- 💫 DOCS > API > CYTHON > CLASSES > TOKEN
|
|
|
|
p
|
|
| A Cython class providing access and methods for a
|
|
| #[+api("cython-structs#tokenc") #[code TokenC]] struct. Note that the
|
|
| #[code Token] object does not own the struct. It only receives a pointer
|
|
| to it.
|
|
|
|
+infobox
|
|
| This section documents the extra C-level attributes and methods that
|
|
| can't be accessed from Python. For the Python documentation, see
|
|
| #[+api("token") #[code Token]].
|
|
|
|
+h(3, "token_attributes") Attributes
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
+row
|
|
+cell #[code vocab]
|
|
+cell #[code Vocab]
|
|
+cell A reference to the shared #[code Vocab] object.
|
|
|
|
+row
|
|
+cell #[code c]
|
|
+cell #[code TokenC*]
|
|
+cell
|
|
| A pointer to a #[+api("cython-structs#tokenc") #[code TokenC]]
|
|
| struct.
|
|
|
|
+row
|
|
+cell #[code i]
|
|
+cell #[code int]
|
|
+cell The offset of the token within the document.
|
|
|
|
+row
|
|
+cell #[code doc]
|
|
+cell #[code Doc]
|
|
+cell The parent document.
|
|
|
|
+h(3, "token_cinit") Token.cinit
|
|
+tag method
|
|
|
|
p Create a #[code Token] object from a #[code TokenC*] pointer.
|
|
|
|
+aside-code("Example").
|
|
token = Token.cinit(&doc.c[3], doc, 3)
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
+row
|
|
+cell #[code vocab]
|
|
+cell #[code Vocab]
|
|
+cell A reference to the shared #[code Vocab].
|
|
|
|
+row
|
|
+cell #[code c]
|
|
+cell #[code TokenC*]
|
|
+cell
|
|
| A pointer to a #[+api("cython-structs#tokenc") #[code TokenC]]
|
|
| struct.
|
|
|
|
+row
|
|
+cell #[code offset]
|
|
+cell #[code int]
|
|
+cell The offset of the token within the document.
|
|
|
|
+row
|
|
+cell #[code doc]
|
|
+cell #[code Doc]
|
|
+cell The parent document.
|
|
|
|
+row("foot")
|
|
+cell returns
|
|
+cell #[code Token]
|
|
+cell The newly constructed object.
|