deduce

deduce.str

deduce.str.processor

class deduce.str.processor.UpperCase

Bases: StringModifier

Uppercase string.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.UpperCaseFirstChar

Bases: StringModifier

Uppercase first character.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.TitleCase

Bases: StringModifier

Titlecase string.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.TakeLastToken

Bases: StringModifier

Take the last token, split by string.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.RemoveValues(filter_values: list[str])

Bases: StringModifier

Remove values as words (between whitespaces, or at start/end of text).

Parameters:

filter_values – The values to remove.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.Acronimify(split_value: str = ' ', join_value: str = '')

Bases: StringModifier

Acronimify, by splitting on string and taking the first character of each ‘word’.

Parameters:
  • split_value – The value to split on, default whitespace.

  • join_value – The value to join on, default empty string.

process(item: str) str

Processes a string by modifying it.

Parameters:

item – The input string.

Returns:

The output string.

class deduce.str.processor.FilterBasedOnLookupSet(filter_set: LookupSet, case_sensitive: bool = True)

Bases: StringFilter

Filter, based on LookupSet.

Parameters:
  • filter_set – The lookup set, containing the elements to filter

  • case_sensitive – Whether to filter case sensitive

filter(item: str) bool

Filters strings.

Parameters:

item – The input string.

Returns:

True to keep the item, False to remove it (same as filter builtin).