Below is the algorithm implemented in the
gensim library called "TextRank" , which is based on the PageRank algorithm to rank search results.
- Pre-process this text. This includes removing stopwords, removing punctuation, and traversing.
- Construct a graph with vertex sentences.
- A graph has edges indicating the similarity between two sentences at the vertices.
- Run the PageRank algorithm on this weighted graph.
- Select the vertices with the highest score and add them to the summary.
- Based on the ratio or word count, the number of vertices selected is determined.
Code: Summarizes a Wikipedia entry based on (a) ratio and (b) word count.
Percent summary Amitabh Bachchan (pronounced [? m ?? ta? b? ? b? t ??? n]; born Inquilaab Srivastava; 11 October 1942) is an Indian film actor, film producer, television host, occasional playback singer and former politician. He first gained popularity in the early 1970s for films such as Zanjeer, Deewaar and Sholay, and was dubbed India’s "angry young man" for his on-screen roles in Bollywood. ... ... ... Apart from National Film Awards, Filmfare Awards and other competitive awards which Bachchan won for his performances throughout the years, he has been awarded several honors for his achievements in the Indian film industry.
Word count summary Beyond the Indian subcontinent, he also has a large overseas following in markets including Africa (such as South Africa), the Middle East (especially Egypt), United Kingdom, Russia and parts of the United States. Bachchan has won numerous accolades in his career, including four National Film Awards as Best Actor and many awards at international film festivals and award ceremonies. ... ... ... After a three year stint in politics from 1984 to 1987, Bachchan returned to films in 1988, playing the title role in Shahenshah, which was a box office success.