@@ -18,42 +18,168 @@ var language = require('@google-cloud/language')({
1818
1919// Get the entities from a sentence.
2020language .detectEntities (' Stephen of Michigan!' , function (err , entities ) {
21- // entities = {
22- // people: ['Stephen'],
23- // places: ['Michigan']
24- // }
21+ // entities = [
22+ // {
23+ // name: 'Stephen',
24+ // type: 'PERSON',
25+ // metadata: {
26+ // mid: '/m/05d8y4q'
27+ // },
28+ // salience: 0.7309288382530212,
29+ // mentions: [
30+ // {
31+ // text: {
32+ // content: 'Stephen',
33+ // beginOffset: -1
34+ // },
35+ // type: 'PROPER'
36+ // }
37+ // ]
38+ // },
39+ // {
40+ // name: 'Michigan',
41+ // type: 'LOCATION',
42+ // metadata: {
43+ // mid: '/m/04rrx',
44+ // wikipedia_url: 'http://en.wikipedia.org/wiki/Michigan'
45+ // },
46+ // salience: 0.26907116174697876,
47+ // mentions: [
48+ // {
49+ // text: {
50+ // content: 'Michigan',
51+ // beginOffset: -1
52+ // },
53+ // type: 'PROPER'
54+ // }
55+ // ]
56+ // }
57+ // ]
2558});
2659
2760// Create a document if you plan to run multiple detections.
2861var document = language .document (' Contributions welcome!' );
2962
3063// Analyze the sentiment of the document.
3164document .detectSentiment (function (err , sentiment ) {
32- // sentiment = 100 // Large numbers represent more positive sentiments.
65+ // sentiment = {
66+ // magnitude: 0.30000001192092896,
67+ // score: 0.30000001192092896
68+ // }
3369});
3470
3571// Parse the syntax of the document.
3672document .annotate (function (err , annotations ) {
3773 // annotations = {
3874 // language: 'en',
39- // sentiment: 100,
40- // entities: {},
41- // sentences: ['Contributions welcome!'],
75+ // sentiment: {
76+ // magnitude: 0.30000001192092896,
77+ // score: 0.30000001192092896
78+ // },
79+ // entities: [
80+ // {
81+ // name: 'Contributions',
82+ // type: 'OTHER',
83+ // metadata: {},
84+ // salience: 1,
85+ // mentions: [
86+ // {
87+ // text: {
88+ // content: 'Contributions',
89+ // beginOffset: -1
90+ // },
91+ // type: 'COMMON'
92+ // }
93+ // ]
94+ // }
95+ // ],
96+ // sentences: [
97+ // {
98+ // text: {
99+ // content: 'Contributions welcome!',
100+ // beginOffset: -1
101+ // },
102+ // sentiment: {
103+ // magnitude: 0.30000001192092896,
104+ // score: 0.30000001192092896
105+ // }
106+ // }
107+ // ],
42108 // tokens: [
43109 // {
44- // text: 'Contributions',
45- // partOfSpeech: 'Noun (common and proper)',
46- // partOfSpeechTag: 'NOUN'
110+ // text: {
111+ // content: 'Contributions',
112+ // beginOffset: -1
113+ // },
114+ // partOfSpeech: {
115+ // tag: 'NOUN',
116+ // aspect: 'ASPECT_UNKNOWN',
117+ // case: 'CASE_UNKNOWN',
118+ // form: 'FORM_UNKNOWN',
119+ // gender: 'GENDER_UNKNOWN',
120+ // mood: 'MOOD_UNKNOWN',
121+ // number: 'PLURAL',
122+ // person: 'PERSON_UNKNOWN',
123+ // proper: 'PROPER_UNKNOWN',
124+ // reciprocity: 'RECIPROCITY_UNKNOWN',
125+ // tense: 'TENSE_UNKNOWN',
126+ // voice: 'VOICE_UNKNOWN'
127+ // },
128+ // dependencyEdge: {
129+ // headTokenIndex: 1,
130+ // label: 'NSUBJ'
131+ // },
132+ // lemma: 'contribution'
47133 // },
48134 // {
49- // text: 'welcome',
50- // partOfSpeech: 'Verb (all tenses and modes)',
51- // partOfSpeechTag: 'VERB'
135+ // text: {
136+ // content: 'welcome',
137+ // beginOffset: -1
138+ // },
139+ // partOfSpeech: {
140+ // tag: 'VERB',
141+ // aspect: 'ASPECT_UNKNOWN',
142+ // case: 'CASE_UNKNOWN',
143+ // form: 'FORM_UNKNOWN',
144+ // gender: 'GENDER_UNKNOWN',
145+ // mood: 'INDICATIVE',
146+ // number: 'NUMBER_UNKNOWN',
147+ // person: 'PERSON_UNKNOWN',
148+ // proper: 'PROPER_UNKNOWN',
149+ // reciprocity: 'RECIPROCITY_UNKNOWN',
150+ // tense: 'PRESENT',
151+ // voice: 'VOICE_UNKNOWN'
152+ // },
153+ // dependencyEdge: {
154+ // headTokenIndex: 1,
155+ // label: 'ROOT'
156+ // },
157+ // lemma: 'welcome'
52158 // },
53159 // {
54- // text: '!',
55- // partOfSpeech: 'Punctuation',
56- // partOfSpeechTag: 'PUNCT'
160+ // text: {
161+ // content: '!',
162+ // beginOffset: -1
163+ // },
164+ // partOfSpeech: {
165+ // tag: 'PUNCT',
166+ // aspect: 'ASPECT_UNKNOWN',
167+ // case: 'CASE_UNKNOWN',
168+ // form: 'FORM_UNKNOWN',
169+ // gender: 'GENDER_UNKNOWN',
170+ // mood: 'MOOD_UNKNOWN',
171+ // number: 'NUMBER_UNKNOWN',
172+ // person: 'PERSON_UNKNOWN',
173+ // proper: 'PROPER_UNKNOWN',
174+ // reciprocity: 'RECIPROCITY_UNKNOWN',
175+ // tense: 'TENSE_UNKNOWN',
176+ // voice: 'VOICE_UNKNOWN'
177+ // },
178+ // dependencyEdge: {
179+ // headTokenIndex: 1,
180+ // label: 'P'
181+ // },
182+ // lemma: '!'
57183 // }
58184 // ]
59185 // }
0 commit comments