pytextrank

Python implementation of TextRank algorithms ("textgraphs") for phrase extraction

https://github.com/derwenai/pytextrank

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: scholar.google, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.0%) to scientific vocabulary

Keywords

graph-algorithms machine-learning natural-language natural-language-processing nlp python spacy spacy-extension summarization textgraphs textrank

Keywords from Contributors

graph-libraries graph-thinking inference json-ld knowledge-graph networkx owl parquet python-igraph pyvis
Last synced: 6 months ago · JSON representation ·

Repository

Python implementation of TextRank algorithms ("textgraphs") for phrase extraction

Basic Info
Statistics
  • Stars: 2,188
  • Watchers: 64
  • Forks: 333
  • Open Issues: 19
  • Releases: 22
Topics
graph-algorithms machine-learning natural-language natural-language-processing nlp python spacy spacy-extension summarization textgraphs textrank
Created over 9 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation Security

README.md

PyTextRank

DOI Licence Repo size GitHub commit activity Checked with mypy security: bandit CI downloads sponsor

PyTextRank is a Python implementation of TextRank as a spaCy pipeline extension, for graph-based natural language work -- and related knowledge graph practices. This includes the family of textgraph algorithms:

Popular use cases for this library include:

  • phrase extraction: get the top-ranked phrases from a text document
  • low-cost extractive summarization of a text document
  • help infer concepts from unstructured text into more structured representation

See our full documentation at: https://derwen.ai/docs/ptr/

Getting Started

See the "Getting Started" section of the online documentation.

To install from PyPi: python3 -m pip install pytextrank python3 -m spacy download en_core_web_sm

If you work directly from this Git repo, be sure to install the dependencies as well: python3 -m pip install -r requirements.txt

Alternatively, to install dependencies using conda: conda env create -f environment.yml conda activate pytextrank

Then to use the library with a simple use case: ```python import spacy import pytextrank

example text

text = "Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types."

load a spaCy model, depending on language, scale, etc.

nlp = spacy.load("encoreweb_sm")

add PyTextRank to the spaCy pipeline

nlp.add_pipe("textrank") doc = nlp(text)

examine the top-ranked phrases in the document

for phrase in doc._.phrases: print(phrase.text) print(phrase.rank, phrase.count) print(phrase.chunks) ```

See the tutorial notebooks in the examples subdirectory for sample code and patterns to use in integrating PyTextTank with related libraries in Python: https://derwen.ai/docs/ptr/tutorial/

Contributing Code We welcome people getting involved as contributors to this open source project! For detailed instructions please see: [CONTRIBUTING.md](https://github.com/DerwenAI/pytextrank/blob/main/CONTRIBUTING.md)
Build Instructions Note: unless you are contributing code and updates, in most use cases won't need to build this package locally. Instead, simply install from [PyPi](https://pypi.python.org/pypi/pytextrank) or use [Conda](https://docs.conda.io/). To set up the build environment locally, see the ["Build Instructions"](https://derwen.ai/docs/ptr/build/) section of the online documentation.
Semantic Versioning Generally speaking the major release number of PyTextRank will track with the major release number of the associated spaCy version. See: [CHANGELOG.md](https://github.com/DerwenAI/pytextrank/blob/main/CHANGELOG.md)

thanks noam!

License and Copyright

Source code for PyTextRank plus its logo, documentation, and examples have an MIT license which is succinct and simplifies use in commercial applications.

All materials herein are Copyright © 2016-2024 Derwen, Inc.

Attribution

Please use the following BibTeX entry for citing PyTextRank if you use it in your research or software: bibtex @software{PyTextRank, author = {Paco Nathan}, title = {{PyTextRank, a Python implementation of TextRank for phrase extraction and summarization of text documents}}, year = 2016, publisher = {Derwen}, doi = {10.5281/zenodo.4637885}, url = {https://github.com/DerwenAI/pytextrank} }

Citations are helpful for the continued development and maintenance of this library. For example, see our citations listed on Google Scholar.

Kudos

Many thanks to our open source sponsors; and to our contributors: @ceteri, @louisguitton, @Ankush-Chander, @tomaarsen, @CaptXiong, @Lord-V15, @anna-droid-beep, @dvsrepo, @clabornd, @dayalstrub-cma, @kavorite, @0dB, @htmartin, @williamsmj, @mattkohl, @vanita5, @HarshGrandeur, @mnowotka, @kjam, @SaiThejeshwar, @laxatives, @dimmu, @JasonZhangzy1757, @jake-aft, @junchen1992, @shyamcody, @chikubee; also to @mihalcea who leads outstanding NLP research work, encouragement from the wonderful folks at Explosion who develop spaCy, plus general support from Derwen, Inc.

Star History

Star History Chart

Owner

  • Name: derwen.ai
  • Login: DerwenAI
  • Kind: organization
  • Location: Sebastopol, CA

We provide enterprise customers with full-stack engineering for AI applications at enterprise scale, emphasizing open source integration.

Citation (CITATION)

@software{PyTextRank,
  author = {Paco Nathan},
  title = {{PyTextRank, a Python implementation of TextRank for phrase extraction and summarization of text documents}},
  year = 2016,
  publisher = {Derwen},
  doi = {10.5281/zenodo.4602393},
  url = {https://github.com/DerwenAI/pytextrank}
}

GitHub Events

Total
  • Create event: 2
  • Commit comment event: 5
  • Issues event: 1
  • Watch event: 54
  • Issue comment event: 3
  • Member event: 1
  • Push event: 2
  • Pull request event: 1
  • Fork event: 1
Last Year
  • Create event: 2
  • Commit comment event: 5
  • Issues event: 1
  • Watch event: 54
  • Issue comment event: 3
  • Member event: 1
  • Push event: 2
  • Pull request event: 1
  • Fork event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 327
  • Total Committers: 19
  • Avg Commits per committer: 17.211
  • Development Distribution Score (DDS): 0.287
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Paco Nathan c****i@g****m 233
Tom Aarsen C****v@g****m 32
Ankush-Chander a****r@g****m 30
Louis Guitton l****3@g****m 8
snyk-bot s****t@s****o 6
Ben Han b****n@d****m 2
0dB 0****B 2
Daniel Claborne d****e@g****m 2
Michał Nowotka m****w@g****m 2
HarshGrandeur h****3@g****m 1
Jake Carter 3****t 1
kjam k****l@g****m 1
æriess i****e@g****m 1
DayalStrub s****l@g****m 1
Jun Chen j****2@g****m 1
Sai Thejeshwar s****r@g****m 1
anna-droid-beep a****h@c****r 1
zhan xiong z****g@m****m 1
dimmu d****s@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 60
  • Total pull requests: 79
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 26 days
  • Total issue authors: 44
  • Total pull request authors: 11
  • Average comments per issue: 2.87
  • Average comments per pull request: 0.54
  • Merged pull requests: 60
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ceteri (4)
  • louisguitton (4)
  • Ankush-Chander (3)
  • 0dB (3)
  • DayalStrub (3)
  • Fan-Luo (2)
  • Ayenem (2)
  • BrandonKMLee (2)
  • debraj135 (2)
  • Chtchou (1)
  • Jansonboss (1)
  • nv-rliu (1)
  • lisabecker-ml6 (1)
  • merrillaldrich (1)
  • liuvic (1)
Pull Request Authors
  • ceteri (61)
  • Ankush-Chander (8)
  • tomaarsen (5)
  • snyk-bot (4)
  • louisguitton (3)
  • sww (2)
  • jake-aft (2)
  • clabornd (1)
  • dayalstrub-cma (1)
  • 0dB (1)
  • CaptXiong (1)
Top Labels
Issue Labels
question (30) enhancement (16) good first issue (9) howto (9) kg (9) help wanted (8) bug (7) summarization (1)
Pull Request Labels
enhancement (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 105,026 last-month
  • Total docker downloads: 605
  • Total dependent packages: 6
    (may contain duplicates)
  • Total dependent repositories: 90
    (may contain duplicates)
  • Total versions: 64
  • Total maintainers: 1
pypi.org: pytextrank

Python implementation of TextRank as a spaCy pipeline extension, for graph-based natural language work plus related knowledge graph practices; used for for phrase extraction of text documents.

  • Documentation: https://pytextrank.readthedocs.io/
  • License: MIT License Copyright (c) 2016-2022 Derwen, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 3.3.0
    published almost 2 years ago
  • Versions: 20
  • Dependent Packages: 6
  • Dependent Repositories: 90
  • Downloads: 105,026 Last month
  • Docker Downloads: 605
Rankings
Dependent packages count: 1.4%
Downloads: 1.5%
Dependent repos count: 1.6%
Stargazers count: 1.6%
Average: 2.1%
Forks count: 2.8%
Docker downloads count: 4.0%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/DerwenAI/pytextrank
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/derwenai/pytextrank
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

environment.yml pypi
  • icecream >=2.0
requirements-dev.txt pypi
  • bandit * development
  • check-manifest >=0.48 development
  • codespell * development
  • coverage * development
  • flask * development
  • grayskull * development
  • jupyterlab >=3.1.4 development
  • mistune * development
  • mkdocs-git-revision-date-plugin * development
  • mkdocs-material * development
  • mknotebooks * development
  • mkrefs >=0.2.0 development
  • mypy * development
  • nbconvert >=6.4 development
  • nbmake >=1.0 development
  • notebook >=6.1.5 development
  • pipdeptree * development
  • pre-commit * development
  • pylint >=2.7.0 development
  • pymdown-extensions * development
  • pytest * development
  • selenium * development
  • twine * development
  • wheel * development
requirements-viz.txt pypi
  • altair >=4.1.0
requirements.txt pypi
  • graphviz >=0.13
  • icecream >=2.1
  • networkx >=2.6
  • pygments >=2.7.4
  • scipy >=1.7
  • spacy >=3.0