File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -722,14 +722,18 @@ def __init__(self, **kwargs):
722
722
723
723
@classmethod
724
724
def _from_generated (cls , sentence , results ):
725
+ if hasattr (sentence , "aspects" ):
726
+ mined_opinions = (
727
+ [MinedOpinion ._from_generated (aspect , results ) for aspect in sentence .aspects ] # pylint: disable=protected-access
728
+ if sentence .aspects else []
729
+ )
730
+ else :
731
+ mined_opinions = None
725
732
return cls (
726
733
text = sentence .text ,
727
734
sentiment = sentence .sentiment ,
728
735
confidence_scores = SentimentConfidenceScores ._from_generated (sentence .confidence_scores ), # pylint: disable=protected-access
729
- mined_opinions = (
730
- [MinedOpinion ._from_generated (aspect , results ) for aspect in sentence .aspects ] # pylint: disable=protected-access
731
- if (hasattr (sentence , "aspects" ) and sentence .aspects ) else None
732
- )
736
+ mined_opinions = mined_opinions
733
737
)
734
738
735
739
def __repr__ (self ):
You can’t perform that action at this time.
0 commit comments