adaptkeybert-0.0.2
توضیحات
AdaptKeyBERT extended keyphrase extraction with zero-shot and few-shot semi-supervised domain adaptation.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Unix |
| نام فایل | adaptkeybert-0.0.2 |
| نام | adaptkeybert |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Aman Priyanshu |
| ایمیل نویسنده | amanpriyanshusms2001@gmail.com |
| آدرس صفحه اصلی | https://github.com/AmanPriyanshu/AdaptKeyBERT |
| آدرس اینترنتی | https://pypi.org/project/adaptkeybert/ |
| مجوز | - |
<img src="https://github.com/AmanPriyanshu/AdaptKeyBERT/blob/master/images/keybert_logo.png" width="35%" height="35%" align="right" />
# AdaptKeyBERT
KeyBERT is a minimal and easy-to-use keyword extraction technique that leverages BERT embeddings to create keywords and keyphrases that are most similar to a document.
AdaptKeyBERT expands the aforementioned library by integrating semi-supervised attention for creating a few-shot domain adaptation technique for keyphrase extraction. Also extended the work by allowing zero-shot word seeding, allowing better performance on topic relevant documents
## Basic Use:
Take a look at `runner.py`
```py
from adaptkeybert import KeyBERT
doc = """
Supervised learning is the machine learning task of learning a function that
maps an input to an output based on example input-output pairs. It infers a
function from labeled training data consisting of a set of training examples.
In supervised learning, each example is a pair consisting of an input object
(typically a vector) and a desired output value (also called the supervisory signal).
A supervised learning algorithm analyzes the training data and produces an inferred function,
which can be used for mapping new examples. An optimal scenario will allow for the
algorithm to correctly determine the class labels for unseen instances. This requires
the learning algorithm to generalize from the training data to unseen situations in a
'reasonable' way (see inductive bias). But then what about supervision and unsupervision, what happens to unsupervised learning.
"""
kw_model = KeyBERT()
keywords = kw_model.extract_keywords(doc, top_n=10)
print(keywords)
kw_model = KeyBERT(domain_adapt=True)
kw_model.pre_train([doc], [['supervised', 'unsupervised']], lr=1e-3)
keywords = kw_model.extract_keywords(doc, top_n=10)
print(keywords)
kw_model = KeyBERT(zero_adapt=True)
kw_model.zeroshot_pre_train(['supervised', 'unsupervised'], adaptive_thr=0.15)
keywords = kw_model.extract_keywords(doc, top_n=10)
print(keywords)
kw_model = KeyBERT(domain_adapt=True, zero_adapt=True)
kw_model.pre_train([doc], [['supervised', 'unsupervised']], lr=1e-3)
kw_model.zeroshot_pre_train(['supervised', 'unsupervised'], adaptive_thr=0.15)
keywords = kw_model.extract_keywords(doc, top_n=10)
print(keywords)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.3.8 | sentence-transformers |
| >=0.22.2 | scikit-learn |
| >=1.18.5 | numpy |
| >=10.4.0 | rich |
| >=1.1 | mkdocs |
| >=4.6.3 | mkdocs-material |
| >=0.8.0 | mkdocstrings |
| >=5.4.3 | pytest |
| >=2.6.1 | pytest-cov |
| >=3.6.0 | flake8 |
| >=2.2.0 | pre-commit |
| >=19.3b0 | black |
| >=1.1 | mkdocs |
| >=4.6.3 | mkdocs-material |
| >=0.8.0 | mkdocstrings |
| >=3.5.1 | transformers |
| >=1.4.0 | torch |
| >=0.7 | flair |
| >=3.6.0 | gensim |
| >=3.0.1 | spacy |
| >=5.4.3 | pytest |
| >=2.6.1 | pytest-cov |
| >=3.6.0 | flake8 |
| >=2.2.0 | pre-commit |
| >=19.3b0 | black |
| - | tensorflow |
| - | tensorflow-hub |
| - | tensorflow-text |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl adaptkeybert-0.0.2:
pip install adaptkeybert-0.0.2.whl
نصب پکیج tar.gz adaptkeybert-0.0.2:
pip install adaptkeybert-0.0.2.tar.gz