I used the httpcaller transformer call the Baidu NLP api using the post method. But I have got a uninteded result.
Baidu NLP API: http://ai.baidu.com/docs#/NLP-API/top
Now I use the lexer for example.
Http method: POST
Request url: https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer
Url parameter??Valid for one month?access_token=24.04f6c0626853e9c8b18ffbbaf5a0743b.2592000.1532943274.282335-11467307
Header : Content-Type=application/json
Body:?json,requires gbk encoding?
{
"text":"??????????"
}
If called successfully , it will return a json(encoding in gbk?,just like below.
{ "text":"??????????", "items":[ { "byte_length":4, "byte_offset":0, "formal":"", "item":"??", "ne":"ORG", "pos":"", "uri":"", "loc_details":[ ], "basic_words":["??"] }, { "byte_length":2, "byte_offset":4, "formal":"", "item":"?", "ne":"", "pos":"v", "uri":"", "loc_details":[ ], "basic_words":["?"] }, { "byte_length":4, "byte_offset":6, "formal":"", "item":"??", "ne":"", "pos":"m", "uri":"", "loc_details":[ ], "basic_words":["?","?"] }, { "byte_length":6, "byte_offset":10, "formal":"", "item":"???", "ne":"", "pos":"n", "uri":"", "loc_details":[ ], "basic_words":["?","??"] }, { "byte_length":4, "byte_offset":16, "formal":"", "item":"??", "ne":"", "pos":"n", "uri":"", "loc_details":[ ], "basic_words":["??"] } ] }
Httpcaller parameter:
The return I have got:(It returned a html file instead of a json file.)
I also tried this method on postman. It works pretty well.
I have troubled in this problem for two days. And searched every similar answer in the knowledge center. But I still don't know where the problem is.
Any help is appreciated.
JISHENG LIU