Skip to content

Commit 3ea7bd5

Browse files
committed
Adding Annotations class in language implementation.
To be used in Document.annotate_text().
1 parent d490cd6 commit 3ea7bd5

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

gcloud/language/document.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
A document is used to hold text to be analyzed and annotated.
1818
"""
1919

20+
import collections
21+
2022
from gcloud.language.entity import Entity
2123
from gcloud.language.sentiment import Sentiment
2224

@@ -25,6 +27,26 @@
2527
"""Default document language, English."""
2628

2729

30+
Annotations = collections.namedtuple(
31+
'Annotations',
32+
'sentences tokens sentiment entities')
33+
"""Annotations for a document.
34+
35+
:type sentences: list
36+
:param sentences: List of :class:`.Sentence` in a document.
37+
38+
:type tokens: list
39+
:param tokens: List of :class:`.Token` from a document.
40+
41+
:type sentiment: :class:`Sentiment`
42+
:param sentiment: The sentiment of a document.
43+
44+
:type entities: list
45+
:param entities: List of :class:`~.language.entity.Entity`
46+
found in a document.
47+
"""
48+
49+
2850
class Encoding(object):
2951
"""Document text encoding types."""
3052

0 commit comments

Comments
 (0)