germanattanasio / professor-languo

Professor Languo is a sample app that uses the Retrieve and Rank service to answer questions about the english language. It showcases a question and answer app built on the Retrieve and Rank Bluemix service
https://professor-languo.mybluemix.net/
13 stars 18 forks source link

Ranker Issue #6

Closed poonamsaini17 closed 8 years ago

poonamsaini17 commented 8 years ago

I am trying to create a ranker . I am getting this error:

main] c.i.w.d.service.WatsonService : https://gateway.watsonplatform.net/retrieve-and-ra nk/api/v1/rankers, status: 400, error: Entitlement error Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 189.698 sec <<< FAILURE! - in

com.ibm.watson.developer_cloud.service.BadRequestException: Entitlement error at com.ibm.watson.developer_cloud.service.WatsonService.execute(WatsonService.java:141)

stevenoh93 commented 8 years ago

@areddy7021 The class is here: src/main/java/com/ibm/watson/developer_cloud/professor_languo/pipeline/PipelineDriver.java

@pranireddy9 I can try to explain in pseudocode what's happening in the python script, but I can't help you if you are having trouble implementing it in Java. We used a complex QuestionAnswerer pipeline, so putting that code snippet up here would only cause more confusion.. Here's what's happening in the script:

CREDS <- username:password
BASEURL <- "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/"
SOLRURL <- BASEURL+"solr_clusters/%s/solr/%s/fcselect" % (CLUSTER, COLLECTION)
for each row
   // Using first row of cranfield_gt.csv as example
   question <- first item in the row (e.g. what similarity laws must be obeyed...)
   relevance <- the rest of the row without quotes (e.g. 184,3,29,3,31,3,...)
   make the curl command (e.g. 'curl -k -u %s -d "q=%s&gt=%s&generateHeader=%s&rows=%s&returnRSInput=true&wt=json" "%s"' % (CREDS, question, relevance, add_header, ROWS, SOLRURL))
   parsed_json <- process json response (as Java object using any standard json parsing library)
   training_file.write(parsed_json['RSInput'])
areddy7021 commented 8 years ago

@pranireddy9 have tried with the java class using apache library ..and she is able to get the CSV Records but the implication is with that is there are no headers and everything can be cinstructed with in that curl command ..except gt parameter where we need to merge coloumns. in java csv library there is no merging option for us and looking to dig into more of that to form the gt parameter with the coloumn values other than question one. anywayz thank you very much @stevenoh93

areddy7021 commented 8 years ago

@stevenoh93 i have written the java app to parse out thne ground truth csv file into text file using the csv parser ..but when i see python code it is taking each row of csv file and executing the curl command against watson to generate 10 rows. and that command looks like this :

 curl -k -s -v -u USERNAME:PASSWORD "q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.&gt=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json" "http://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/sc8d29e583_a5d7_4cc5_b7cc_ebae25e7664e/example_collection/fcselect"
* Rebuilt URL to: q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.&gt=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json/
* timeout on name lookup is not supported
* getaddrinfo(3) failed for q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.&gt=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json:80
* Couldn't resolve host 'q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.&gt=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json'
* Closing connection 0
* timeout on name lookup is not supported
*   Trying 158.85.132.88...
* connect to 158.85.132.88 port 80 failed: Timed out
* Failed to connect to gateway.watsonplatform.net port 80: Timed out
* Closing connection 1

but i am getting the exception when i run this command out side of python script stand alone through command line. if this command run standalone then it would be very easier to work under my custom java code .

germanattanasio commented 8 years ago

The problem you are getting is related to the curl command which is not correct. I think that first, you need to understand how the service works and how so I would suggest you to look at the documentation.

If you run into issues with the documentation feel free to ask the question here: https://developer.ibm.com/answers/topics/watson/

The Retrieve and Rank team monitor that forum. Make sure you include this link in the question.