Skip to content

Argument of type "None" cannot be assigned to parameter "stop_words" of type "str | List[str]" in function "extract_keywords" #265

@VictorCrd

Description

@VictorCrd

Small warning between the documentation and the code implementation (nothing serious)

With the bellow code I have a warning:
Argument of type "None" cannot be assigned to parameter "stop_words" of type "str | List[str]" in function "extract_keywords"
Type "None" is not assignable to type "str | List[str]"
"None" is not assignable to "str"
"None" is not assignable to "List[str]"

sim = kw_model.extract_keywords(text,
                                keyphrase_ngram_range=(1, 1), 
                                stop_words=None,
                                vectorizer=vectorizer,
                                top_n=list_words.__len__())

I'm not sure this is intended, as in the following example in the documentation, stop_words is None.

>>> kw_model.extract_keywords(doc, keyphrase_ngram_range=(1, 1), stop_words=None)
[('learning', 0.4604),
 ('algorithm', 0.4556),
 ('training', 0.4487),
 ('class', 0.4086),
 ('mapping', 0.3700)]

So should the documentation or code be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions