Skip to content

Commit 18456b4

Browse files
wizeng23NimJay
authored andcommitted
docs: update classification sample to use v2 model (GoogleCloudPlatform#700)
Fixes GoogleCloudPlatform#699
1 parent b949e87 commit 18456b4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cloud-language/snippets/analyze.v1.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,17 @@ async function classifyTextOfText(text) {
314314
type: 'PLAIN_TEXT',
315315
};
316316

317+
const classificationModelOptions = {
318+
v2Model: {
319+
contentCategoriesVersion: 'V2',
320+
},
321+
};
322+
317323
// Classifies text in the document
318-
const [classification] = await client.classifyText({document});
324+
const [classification] = await client.classifyText({
325+
document,
326+
classificationModelOptions,
327+
});
319328
console.log('Categories:');
320329
classification.categories.forEach(category => {
321330
console.log(`Name: ${category.name}, Confidence: ${category.confidence}`);

0 commit comments

Comments
 (0)