Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Natural Language API's Content Category

Hello Cloud Forum

As listed below , the Natural Language API's Content Categories has 27 major categories (and 620 sub categories.).

When I already know my text is generally about Sport, in order to narrow down text categorization and increase accuracy, I want to only use /Sports (from 27 major categories) to analyze my text ( not for example /Arts & Entertainment). what's the way to accomplish this?

Content Categories:

/Adult
/Arts & Entertainment
/Autos & Vehicles
/Beauty & Fitness
/Books & Literature
/Business & Industrial
/Computers & Electronics
/Finance
/Food & Drink
/Games
/Health
/Hobbies & Leisure
/Home & Garden
/Internet & Telecom
/Jobs & Education
/Law & Government
/News
/Online Communities
/People & Society
/Pets & Animals
/Real Estate
/Reference
/Science
/Sensitive Subjects
/Shopping
/Sports
/Travel

1 REPLY 1

Hello SepArmeen,

The list of content categories you provided was under version 1. When using the V1 model, the Natural Language API filters the categories returned by the classifyText method to include only the most relevant categories for a request. For instance, if /Science and /Science/Astronomy both apply to a document, then the /Science/Astronomy category is returned, because it is the more specific result. While the V2 model doesn't filter categories returned by the classifyText method. For instance, if /Science and /Science/Astronomy both apply to a document and have reasonable confidence scores, then both categories are returned.

Unfortunately, we can’t remove other content categories just to increase your accuracy in categorizing the text. Based on the document these categories are requested into a method and have reasonable confidence scores. 

I suggest filing this as a feature request. Please note that I can't provide any details or timelines at this moment. However, you may keep an eye on the release notes for any latest updates or new features related to Cloud Natural Language.

I hope the above information is helpful.

Top Labels in this Space