explosion / healthsea Goto Github PK
View Code? Open in Web Editor NEWHealthsea is a spaCy pipeline for analyzing user reviews of supplementary products for their effects on health.
License: MIT License
Healthsea is a spaCy pipeline for analyzing user reviews of supplementary products for their effects on health.
License: MIT License
These are the errors I get when I run this code:
import spacy
nlp = spacy.load("en_healthsea")
doc = nlp("This is great for joint pain")
print(doc._.health_effects)
These errors happen when I install spaCy 3.4.4
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
en-healthsea 0.0.1 requires spacy<3.3.0,>=3.2.0, but you have spacy 3.4.4 which is incompatible.
Traceback (most recent call last):
File "/home/my_pc/scispaCy/spaCy lessons/Entity_recognition.py", line 24, in <module>
nlp = spacy.load("en_healthsea")
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/__init__.py", line 54, in load
return util.load_model(
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 432, in load_model
return load_model_from_package(name, **kwargs) # type: ignore[arg-type]
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 467, in load_model_from_package
cls = importlib.import_module(name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/vasya/.local/lib/python3.10/site-packages/en_healthsea/__init__.py", line 4, in <module>
from . import clause_aggregation
File "/home/vasya/.local/lib/python3.10/site-packages/en_healthsea/clause_aggregation.py", line 6, in <module>
@Language.factory("healthsea.aggregation.v1")
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/language.py", line 470, in factory
raise ValueError(Errors.E853.format(name=name))
ValueError: [E853] Unsupported component factory name 'healthsea.aggregation.v1'. The character '.' is not permitted in factory names.
These errors happen when I install spaCy 3.2.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spacy-transformers 1.1.9 requires spacy<4.0.0,>=3.4.0, but you have spacy 3.2.0 which is incompatible.
en-core-web-sm 3.4.1 requires spacy<3.5.0,>=3.4.0, but you have spacy 3.2.0 which is incompatible.
en-core-web-md 3.4.1 requires spacy<3.5.0,>=3.4.0, but you have spacy 3.2.0 which is incompatible.
en-core-web-lg 3.4.1 requires spacy<3.5.0,>=3.4.0, but you have spacy 3.2.0 which is incompatible.
Traceback (most recent call last):
File "/home/my_pc/scispaCy/spaCy lessons/Entity_recognition.py", line 24, in <module>
nlp = spacy.load("en_healthsea")
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/__init__.py", line 51, in load
return util.load_model(
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 420, in load_model
return load_model_from_package(name, **kwargs) # type: ignore[arg-type]
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 453, in load_model_from_package
return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config) # type: ignore[attr-defined]
File "/home/vasya/.local/lib/python3.10/site-packages/en_healthsea/__init__.py", line 14, in load
return load_model_from_init_py(__file__, **overrides)
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 615, in load_model_from_init_py
return load_model_from_path(
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 488, in load_model_from_path
nlp = load_model_from_config(config, vocab=vocab, disable=disable, exclude=exclude)
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/util.py", line 525, in load_model_from_config
nlp = lang_cls.from_config(
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/language.py", line 1755, in from_config
nlp = lang_cls(vocab=vocab, create_tokenizer=create_tokenizer, meta=meta)
File "/home/vasya/.local/lib/python3.10/site-packages/spacy/language.py", line 162, in __init__
util.registry._entry_point_factories.get_all()
File "/home/vasya/.local/lib/python3.10/site-packages/catalogue/__init__.py", line 119, in get_all
result.update(self.get_entry_points())
File "/home/vasya/.local/lib/python3.10/site-packages/catalogue/__init__.py", line 134, in get_entry_points
result[entry_point.name] = entry_point.load()
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/__init__.py", line 1, in <module>
from . import architectures
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/architectures.py", line 6, in <module>
from .layers import TransformerModel, TransformerListener
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/layers/__init__.py", line 1, in <module>
from .listener import TransformerListener
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/layers/listener.py", line 4, in <module>
from ..data_classes import TransformerData
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/data_classes.py", line 12, in <module>
from .util import transpose_list
File "/home/vasya/.local/lib/python3.10/site-packages/spacy_transformers/util.py", line 9, in <module>
from thinc.api import get_torch_default_device
ImportError: cannot import name 'get_torch_default_device' from 'thinc.api' (/home/vasya/.local/lib/python3.10/site-packages/thinc/api.py)
Hi!I noticed that in the following line of code in the preprocess_clausecat.py file, at line 61 in the for loop while splitting the dataset into train and test set
for label in label_dict:
split = int(len(label_dict[label]) * eval_split)
train += label_dict[label][split:]
dev += label_dict[label][:split]
checksum += len(label_dict[label])
table_data.append(
(
label,
len(label_dict[label]),
len(label_dict[label][split:]),
len(label_dict[label][:split]),
)
)
the train and dev assignment statements need to be interchanged. As per the existing assignment, The train set has fewer samples than the dev set. Shouldn't it be the other way round?
Something like this?
train += label_dict[label][:split]
dev += label_dict[label][split:]
Sample input: Yam is great for joint pain but bad for liver disease
Code below:
`import spacy
nlp = spacy.load("en_healthsea")
doc = nlp("Yam is great for joint pain but bad for liver disease")
print(doc._.clauses)
print(doc._.health_effects)`
Output below:
[{'split_indices': (0, 11), 'has_ent': True, 'ent_indices': (4, 6), 'blinder': '_CONDITION_', 'ent_name': 'joint pain', 'cats': {'POSITIVE': 0.9715917110443115, 'NEUTRAL': 0.004003751091659069, 'NEGATIVE': 0.01367472019046545, 'ANAMNESIS': 0.010729866102337837}, 'prediction_text': ['Yam', 'is', 'great', 'for', '_CONDITION_', 'but', 'bad', 'for', 'liver', 'disease']}, {'split_indices': (0, 11), 'has_ent': True, 'ent_indices': (9, 11), 'blinder': '_CONDITION_', 'ent_name': 'liver disease', 'cats': {'POSITIVE': 0.9650901556015015, 'NEUTRAL': 0.004530671052634716, 'NEGATIVE': 0.023644359782338142, 'ANAMNESIS': 0.0067347269505262375}, 'prediction_text': ['Yam', 'is', 'great', 'for', 'joint', 'pain', 'but', 'bad', 'for', '_CONDITION_']}]
Expected 1 positive and another negative. Actually found 2 positive sentiments.
The links on the Hugging Face model card are incorrect.
Read more in the blog post and visit the healthsea repository for all training workflows, custom components and training data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.