mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Update docstrings and API docs for Doc
This commit is contained in:
parent
2c8c9dc0c9
commit
23f9a3ccc8
|
@ -201,6 +201,8 @@ cdef class Doc:
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
"""The number of tokens in the document.
|
"""The number of tokens in the document.
|
||||||
|
|
||||||
|
RETURNS (int): The number of tokens in the document.
|
||||||
|
|
||||||
EXAMPLE:
|
EXAMPLE:
|
||||||
>>> len(doc)
|
>>> len(doc)
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -150,7 +150,8 @@ p
|
||||||
| similarity using an average of word vectors.
|
| similarity using an average of word vectors.
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
apples, and, oranges = nlp(u'apples and oranges')
|
apples = nlp(u'I like apples')
|
||||||
|
oranges = nlp(u'I like oranges')
|
||||||
apples_oranges = apples.similarity(oranges)
|
apples_oranges = apples.similarity(oranges)
|
||||||
oranges_apples = oranges.similarity(apples)
|
oranges_apples = oranges.similarity(apples)
|
||||||
assert apples_oranges == oranges_apples
|
assert apples_oranges == oranges_apples
|
||||||
|
@ -368,35 +369,6 @@ p
|
||||||
+cell dict
|
+cell dict
|
||||||
+cell Parse tree as dict.
|
+cell Parse tree as dict.
|
||||||
|
|
||||||
+h(2, "text") Doc.text
|
|
||||||
+tag property
|
|
||||||
|
|
||||||
p A unicode representation of the document text.
|
|
||||||
|
|
||||||
+aside-code("Example").
|
|
||||||
text = u'Give it back! He pleaded.'
|
|
||||||
doc = nlp(text)
|
|
||||||
assert doc.text == text
|
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
|
||||||
+footrow
|
|
||||||
+cell returns
|
|
||||||
+cell unicode
|
|
||||||
+cell The original verbatim text of the document.
|
|
||||||
|
|
||||||
+h(2, "text_with_ws") Doc.text_with_ws
|
|
||||||
+tag property
|
|
||||||
|
|
||||||
p
|
|
||||||
| An alias of #[code Doc.text], provided for duck-type compatibility with
|
|
||||||
| #[code Span] and #[code Token].
|
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
|
||||||
+footrow
|
|
||||||
+cell returns
|
|
||||||
+cell unicode
|
|
||||||
+cell The original verbatim text of the document.
|
|
||||||
|
|
||||||
+h(2, "ents") Doc.ents
|
+h(2, "ents") Doc.ents
|
||||||
+tag property
|
+tag property
|
||||||
+tag requires model
|
+tag requires model
|
||||||
|
@ -473,8 +445,8 @@ p
|
||||||
| object.
|
| object.
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
apple = nlp(u'apple')
|
doc = nlp(u'I like apples')
|
||||||
assert apple.has_vector
|
assert doc.has_vector
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
+footrow
|
+footrow
|
||||||
|
@ -491,8 +463,8 @@ p
|
||||||
| token vectors.
|
| token vectors.
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
apple = nlp(u'apple')
|
apples = nlp(u'I like apples')
|
||||||
(apple.vector.dtype, apple.vector.shape)
|
(apples.vector.dtype, apples.vector.shape)
|
||||||
# (dtype('float32'), (300,))
|
# (dtype('float32'), (300,))
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
|
@ -517,6 +489,18 @@ p
|
||||||
+h(2, "attributes") Attributes
|
+h(2, "attributes") Attributes
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
|
+row
|
||||||
|
+cell #[code text]
|
||||||
|
+cell unicode
|
||||||
|
+cell A unicode representation of the document text.
|
||||||
|
|
||||||
|
+row
|
||||||
|
+cell #[code text_with_ws]
|
||||||
|
+cell unicode
|
||||||
|
+cell
|
||||||
|
| An alias of #[code Doc.text], provided for duck-type compatibility
|
||||||
|
| with #[code Span] and #[code Token].
|
||||||
|
|
||||||
+row
|
+row
|
||||||
+cell #[code mem]
|
+cell #[code mem]
|
||||||
+cell #[code Pool]
|
+cell #[code Pool]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user