0
votes

I'm using IBM Cloud NLU to analyze a series of web pages from a list of URL's.

The API is successfully returning entities, and I'm able to return the analyzed contents as well using

return_analyzed_text => 'true';

My problem is that I need to return the web page title in addition to the analyzed text.

My solution thus far is to separately CURL each page, extract the title element from the DOM, and correlate the separately extracted title information with the return_analyzed_text string. This extra step adds considerable time to the process, and seems unnecessary as the API is clearly already CURLing the page.

Is there any way to just get the API to return the document title? (Or any other DOM element like an H1?)

1

1 Answers

1
votes

You can get the service to return the title if you ask for metadata - https://cloud.ibm.com/apidocs/natural-language-understanding#metadata

As per the documentation you need to pass in these parameters, in addition to what you are already passing in to request metadata.

{
  "url": "www.ibm.com",
  "features": {
    "metadata": {}
  }
}

This will add additional units to your API usage count.