0

I am running Aspect-Based-Sentiment-Analysis. And I get the output. I want to get this output as a string. I spent several hours in googling how to refer to the output and not only to see the output when I run a code. Maybe I don't comprehend something in Python basics and need huge support on that.

The code I am talking about is as follows:

absa.summary(money)

The output that i receive from this code:

Sentiment.positive for "money"
Scores (neutral/negative/positive): [0.001 0.006 0.993]
None

I checked the type of this object and it says Nonetype:

type(absa.summary(money))
Sentiment.positive for "money"
Scores (neutral/negative/positive): [0.001 0.006 0.993]
NoneType

How can I extract the text from the output as a string? Any ideas? I will provide any additional info when it is needed.

i_Tanya
  • 89
  • 1
  • 6
  • Can you post more/all of your code? I believe ABSA is using tensorflow in the background, so the "summary" results are likely tied to the object returned from < absa.load() >. – befunkt May 22 '21 at 16:47

1 Answers1

0

Looks like the command is just printing the output to stdout instead of acutally returning an object containing the information you are looking for. You may want to try and capture stdout while running the function. The answer to this question should be helpful.

m-pana
  • 26
  • 6
  • You are referring to a helpful answer, but your answer might be more useful if you encapsulated a working code segment. – rajah9 May 22 '21 at 16:26