Closed hande1 closed 6 years ago
@hande1 which version of the SDK are you using?
@hande1 you could also provide a snippet so that we could help you better.
The version is : watson-developer-cloud==0.26.1
for fn in os.listdir(directory):
if fn[len(fn)-4:len(fn)] == 'json':
OutFile = directory +fn[0:len(fn)-4]+'_ans.json'
with open(os.path.join(directory, fn), 'r') as jsonfile:
tone = tone_analyzer.tone(json.load(jsonfile),content_type='application/json')
print(json.dumps(tone, indent=1))
write_json( tone, OutFile)
Thanks,
Could you use the latest release and try? v1.0.1 is the latest
After writing you, I realized it's not the current version, upgraded, still the same error.
Stupid question: Are you sure you are sending a json file?
More likely problem: Inside the tone method documentation it says:
You can submit no more than 128 KB of total input content and no more than 1000 individual sentences in JSON, plain text, or HTML format
:param ToneInput tone_input: JSON, plain text, or HTML input that contains the content to be analyzed. For JSON input, provide an object of type
ToneInput
.
Maybe your problem is related with some of those 2 restrictions.
yes, I dig the documentation for the file size restriction, couldn't find, but, I was almost sure because the connection is dead after some seconds. With 10 tweets in Json, it's working. I tried the system to work with 20000 tweets :) So, the aim was doing the sentimental analysis on the tweets that contain particular hashtags. I tried the same thing with real time twitter data (no hashtag filter) on IBM cloud and think it's better to use it on IBM cloud with spark and real time tweets.
Thanks to all of you,
Hande
I'm trying to use tone_analyzer. When I send tweets one-by-one, it works well. If I send a huge json, I'm getting this error. I'd appreciate any help.