EntropyBasedKeyPhraseExtraction
This is the official implementation of the EntropyRank key phrase extractor from https://openreview.net/forum?id=WCTtOfIhsJ. Please cite the paper and star this repo if you find EntropyRank useful! Thanks!
@inproceedings{
tsvetkov2023entropyrank,
title={EntropyRank: Unsupervised Keyphrase Extraction via Side-Information Optimization for Language Model-based Text Compression},
author={Alexander Tsvetkov and Alon Kipnis},
booktitle={ICML 2023 Workshop Neural Compression: From Information Theory to Applications},
year={2023},
url={https://openreview.net/forum?id=WCTtOfIhsJ}
}
Installation
To install directly:
pip install entropyrank
To install from repository, from src/entropyrank run:
pip install -r requirements.txt
You also need to download the 'en_core_web_sm' model for spaCy, which can be done by running:
spacy download en_core_web_sm
Usage
To use the package, import EntropyRank from the module and create an instance of it:
from entropyrank import EntropyRank
extractor = EntropyRank()
Then, you can extract key phrases from a given text using the extract_key_phrases method:
phrases = extractor.extract_key_phrases(
text=text,
number_of_key_phrases=3,
)
The parameters of the extract_key_phrases method are:
text: the input text to extract key phrases from.number_of_key_phrases: the number of key phrases to extract.exclude_start_words_count: the number of words to exclude from the start of each key phrase when calculating its entropy.partition_method: can be STOP_WORDS or NOUN_PHRASES, decides how to partition the candidates.ranking_method: can be FIRST_WORD_ENTROPY or SUM_ENTROPY, whether to use the sum of entropy of the phrase or just the entropy of the first wordnormalize_by_word_statistics: a boolean indicating whether we want to normalize the entropy values by entropy statistics of word position.remove_personal_names: a boolean indicating whether to remove personal names from the evaluations or not.
Evaluation Demo
You can run the evaluation_demo notebook included in this repository under src/eval to get the benchmark results on common key phrase extraction tasks reported in the paper. Make sure to run pip install -r evaluation-requirements.txt beforehand
Metadata
Release files for entropyrank 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| entropyrank-1.0.3.tar.gz | 50.7 kB | Without provenance | Details for entropyrank-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| entropyrank-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for entropyrank-1.0.3-py3-none-any.whl |
Total release size: 91.6 kB
Release files / entropyrank-1.0.3.tar.gz
| Download URL | entropyrank-1.0.3.tar.gz |
|---|---|
| Size | 50.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3ce0da8d3fef36e1ce849f681a447dca6cb9e0e75e1aca81a1ea56c42262cde
|
|
BLAKE2b-256 checksum How to use checksums |
01398c941b1db2bbacb8e67463dfc24664596246b0b3e5a1b05f96bb320bf007
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / entropyrank-1.0.3-py3-none-any.whl
| Download URL | entropyrank-1.0.3-py3-none-any.whl |
|---|---|
| Size | 40.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7ca9497be3028e6902ffbf73a60f474da1fbfe4699a5616587b1597afc9b3c5
|
|
BLAKE2b-256 checksum How to use checksums |
bb0a0d72593a0ffafb50107e3a1672228116460915d6bf9604492cf76f34c682
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for entropyrank 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.