Skip to main content

Perke

tests pre-commit.ci PyPI Version Python Versions Documentation Status

Perke is a Python keyphrase extraction package for Persian language. It provides an end-to-end keyphrase extraction pipeline in which each component can be easily modified or extended to develop new models.

Installation

  • The easiest way to install is from PyPI:
    pip install perke
    
    Alternatively, you can install directly from GitHub:
    pip install git+https://github.com/alirezatheh/perke.git
    
  • Perke also requires a trained POS tagger model. We use Hazm's POS tagger model. You can easily download latest Hazm's POS tagger using the following command:
    python -m perke download
    
    Alternatively, you can use another model with same tag names and structure, and put it in the resources directory.

Simple Example

Perke provides a standardized API for extracting keyphrases from a text. Start by typing the 4 lines below to use TextRank keyphrase extractor.

from perke.unsupervised.graph_based import TextRank

# 1. Create a TextRank extractor.
extractor = TextRank()

# 2. Load the text.
extractor.load_text(input='text or path/to/input_file')

# 3. Build the graph representation of the text and weight the
#    words. Keyphrase candidates are composed of the 33 percent
#    highest weighted words.
extractor.weight_candidates(top_t_percent=0.33)

# 4. Get the 10 highest weighted candidates as keyphrases.
keyphrases = extractor.get_n_best(n=10)

For more in depth examples see the examples directory.

Documentation

Documentation and references are available at Read The Docs.

Implemented Models

Perke currently, implements the following keyphrase extraction models:

  • Unsupervised models
    • Graph-based models
      • TextRank: article by Mihalcea and Tarau, 2004
      • SingleRank: article by Wan and Xiao, 2008
      • TopicRank: article by Bougouin, Boudin and Daille, 2013
      • PositionRank: article by Florescu and Caragea, 2017
      • MultipartiteRank: article by Boudin, 2018

Acknowledgements

Perke is inspired by pke.

Metadata

Release files for perke 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perke 0.4.4
File Size Uploaded Provenance
perke-0.4.4.tar.gz 20.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for perke 0.4.4
File Interpreter ABI Platform
perke-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 45.3 kB

Release files / perke-0.4.4.tar.gz

Download URL perke-0.4.4.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a2277223d68d51e4a70ebf1ed0d7b91f6804c05e66c623750e7cc2ecddcc8617
BLAKE2b-256 checksum
How to use checksums
33a349f2b59bed4f550b0275de5bfc3bbb6c8f143ba648fe187a881cf30bc0f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / perke-0.4.4-py3-none-any.whl

Download URL perke-0.4.4-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc8f0777079e77e0b09ed4842b2e5632316548c6a52858de9d992cd7936008a2
BLAKE2b-256 checksum
How to use checksums
a25715d359c899837adfd6482b48dd6d7fdda46bd1e537859c5b136b5afb798d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for perke 0.4.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page