benchmarkstt.normalization package

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e7f2fa', 'lineColor': '#2980B9' }}}%% classDiagram Normalizer File FileFactory NormalizationAggregate NormalizerWithFileSupport Normalizer <|-- NormalizerWithFileSupport Normalizer <|-- NormalizationAggregate Normalizer <|-- File CoreFactory <|-- FileFactory class Normalizer { <<abstract>> normalize(text)$ } class NormalizerWithFileSupport { <<abstract>> normalize(text)$ } class NormalizationAggregate { +add(normalizer) normalize(text)$ title=None } class File { normalize(text)$ normalizer file encoding=None path=None } class FileFactory { <<mapping>> <<contains>> <<iterable>> +create(name, file=None, encoding=None, path=None) +is_valid(*args, **kwargs) +keys() +register(*args, **kwargs) add_supported_namespace(namespace)$ base_class allow_duck=None }

Responsible for normalization of text.

class benchmarkstt.normalization.File(normalizer, file, encoding=None, path=None)[source]

Bases: benchmarkstt.normalization.Normalizer

Read one per line and pass it to the given normalizer

Parameters
  • normalizer (str|class) -- Normalizer name (or class)

  • file -- The file to read rules from

  • encoding -- The file encoding

Example text

"This is an Ex-Parakeet"

Example normalizer

"regex"

Example file

"./resources/test/normalizers/regex/en_US"

Example encoding

"UTF-8"

Example return

"This is an Ex Parrot"

_normalize(text: str) → str[source]
class benchmarkstt.normalization.FileFactory(base_class, allow_duck=None)[source]

Bases: benchmarkstt.factory.CoreFactory

create(name, file=None, encoding=None, path=None)[source]
class benchmarkstt.normalization.NormalizationAggregate(title=None)[source]

Bases: benchmarkstt.normalization.Normalizer

Combining normalizers

_normalize(text: str) → str[source]
add(normalizer)[source]

Adds a normalizer to the composite "stack"

class benchmarkstt.normalization.Normalizer[source]

Bases: benchmarkstt.normalization._NormalizerNoLogs

Abstract base class for normalization

abstract _normalize(text: str) → str[source]
normalize(text)

Returns normalized text with rules supplied by the called class.

class benchmarkstt.normalization.NormalizerWithFileSupport[source]

Bases: benchmarkstt.normalization.Normalizer

This kind of normalization class supports loading the values from a file, i.e. being wrapped in a core.File wrapper.

abstract _normalize(text: str) → str[source]

Submodules