From 1a419f45a45f60219ceb68b1f934527c35772f5d Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Thu, 7 Nov 2024 15:55:40 -0500 Subject: [PATCH 1/6] Updated numpy dependency --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index c5d2fee..5a163cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,7 @@ install_requires = coreferee rdflib spacytextblob - numpy + numpy==1.26.4 srsly wordfreq statistics From b80deba770a2f0aa39cc10c8fec408f338886822 Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Thu, 7 Nov 2024 15:56:59 -0500 Subject: [PATCH 2/6] Updated reference to lexica --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 6c11157..b499a22 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ python_requires = >=3.9 cmdclass = install = install.AWEInstall install_requires = - awe_lexica + awe_lexica @ git+https://github.com/ArgLab/AWE_Lexica.git spacy holmes_extractor coreferee From 356d9a743155dd2de66c3122f35bb8b9391ac090 Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Tue, 28 Jan 2025 11:13:26 -0500 Subject: [PATCH 3/6] textblob features hotfix --- awe_components/components/utility_functions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/awe_components/components/utility_functions.py b/awe_components/components/utility_functions.py index 67877df..8eb532b 100644 --- a/awe_components/components/utility_functions.py +++ b/awe_components/components/utility_functions.py @@ -3384,6 +3384,16 @@ def AWE_Info(document: Doc, raise AWE_Workbench_Error( 'Invalid indicator ' + indicator) + # QUICK FIX: spacytextblob no longer references polarity, subjectivity, + # nor assessments via doc._.X, but rather doc._.blob.X + # We are quickly fixing this problem in AWE_Info + if indicator == "polarity": + indicator = "blob.polarity" + elif indicator == "subjectivity": + indicator = "blob.subjectivity" + elif indicator == "assessments": + indicator = "blob.assessments" + if infoType == 'Doc': baseInfo = createSpanInfo(indicator, document) From 384cca0970a977ce30c8f323fd3361af41ea2642 Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Sun, 2 Feb 2025 16:39:42 -0500 Subject: [PATCH 4/6] Added spacytextblob doc feature name fix --- awe_components/components/utility_functions.py | 3 +++ awe_components/components/viewpointFeatures.py | 14 +++++++------- setup.cfg | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/awe_components/components/utility_functions.py b/awe_components/components/utility_functions.py index 8eb532b..4230716 100644 --- a/awe_components/components/utility_functions.py +++ b/awe_components/components/utility_functions.py @@ -2899,6 +2899,9 @@ def setTokenEntry(name, token, value): # attribute. # # TBD: put security check in for this # ####################################### + elif "blob" in name: + name = name.replace("blob.", "") + entry['value'] = getattr(token._.blob, name) elif token.has_extension(name): # TODO: Use Token.get_extension # https://spacy.io/api/token diff --git a/awe_components/components/viewpointFeatures.py b/awe_components/components/viewpointFeatures.py index 92d10ef..d257127 100644 --- a/awe_components/components/viewpointFeatures.py +++ b/awe_components/components/viewpointFeatures.py @@ -4636,15 +4636,15 @@ def propagateNegation(self, doc: Doc): # neutral. if tok._.vwp_evaluation \ or tok._.vwp_hedge \ - or tok.text in doc._.assessments: - if tok._.polarity < 0 or tok._.sentiword < 0: - tok._.vwp_tone_ = min(tok._.polarity, tok._.sentiword) - elif tok._.polarity > 0 and tok._.sentiword > 0: - tok._.vwp_tone_ = max(tok._.polarity, tok._.sentiword) + or tok.text in doc._.blob.sentiment_assessments.assessments: + if tok._.blob.sentiment_assessments.polarity < 0 or tok._.sentiword < 0: + tok._.vwp_tone_ = min(tok._.sentiment_assessments.polarity, tok._.sentiword) + elif tok._.sentiment_assessments.polarity > 0 and tok._.sentiword > 0: + tok._.vwp_tone_ = max(tok._.sentiment_assessments.polarity, tok._.sentiword) else: - tok._.vwp_tone_ = (tok._.polarity + tok._.sentiword) / 2 + tok._.vwp_tone_ = (tok._.sentiment_assessments.polarity + tok._.sentiword) / 2 else: - tok._.vwp_tone_ = min(tok._.polarity, tok._.sentiword) + tok._.vwp_tone_ = min(tok._.sentiment_assessments.polarity, tok._.sentiword) # rule order fixes to the tone variable are generally a bad idea, # but these are so common that fixing them gets rid of a lot of diff --git a/setup.cfg b/setup.cfg index 66901e6..66536f8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ python_requires = >=3.9 cmdclass = install = install.AWEInstall install_requires = - awe_lexica @ git+https://github.com/ArgLab/AWE_Lexica.git + awe_lexica @ git+https://github.com/ArgLab/AWE_Lexica.git@varname-patch spacy coreferee rdflib From c8a874d4bfc7346182ab977b3bd07396d83c32cd Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Sun, 2 Feb 2025 16:46:03 -0500 Subject: [PATCH 5/6] Added blob --- awe_components/components/viewpointFeatures.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/awe_components/components/viewpointFeatures.py b/awe_components/components/viewpointFeatures.py index d257127..6f32fac 100644 --- a/awe_components/components/viewpointFeatures.py +++ b/awe_components/components/viewpointFeatures.py @@ -4638,13 +4638,13 @@ def propagateNegation(self, doc: Doc): or tok._.vwp_hedge \ or tok.text in doc._.blob.sentiment_assessments.assessments: if tok._.blob.sentiment_assessments.polarity < 0 or tok._.sentiword < 0: - tok._.vwp_tone_ = min(tok._.sentiment_assessments.polarity, tok._.sentiword) - elif tok._.sentiment_assessments.polarity > 0 and tok._.sentiword > 0: - tok._.vwp_tone_ = max(tok._.sentiment_assessments.polarity, tok._.sentiword) + tok._.vwp_tone_ = min(tok._.blob.sentiment_assessments.polarity, tok._.sentiword) + elif tok._.blob.sentiment_assessments.polarity > 0 and tok._.sentiword > 0: + tok._.vwp_tone_ = max(tok._.blob.sentiment_assessments.polarity, tok._.sentiword) else: - tok._.vwp_tone_ = (tok._.sentiment_assessments.polarity + tok._.sentiword) / 2 + tok._.vwp_tone_ = (tok._.blob.sentiment_assessments.polarity + tok._.sentiword) / 2 else: - tok._.vwp_tone_ = min(tok._.sentiment_assessments.polarity, tok._.sentiword) + tok._.vwp_tone_ = min(tok._.blob.sentiment_assessments.polarity, tok._.sentiword) # rule order fixes to the tone variable are generally a bad idea, # but these are so common that fixing them gets rid of a lot of From 41758d3b8bbd866a434dc06361eb90487f690527 Mon Sep 17 00:00:00 2001 From: duckduckdoof Date: Thu, 17 Apr 2025 11:47:31 -0400 Subject: [PATCH 6/6] Removed branch for lexica --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 66536f8..66901e6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,7 @@ python_requires = >=3.9 cmdclass = install = install.AWEInstall install_requires = - awe_lexica @ git+https://github.com/ArgLab/AWE_Lexica.git@varname-patch + awe_lexica @ git+https://github.com/ArgLab/AWE_Lexica.git spacy coreferee rdflib