Skip to main content

A Python package to get useful information from documents using TopicRank Algorithm.

Project description

Important topics/phrases extraction using TopicRank algorithm.


TopicRank is an unsupervised method that aims to extract keyphrases from the most important topics of a document. Topics are defined as clusters of similar keyphrase candidates. This new method is an improvement of the TextRank method applied to keyphrase extraction (Mihalcea and Tarau,2004). In the TextRank method, a document is represented by a graph where words are vertices and edges represent co-occurrence relations. A graph-based ranking model derived from PageRank (Brin and Page, 1998) is then used to assign a significance score to each word. TopicRank represents a document as a complete graph where vertices are not words but topics. It defines a topic as a cluster of similar single and multi-word expressions.

1. Topic Identification and Clustering:

This project follows Wan and Xiao (2008) and extract the longest sequences of nouns and adjectives from the document as keyphrase candidates. Other methods use syntactically filtered n-grams that are most likely to contain a larger number of candidates matching with reference keyphrases, but the n-gram restricted length is a problem. Indeed, n-grams do not always capture as much information as the longest noun phrases. Also, they are less likely to be grammatically correct.

To automatically group similar noun phrases as a single entity, this project uses Hirearchical Agglomerative Clustering algorithm. For this clustering algorithm, vectorized text has been passed to "Jaccard" corfficient for finding similarity between phrases.

2. Graph-Based Ranking:

TextRank(Graph-based ranking model) is used to assign significance score to each topic.To understand how textrank algorithm works please refer :

Getting Started

Using this library, you will be able to extract meaningful information from documents like:

  • Top N phrases
  • Url's
  • Email Id's
  • Phone numbers
  • Important names


pip3 install topicrankpy

from topicrankpy import extractinformation as t


Output: For testing purpose, I have used my Resume.

  'Top_Phrases_With_Ranking': [
    ('data engineering',
    ('machine learning',
    ('android application',
    ('deep learning',
    ('cloud services',
  'Phone_Numbers': [
  'Email_address': [
  'Important Names': [
    'Aayush Patel',
    'AWS Certified Solutions Architect',
    'Award Machine Learning Artificial Intelligence',
    'Advance Data Science',
    'Google Play Store',
    'Chahal Academy',
    'Apache Spark Hadoop',
    'Kafka Streams',
    'Apache Cassandra',
    'Amazon Kinesis',
    'Amazon EMR',
    'Elastic Map Reduce',
    'Machine Learning Deep',
    'Data Preprocessing',
    'Open CV',
    'Amazon Web Services',
    'Google Cloud Platform',
    'Linux Windows',
    'Teksun Lab Pvt',
    'Machine Learning Intern',
    'Experts Hub',
    'Sardar Vallabhbhai Patel Institute Technology',
    'Desktop Application',
    'Apache Kafka',
    'Apache Cassandra Elasticsearch',
    'Twitter API',
    'Elastic Load Transform',
    'Kafka Connector Sink',
    'Ontario Fire Code',
    'Build Log Analytics Solutions',
    'Google Play Store',
    'Trent University'
  'URLS': [

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topicrankpy-1.1.0.tar.gz (20.7 kB view hashes)

Uploaded Source

Built Distribution

topicrankpy-1.1.0-py3-none-any.whl (21.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page