mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-19 07:54:56 +00:00
type checking config
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
# For pytest
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=42", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"text/"
|
||||||
|
],
|
||||||
|
|
||||||
|
"exclude": [
|
||||||
|
".git/",
|
||||||
|
"**/*test_*.py",
|
||||||
|
"**/node_modules",
|
||||||
|
"**/__pycache__",
|
||||||
|
"NeMo/",
|
||||||
|
"hifi-gan/",
|
||||||
|
"hifigan/",
|
||||||
|
"nemo/",
|
||||||
|
"phonetics",
|
||||||
|
"python/",
|
||||||
|
"tacotron2/",
|
||||||
|
"temp/",
|
||||||
|
"waveglow/"
|
||||||
|
],
|
||||||
|
|
||||||
|
"ignore": [
|
||||||
|
"tacotron2/",
|
||||||
|
"**/*test_*.py"
|
||||||
|
],
|
||||||
|
|
||||||
|
"defineConstant": {
|
||||||
|
},
|
||||||
|
|
||||||
|
"venvPath": "python/",
|
||||||
|
|
||||||
|
"reportMissingImports": true,
|
||||||
|
"reportMissingTypeStubs": true,
|
||||||
|
|
||||||
|
"pythonVersion": "3.6",
|
||||||
|
"pythonPlatform": "Linux",
|
||||||
|
|
||||||
|
"typeCheckingMode": "strict"
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# For pytest
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
name = tts
|
||||||
|
|
||||||
|
[options]
|
||||||
|
packages = find:
|
||||||
@@ -5,25 +5,28 @@ treated independently.
|
|||||||
Inspired by and including code from original Tacotron2 by Keith Ito.
|
Inspired by and including code from original Tacotron2 by Keith Ito.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# pyright: strict
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
from typing import List, Union
|
||||||
|
|
||||||
# Regular expression matching text enclosed in curly braces:
|
# Regular expression matching text enclosed in curly braces:
|
||||||
_curly_re = re.compile(r'(.*?)\{(.+?)\}(.*)')
|
_curly_re = re.compile(r'(.*?)\{(.+?)\}(.*)')
|
||||||
|
|
||||||
class ArpabetSequence:
|
class ArpabetSequence:
|
||||||
def __init__(self, sequence):
|
def __init__(self, sequence: str):
|
||||||
self.sequence = sequence
|
self.sequence = sequence
|
||||||
|
|
||||||
class GraphemeSquence:
|
class GraphemeSquence:
|
||||||
def __init__(self, sequence):
|
def __init__(self, sequence: str):
|
||||||
self.sequence = sequence
|
self.sequence = sequence
|
||||||
|
|
||||||
def parse_grapheme_and_arpabet_sequence(input_text):
|
def parse_grapheme_and_arpabet_sequence(input_text: str) -> List[Union[ArpabetSequence, GraphemeSquence]]:
|
||||||
"""
|
"""
|
||||||
Parse a string into an array of ArpabetSequence and GraphemeSequence so that each
|
Parse a string into a list of ArpabetSequence and GraphemeSequence so that each
|
||||||
subsequence can be treated independently.
|
subsequence can be treated independently.
|
||||||
"""
|
"""
|
||||||
sequence = []
|
sequence : List[Union[ArpabetSequence, GraphemeSquence]] = []
|
||||||
|
|
||||||
# Check for curly braces and treat their contents as ARPAbet:
|
# Check for curly braces and treat their contents as ARPAbet:
|
||||||
while len(input_text):
|
while len(input_text):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
class BaseNormalization:
|
class BaseNormalization:
|
||||||
|
|
||||||
def normalize(self, raw_input_text):
|
def normalize(self, raw_input_text: str) -> str:
|
||||||
return raw_input_text
|
return raw_input_text
|
||||||
@@ -2,5 +2,5 @@ from text.normalization.BaseNormalization import BaseNormalization
|
|||||||
|
|
||||||
class EnglishNormalization(BaseNormalization):
|
class EnglishNormalization(BaseNormalization):
|
||||||
|
|
||||||
def normalize(self, raw_input_text):
|
def normalize(self, raw_input_text: str) -> str:
|
||||||
return raw_input_text
|
return raw_input_text
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ from text.normalization.BaseNormalization import BaseNormalization
|
|||||||
|
|
||||||
class SpanishNormalization(BaseNormalization):
|
class SpanishNormalization(BaseNormalization):
|
||||||
|
|
||||||
def normalize(self, raw_input_text):
|
def normalize(self, raw_input_text: str) -> str:
|
||||||
return raw_input_text
|
return raw_input_text
|
||||||
|
|||||||
Reference in New Issue
Block a user