Open malandrina opened 11 years ago
The following script returns an empty array:
spanish_dictionary = Dictionary.new('enes') moonlight_in_spanish = spanish_dictionary.query('moonlight') moonlight_in_spanish.results
This is because Query.clean_terms currently removes 3 elements from the results, even if there are only 3 or fewer results.
Query.clean_terms
The JSON response to the above query looks like this:
{ "term0" : { "PrincipalTranslations" : { "0" :{ "OriginalTerm" : { "term" : "moonlight", "POS" : "n", "sense" : "light of the moon", "usage" : ""}, "FirstTranslation" : {"term" : "luz de luna", "POS" : "loc nom", "sense" : ""}, "SecondTranslation" : {"term" : "luz de la luna", "POS" : "loc nom", "sense" : ""}, "Note" : ""}, "1" :{ "OriginalTerm" : { "term" : "moonlight", "POS" : "vi", "sense" : "work a second job", "usage" : ""}, "FirstTranslation" : {"term" : "pluriemplearse", "POS" : "vipron", "sense" : ""}, "SecondTranslation" : {"term" : "dobletear", "POS" : "vtr", "sense" : "empleo"}, "Note" : ""}, "2" :{ "OriginalTerm" : { "term" : "moonlight", "POS" : "adj", "sense" : "happening at night", "usage" : ""}, "FirstTranslation" : {"term" : "a la luz de la luna", "POS" : "loc adj", "sense" : "figurado"}, "SecondTranslation" : {"term" : "por la noche", "POS" : "loc adj", "sense" : ""}, "Note" : ""}}}, "Lines" : "End Reached", "END" : true }
The following script returns an empty array:
This is because
Query.clean_terms
currently removes 3 elements from the results, even if there are only 3 or fewer results.The JSON response to the above query looks like this: