Source code for nlp_primitives.whitespace_count

# -*- coding: utf-8 -*-

from .count_string import CountString


[docs]class WhitespaceCount(CountString): """Calculates number of whitespaces in a string. Description: Given a list of strings, determine the whitespaces in each string If a string is missing, return `NaN` Examples: >>> x = ['', 'hi im ethan', 'multiple spaces'] >>> upper_case_count = WhitespaceCount() >>> upper_case_count(x).tolist() [0.0, 2.0, 4.0] """ name = "whitespace_count" default_value = 0
[docs] def __init__(self): super().__init__(string=" ")