Cognitive Services Topic Detection API not returni

2019-09-16 07:23发布

问题:

I can't seem to get any results back from the Cognitive Services Text Analytics API for Topic Detection. I downloaded the "API definition" and generated the REST API Client into a C# project using the Swagger metadata file that I downloaded.

I'm running a test that included 2000+ small sentences that include common phrases so the detection should work. The code is constructed as follows:

  1. I created an TopicDetectionInputV2 object to which I added the 2000+ InputV2 documents. Tried with and without the StopWords and TopicsToExclude.

  2. I created an AzureMachineLearningTextAnalytics object that I call the DetectTopics(key, null, null, null, TopicDetectionInputV2). Tried both min/max documents per word set.

I always receive a null response from the API call.

When I debug into the generated REST API call and inspect the httpResponse, it always returns a Status Code: 202 and ReasonPhrase: 'Accepted', however the response body is empty.

Has anyone been able to get actual results from the DetectTopics API? Any information is greatly appreciated.

回答1:

I haven't used this API, but according to the documentation this is the expected behavior.

DetectTopics API will either return a 202 (processing) or 400 (error).

Once the request has successfully been submitted, which is appears that it has, you should get the result using the OperationStatus API.



标签: c# swagger