Skip to content

Commit c7cd4d6

Browse files
language: fix docs
1 parent cc28abe commit c7cd4d6

File tree

3 files changed

+196
-287
lines changed

3 files changed

+196
-287
lines changed

README.md

+83-23
Original file line numberDiff line numberDiff line change
@@ -305,43 +305,103 @@ var languageClient = language({
305305

306306
// Get the entities from a sentence.
307307
languageClient.detectEntities('Stephen of Michigan!', function(err, entities) {
308-
// entities = {
309-
// people: ['Stephen'],
310-
// places: ['Michigan']
311-
// }
308+
// entities = [
309+
// {
310+
// name: 'Stephen',
311+
// type: 'PERSON',
312+
// metadata: {
313+
// mid: '/m/05d8y4q'
314+
// },
315+
// salience: 0.7309288382530212,
316+
// mentions: [
317+
// {
318+
// text: {
319+
// content: 'Stephen',
320+
// beginOffset: -1
321+
// },
322+
// type: 'PROPER'
323+
// }
324+
// ]
325+
// },
326+
// // ...
327+
// ]
312328
});
313329

314330
// Create a document if you plan to run multiple detections.
315331
var document = languageClient.document('Contributions welcome!');
316332

317333
// Analyze the sentiment of the document.
318334
document.detectSentiment(function(err, sentiment) {
319-
// sentiment = 100 // Large numbers represent more positive sentiments.
335+
// sentiment = {
336+
// magnitude: 0.5,
337+
// score: 0.5
338+
// }
320339
});
321340

322341
// Parse the syntax of the document.
323-
document.annotate(function(err, annotations) {
324-
// annotations = {
342+
document.annotate(function(err, annotation) {
343+
// annotation = {
325344
// language: 'en',
326-
// sentiment: 100,
327-
// entities: {},
328-
// sentences: ['Contributions welcome!'],
329-
// tokens: [
345+
// sentiment: {
346+
// magnitude: 0.30000001192092896,
347+
// score: 0.30000001192092896
348+
// },
349+
// entities: [
330350
// {
331-
// text: 'Contributions',
332-
// partOfSpeech: 'Noun (common and proper)',
333-
// partOfSpeechTag: 'NOUN'
334-
// },
335-
// {
336-
// text: 'welcome',
337-
// partOfSpeech: 'Verb (all tenses and modes)',
338-
// partOfSpeechTag: 'VERB'
339-
// },
351+
// name: 'Contributions',
352+
// type: 'OTHER',
353+
// metadata: {},
354+
// salience: 1,
355+
// mentions: [
356+
// {
357+
// text: {
358+
// content: 'Contributions',
359+
// beginOffset: -1
360+
// },
361+
// type: 'COMMON'
362+
// }
363+
// ]
364+
// }
365+
// ],
366+
// sentences: [
340367
// {
341-
// text: '!',
342-
// partOfSpeech: 'Punctuation',
343-
// partOfSpeechTag: 'PUNCT'
368+
// text: {
369+
// content: 'Contributions welcome!',
370+
// beginOffset: -1
371+
// },
372+
// sentiment: {
373+
// magnitude: 0.30000001192092896,
374+
// score: 0.30000001192092896
375+
// }
344376
// }
377+
// ],
378+
// tokens: [
379+
// {
380+
// text: {
381+
// content: 'Contributions',
382+
// beginOffset: -1
383+
// },
384+
// partOfSpeech: {
385+
// tag: 'NOUN',
386+
// aspect: 'ASPECT_UNKNOWN',
387+
// case: 'CASE_UNKNOWN',
388+
// form: 'FORM_UNKNOWN',
389+
// gender: 'GENDER_UNKNOWN',
390+
// mood: 'MOOD_UNKNOWN',
391+
// number: 'PLURAL',
392+
// person: 'PERSON_UNKNOWN',
393+
// proper: 'PROPER_UNKNOWN',
394+
// reciprocity: 'RECIPROCITY_UNKNOWN',
395+
// tense: 'TENSE_UNKNOWN',
396+
// voice: 'VOICE_UNKNOWN'
397+
// },
398+
// dependencyEdge: {
399+
// headTokenIndex: 1,
400+
// label: 'NSUBJ'
401+
// },
402+
// lemma: 'contribution'
403+
// },
404+
// // ...
345405
// ]
346406
// }
347407
});

packages/language/README.md

+4-70
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,7 @@ language.detectEntities('Stephen of Michigan!', function(err, entities) {
3636
// }
3737
// ]
3838
// },
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-
// }
39+
// // ...
5740
// ]
5841
});
5942

@@ -69,8 +52,8 @@ document.detectSentiment(function(err, sentiment) {
6952
});
7053

7154
// Parse the syntax of the document.
72-
document.annotate(function(err, annotations) {
73-
// annotations = {
55+
document.annotate(function(err, annotation) {
56+
// annotation = {
7457
// language: 'en',
7558
// sentiment: {
7659
// magnitude: 0.30000001192092896,
@@ -131,56 +114,7 @@ document.annotate(function(err, annotations) {
131114
// },
132115
// lemma: 'contribution'
133116
// },
134-
// {
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'
158-
// },
159-
// {
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: '!'
183-
// }
117+
// // ...
184118
// ]
185119
// }
186120
});

0 commit comments

Comments
 (0)