Giter Site home page Giter Site logo

roy029 / pytextrank Goto Github PK

View Code? Open in Web Editor NEW

This project forked from derwenai/pytextrank

0.0 0.0 0.0 1.53 MB

Python implementation of TextRank for phrase extraction and summarization of text documents

Home Page: https://derwen.ai/docs/ptr/

License: MIT License

Python 49.48% Jupyter Notebook 50.25% Shell 0.27%

pytextrank's Introduction

PyTextRank

DOI Licence Repo size GitHub commit activity Checked with mypy security: bandit Language grade: Python

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 textgraphs 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:

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("en_core_web_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

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 or use Conda.

To set up the build environment locally, see the "Build Instructions" 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.txt

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-2021 Derwen, Inc.

Attribution

Please use the following BibTeX entry for citing PyTextRank if you use it in your research or software:

@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, @Lord-V15, @anna-droid-beep, @dvsrepo, @kavorite, @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.

pytextrank's People

Contributors

ceteri avatar ankush-chander avatar louisguitton avatar mnowotka avatar harshgrandeur avatar jake-aft avatar junchen1992 avatar saithejeshwar avatar anna-droid-beep avatar dimmu avatar kjam avatar kavorite avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.