Identify and classify named entities such as people, organizations, locations, dates, and other categories of words in a given text.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('language/named-entity-recognition@1.0.0');
// Use the profile
const result = await profile
.getUseCase('NamedEntityRecognition')
.perform({
text: 'Houston Natural Gas, run by Kenneth Lay merges with InterNorth, a natural gas company in Omaha, Nebraska, to form an interstate and intrastate natural gas pipeline with approximately 37,000 miles of pipeline.'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"text": "Houston Natural Gas, run by Kenneth Lay merges with InterNorth, a natural gas company in Omaha, Nebraska, to form an interstate and intrastate natural gas pipeline with approximately 37,000 miles of pipeline."
}
{
"entities": [
{
"text": "Houston Natural Gas",
"category": "Organization",
"importance": 0.954265
}
]
}