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"
-
class
benchmarkstt.normalization.
NormalizationAggregate
(title=None)[source]¶ Bases:
benchmarkstt.normalization.Normalizer
Combining normalizers
-
class
benchmarkstt.normalization.
Normalizer
[source]¶ Bases:
benchmarkstt.normalization._NormalizerNoLogs
Abstract base class for normalization
-
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.