1

I am using IBM Watson Natural Language Understanding Service via Node SDK for Text Analysis. I have an Array of sentences with length nearly 20 to 30. When I tried to iterate through the Array and Call NLU Analyze API I am getting Error : Too Many Request.

There is no API available for Bulk process of text analysis and I don't see any limit in NLU Service Documentation. I am using Standard Plan.

Is there any way to get rid of this error? I want to analyze an Array of sentences.

Error Log :

Error: Too Many Requests
at Request._callback (/home/vcap/app/node_modules/watson-developer-cloud/lib/requestwrapper.js:99:21)
at Request.self.callback (/home/vcap/app/node_modules/request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/home/vcap/app/node_modules/request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/home/vcap/app/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

Update:

Adding Source Code :

segmentList.forEach((segment) => {
    var params = {
        text: segment,
        features: {
            keywords: {
                sentiment: false
            },
            sentiment: {
                document: true
            }
        }
    };
    logger.info("Analyse Segment : " + segment);
    return new Promise((resolve) => {
        NLUService.analyze(params, (err, data) => {
            if (err != null) {
                logger.error(err.stack);
            }
            ctr += 1;
            // Inserting data.sentiment.document.score to Database   
            .
            .
            .           
            if (ctr == callSegments.length)
                resolve();
        });
    }).then(() => resolve());
});
Mdumanoj
  • 517
  • 3
  • 9
  • 27
  • 1
    May you please edit and add your source code? `429 Too Many Requests`, The service is throttling your request because your IBM Cloud ID submitted more than 1200 requests per minute. – Sayuri Mizuguchi Jan 25 '18 at 18:30

1 Answers1

0

From what I know after using the Natural Language Understanding service, there seems to be a limitation of 20 concurrent requests.

You need to make sure you don't send more than 20 requests at the same time. If you look at this blog post you will see some patterns of how you can run N promises in parallel.

German Attanasio
  • 22,217
  • 7
  • 47
  • 63