Graphical techniques for text mining.

View the Project on GitHub Jverma/TextGraphics

TextGraphics is a python module for graphical methods in text mining. It can create two types of graphs from a corpus of text files.

  1. sentenceGraph - nodes are sentences in the corpus and edges are defined between two nodes based on the cosine similarity of the normalized word frequency vectors of the sentences represented by the nodes.
  2. keywordGraph - nodes are keywords in the corpus and edges are defined between two nodes based on the co-occurances of the keywords represented by the nodes.

We choose a threshold for cosine similarity or co-occurance count.

Analysis package contains codes to study basic properties of the graphs and methods to plot the graphs. Also there is an implementation of Girvan-Newman algorithm for extracting the communities in the graph.

Applications imclude auto summarization based on LexRank and topic modeling.


  1. numpy
  2. networkx
  3. matplotlib
  4. nltk (for stemming only)


Install pip install textgraphics



from TextGraphics.src.graph import TextGraph

g = TextGraph(corpus)

senGraph = g.sentenceGraph()

keyGraph = g.keywordGraph()

from TextGraphics.Applications.summary import LexRank

lR = LexRank(corpus)


See testCode.py for usage.