NonBlankFilter#

class scikitplot.corpus.NonBlankFilter[source]#

Keep every document whose text holds a non-whitespace character.

For documents whose every line is content: a short block of code (y = 2, a closing }, end Foo) is not noise, and DefaultFilter, built for prose, would drop it. CodeAwareFilter applies this rule to code and DefaultFilter to the rest.

Examples

>>> f = NonBlankFilter()
>>> f.include(CorpusDocument.create("f.py", 0, "}"))
True
>>> f.include(CorpusDocument.create("f.py", 1, "42"))
True
include(doc)[source]#

Return True when doc’s text is not blank.

Parameters:

doc (CorpusDocument)

Return type:

bool