chunkipy.size_estimators.word_size_estimator

Classes

WordSizeEstimator()

Size estimator that counts the number of words in the text.

class chunkipy.size_estimators.word_size_estimator.WordSizeEstimator[source]

Bases: BaseSizeEstimator

Size estimator that counts the number of words in the text.

estimate_size(text)[source]

Estimate the size of the given text by counting the number of words.

Parameters:

text (str) – The text to estimate the size of.

Returns:

The estimated size of the text in words.

Return type:

int

segment(text)[source]

Generate words from the given text using a regular expression.

Parameters:

text (str) – The text to analyze.

Yields:

str – A segment, representing of a word for estimation.

Return type:

Generator[str, None, None]