@@ -38,7 +38,7 @@ where `<command>` is one of: `entities`, `sentiment`, or `syntax`.
38
38
39
39
The script will write to STDOUT the json returned from the API for the requested feature.
40
40
41
- For example, if you run :
41
+ * Example1 :
42
42
43
43
``` sh
44
44
$ python analyze.py entities " Tom Sawyer is a book written by a guy known as Mark Twain."
@@ -50,38 +50,124 @@ You will see something like the following returned:
50
50
{
51
51
"entities": [
52
52
{
53
- "salience": 0.49785897 ,
53
+ "salience": 0.50827783 ,
54
54
"mentions": [
55
55
{
56
56
"text": {
57
57
"content": "Tom Sawyer",
58
58
"beginOffset": 0
59
- }
59
+ },
60
+ "type": "PROPER"
60
61
}
61
62
],
62
63
"type": "PERSON",
63
64
"name": "Tom Sawyer",
64
65
"metadata": {
66
+ "mid": "/m/01b6vv",
65
67
"wikipedia_url": "http://en.wikipedia.org/wiki/The_Adventures_of_Tom_Sawyer"
66
68
}
67
69
},
68
70
{
69
- "salience": 0.12209519,
71
+ "salience": 0.22226454,
72
+ "mentions": [
73
+ {
74
+ "text": {
75
+ "content": "book",
76
+ "beginOffset": 16
77
+ },
78
+ "type": "COMMON"
79
+ }
80
+ ],
81
+ "type": "WORK_OF_ART",
82
+ "name": "book",
83
+ "metadata": {}
84
+ },
85
+ {
86
+ "salience": 0.18305534,
87
+ "mentions": [
88
+ {
89
+ "text": {
90
+ "content": "guy",
91
+ "beginOffset": 34
92
+ },
93
+ "type": "COMMON"
94
+ }
95
+ ],
96
+ "type": "PERSON",
97
+ "name": "guy",
98
+ "metadata": {}
99
+ },
100
+ {
101
+ "salience": 0.086402282,
70
102
"mentions": [
71
103
{
72
104
"text": {
73
105
"content": "Mark Twain",
74
106
"beginOffset": 47
75
- }
107
+ },
108
+ "type": "PROPER"
76
109
}
77
110
],
78
111
"type": "PERSON",
79
112
"name": "Mark Twain",
80
113
"metadata": {
114
+ "mid": "/m/014635",
81
115
"wikipedia_url": "http://en.wikipedia.org/wiki/Mark_Twain"
82
116
}
83
117
}
84
118
],
85
119
"language": "en"
86
120
}
87
121
```
122
+
123
+ * Example2:
124
+
125
+ ``` sh
126
+ $ python analyze.py entities " Apple has launched new iPhone."
127
+ ```
128
+
129
+ You will see something like the following returned:
130
+
131
+ ```
132
+ {
133
+ "entities": [
134
+ {
135
+ "salience": 0.72550339,
136
+ "mentions": [
137
+ {
138
+ "text": {
139
+ "content": "Apple",
140
+ "beginOffset": 0
141
+ },
142
+ "type": "PROPER"
143
+ }
144
+ ],
145
+ "type": "ORGANIZATION",
146
+ "name": "Apple",
147
+ "metadata": {
148
+ "mid": "/m/0k8z",
149
+ "wikipedia_url": "http://en.wikipedia.org/wiki/Apple_Inc."
150
+ }
151
+ },
152
+ {
153
+ "salience": 0.27449661,
154
+ "mentions": [
155
+ {
156
+ "text": {
157
+ "content": "iPhone",
158
+ "beginOffset": 23
159
+ },
160
+ "type": "PROPER"
161
+ }
162
+ ],
163
+ "type": "CONSUMER_GOOD",
164
+ "name": "iPhone",
165
+ "metadata": {
166
+ "mid": "/m/027lnzs",
167
+ "wikipedia_url": "http://en.wikipedia.org/wiki/IPhone"
168
+ }
169
+ }
170
+ ],
171
+ "language": "en"
172
+ }
173
+ ```
0 commit comments