This part of the documentation covers all the interfaces of rake_nltk.
Metric Object¶
Rake Object¶
- class rake_nltk.Rake(stopwords: Optional[Set[str]] = None, punctuations: Optional[Set[str]] = None, language: str = 'english', ranking_metric: rake_nltk.rake.Metric = Metric.DEGREE_TO_FREQUENCY_RATIO, max_length: int = 100000, min_length: int = 1, include_repeated_phrases: bool = True, sentence_tokenizer: Optional[Callable[[str], List[str]]] = None, word_tokenizer: Optional[Callable[[str], List[str]]] = None)[source]¶
Rapid Automatic Keyword Extraction Algorithm.
- extract_keywords_from_sentences(sentences: List[str])[source]¶
Method to extract keywords from the list of sentences provided.
- Parameters
sentences – Text to extraxt keywords from, provided as a list of strings, where each string is a sentence.
- extract_keywords_from_text(text: str)[source]¶
Method to extract keywords from the text provided.
- Parameters
text – Text to extract keywords from, provided as a string.
- get_ranked_phrases() List[str] [source]¶
Method to fetch ranked keyword strings.
- Returns
List of strings where each string represents an extracted keyword string.
- get_ranked_phrases_with_scores() List[Tuple[float, str]] [source]¶
Method to fetch ranked keyword strings along with their scores.
- Returns
List of tuples where each tuple is formed of an extracted keyword string and its score. Ex: (5.68, ‘Four Scoures’)