Skip to content

Rake

RAKEKeywordExtraction

Bases: KeywordExtractionBase

Class for keyword extraction using RAKE.

Source code in src/keyword_extraction/rake.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class RAKEKeywordExtraction(KeywordExtractionBase):
    """
    Class for keyword extraction using RAKE.
    """

    def __init__(self, stopwords_path=None, **kwargs):
        super().__init__()
        self.model = Rake(stopwords_path)
        self.kwargs = kwargs

    def get_keywords(self, text: str) -> List[str]:
        """
        Returns the keywords of the text.
        :param text:
        :return:
        """
        return self.model.run(text, **self.kwargs)

get_keywords(text)

Returns the keywords of the text.

Parameters:

Name Type Description Default
text str
required

Returns:

Type Description
List[str]
Source code in src/keyword_extraction/rake.py
18
19
20
21
22
23
24
def get_keywords(self, text: str) -> List[str]:
    """
    Returns the keywords of the text.
    :param text:
    :return:
    """
    return self.model.run(text, **self.kwargs)