Delete text.py
Browse files
text.py
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
# """ from https://github.com/keithito/tacotron """
|
2 |
-
|
3 |
-
# """
|
4 |
-
# Cleaners are transformations that run over the input text at both training and eval time.
|
5 |
-
|
6 |
-
# Cleaners can be selected by passing a comma-delimited list of cleaner names as the "cleaners"
|
7 |
-
# hyperparameter. Some cleaners are English-specific. You'll typically want to use:
|
8 |
-
# 1. "english_cleaners" for English text
|
9 |
-
# 2. "transliteration_cleaners" for non-English text that can be transliterated to ASCII using
|
10 |
-
# the Unidecode library (https://pypi.python.org/pypi/Unidecode)
|
11 |
-
# 3. "basic_cleaners" if you do not want to transliterate (in this case, you should also update
|
12 |
-
# the symbols in symbols.py to match your data).
|
13 |
-
# """
|
14 |
-
|
15 |
-
# import re
|
16 |
-
# from mynumbers import normalize_numbers
|
17 |
-
# from unidecode import unidecode
|
18 |
-
|
19 |
-
# # Regular expression matching whitespace:
|
20 |
-
# _whitespace_re = re.compile(r"\s+")
|
21 |
-
|
22 |
-
# # List of (regular expression, replacement) pairs for abbreviations:
|
23 |
-
# _abbreviations = [
|
24 |
-
# (re.compile("\\b%s\\." % x[0], re.IGNORECASE), x[1])
|
25 |
-
# for x in [
|
26 |
-
# ("mrs", "misess"),
|
27 |
-
# ("mr", "mister"),
|
28 |
-
# ("dr", "doctor"),
|
29 |
-
# ("st", "saint"),
|
30 |
-
# ("co", "company"),
|
31 |
-
# ("jr", "junior"),
|
32 |
-
# ("maj", "major"),
|
33 |
-
# ("gen", "general"),
|
34 |
-
# ("drs", "doctors"),
|
35 |
-
# ("rev", "reverend"),
|
36 |
-
# ("lt", "lieutenant"),
|
37 |
-
# ("hon", "honorable"),
|
38 |
-
# ("sgt", "sergeant"),
|
39 |
-
# ("capt", "captain"),
|
40 |
-
# ("esq", "esquire"),
|
41 |
-
# ("ltd", "limited"),
|
42 |
-
# ("col", "colonel"),
|
43 |
-
# ("ft", "fort"),
|
44 |
-
# ]
|
45 |
-
# ]
|
46 |
-
|
47 |
-
|
48 |
-
# def expand_abbreviations(text):
|
49 |
-
# for regex, replacement in _abbreviations:
|
50 |
-
# text = re.sub(regex, replacement, text)
|
51 |
-
# return text
|
52 |
-
|
53 |
-
|
54 |
-
# def expand_numbers(text):
|
55 |
-
# return normalize_numbers(text)
|
56 |
-
|
57 |
-
|
58 |
-
# def lowercase(text):
|
59 |
-
# return text.lower()
|
60 |
-
|
61 |
-
|
62 |
-
# def collapse_whitespace(text):
|
63 |
-
# return re.sub(_whitespace_re, " ", text)
|
64 |
-
|
65 |
-
|
66 |
-
# def convert_to_ascii(text):
|
67 |
-
# return unidecode(text)
|
68 |
-
|
69 |
-
|
70 |
-
# def basic_cleaners(text):
|
71 |
-
# """Basic pipeline that lowercases and collapses whitespace without transliteration."""
|
72 |
-
# text = lowercase(text)
|
73 |
-
# text = collapse_whitespace(text)
|
74 |
-
# return text
|
75 |
-
|
76 |
-
|
77 |
-
# def transliteration_cleaners(text):
|
78 |
-
# """Pipeline for non-English text that transliterates to ASCII."""
|
79 |
-
# text = convert_to_ascii(text)
|
80 |
-
# text = lowercase(text)
|
81 |
-
# text = collapse_whitespace(text)
|
82 |
-
# return text
|
83 |
-
|
84 |
-
|
85 |
-
# def english_cleaners(text):
|
86 |
-
# """Pipeline for English text, including number and abbreviation expansion."""
|
87 |
-
# text = convert_to_ascii(text)
|
88 |
-
# text = lowercase(text)
|
89 |
-
# text = expand_numbers(text)
|
90 |
-
# text = expand_abbreviations(text)
|
91 |
-
# text = collapse_whitespace(text)
|
92 |
-
# return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|