Automatic_keyword_generator

class automatic_keyword_generator.Keyword_generator(text)[source]

Bases: object

Class containing various algorithms to generate keywords. Algorithms include Yake, Gensim, Rake, Bert, Spacy.

BERT(n_gram=1, top_n=5)[source]

Function containing BERT algorithm to extract keywords

Parameters
  • n_gram (int) – No of continuous sequence of words to be used

  • top_n (int) – Ordered on relevancy, the number of top keywords to be returned

Returns

List of extracted keywords

Return type

List

Rake()[source]

Function containing RAKE algorithm to extract keywords

Parameters

None

Returns

List of extracted keywords

Return type

List

Spacy()[source]

Function containing Spacy algorithm to extract keywords

Parameters

None

Returns

List of extracted keywords

Return type

List

Yake(max_ngram_size, numOfKeywords, language='en', deduplication_threshold=0.9)[source]

Function containing YAKE algorithm to extract keywords

Parameters
  • max_ngram_size (int) – Int based on word grams

  • numOfKeywords (int) – Ordered on relevancy, the number of top keywords to be returned

  • language (int) – Language of the text (default = en)

  • deduplication_threshold (float) – Duplication of words in keywords

Returns

List of extracted keywords

Return type

List

gensim()[source]

Function containing Gensim Algorithm to extract keywords

Parameters

None

Returns

List of extracted keywords :rtype: List

automatic_keyword_generator.countVectorizer(n_gram, text)[source]

Function to get feature names (words) from the input text

Parameters
  • text (List of strings) – the text to be used to extract keywords from

  • n_gram (tuple) – tuple containing minimum and maximum values of n_gram

Returns

feature (read words) learned from the text

Return type

List of words