Skip to content

Commit

Permalink
rename from zh-tts to zho-tts
Browse files Browse the repository at this point in the history
  • Loading branch information
stefantaubert committed Feb 13, 2024
1 parent 6864aab commit dc16b87
Show file tree
Hide file tree
Showing 40 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ venv.bak/
.vscode

# custom
# zh_tts/*.tests.py
# zho_tts/*.tests.py
output
scripts
*_debug/
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cff-version: 1.2.0
title: zh-tts
title: zho-tts
abstract: Command-line interface and Python library for synthesizing Chinese texts into speech.
message: >-
If you use this software, please cite it using the
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
graft src/zh_tts_tests/
graft src/zh_tts_cli_tests/
graft src/zho_tts_tests/
graft src/zho_tts_cli_tests/

include \
pylintrc \
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
zh-tts = {editable = true, path = "."}
zho-tts = {editable = true, path = "."}
autopep8 = "*"
pylint = "*"
pycodestyle = "*"
Expand Down
4 changes: 2 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# zh-tts
# zho-tts

[![PyPI](https://img.shields.io/pypi/v/zh-tts.svg)](https://pypi.python.org/pypi/zh-tts)
![PyPI](https://img.shields.io/pypi/pyversions/zh-tts.svg)
[![PyPI](https://img.shields.io/pypi/v/zho-tts.svg)](https://pypi.python.org/pypi/zho-tts)
![PyPI](https://img.shields.io/pypi/pyversions/zho-tts.svg)
[![pytorch](https://img.shields.io/badge/PyTorch_2.0+-ee4c2c?logo=pytorch&logoColor=white)](https://pytorch.org/get-started/pytorch-2.0/)
[![MIT](https://img.shields.io/github/license/stefantaubert/zh-tts.svg)](https://github.com/stefantaubert/zh-tts/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/wheel/zh-tts.svg)](https://pypi.python.org/pypi/zh-tts/#files)
![PyPI](https://img.shields.io/pypi/implementation/zh-tts.svg)
[![PyPI](https://img.shields.io/pypi/wheel/zho-tts.svg)](https://pypi.python.org/pypi/zho-tts/#files)
![PyPI](https://img.shields.io/pypi/implementation/zho-tts.svg)
[![PyPI](https://img.shields.io/github/commits-since/stefantaubert/zh-tts/latest/master.svg)](https://github.com/stefantaubert/zh-tts/compare/v0.0.1...master)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10512789.svg)](https://doi.org/10.5281/zenodo.10512789)

Expand All @@ -14,20 +14,20 @@ Command-line interface and Python library for synthesizing Chinese texts into sp
## Installation

```sh
pip install zh-tts --user
pip install zho-tts --user
```

## Example synthesis

```sh
zh-tts synthesize "长江 航务 管理局 和 长江 轮船 总公司 最近 决定 安排 一百三十三 艘 客轮 迎接 长江 干线 春运。"
zho-tts synthesize "长江 航务 管理局 和 长江 轮船 总公司 最近 决定 安排 一百三十三 艘 客轮 迎接 长江 干线 春运。"
```

The output can be listened [here](https://github.com/stefantaubert/zh-tts/raw/master/examples/synthesize.wav).

```sh
# Same example using IPA input
zh-tts synthesize-ipa "ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ˘|SIL0|x|a˧˥˘|ŋ|u˥˩|SIL0|k|w|a˧˩˧|n|l˘|i˧˩˧|tɕː|y˧˥ˑ|SIL0|x|ɤ˧˥|SIL0|ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|l|w|ə˧˥|n|ʈʂʰ˘|w|a˧˥|n|SIL0|ts˘|ʊ˧˩˧|ŋ˘|kː|ʊ˥|ŋ|s|ɹ̩˥ˑ|SIL0|ts|w˘|ei̯˥˩|tɕ|i˥˩˘|n|SIL0|tɕ|ɥ|e˧˥|t|i˥˩|ŋ|SIL3|a˥|n|pʰ|ai̯˧˥|SIL0|i˥ˑ|p|ai̯˧˩˧|s|a˥˘|n|ʂ˘|ɻ̩˧˥|s|a˥|n|SIL0|s˘|ou̯˥|SIL0|kʰˑ|ɤ˥˩|lː|wˑ|ə˧˥ˑ|n|SIL0|i˧˥ː|ŋ|tɕ˘|j˘|e˥|SIL0|ʈʂː|a˧˩˧|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|k˘|a˥˩|n|ɕ|j˘|ɛ˥˩|n˘|SIL0|ʈʂʰˑ|w˘|ə˥˘|nː|y˥˩ˑ|nː|。"
zho-tts synthesize-ipa "ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ˘|SIL0|x|a˧˥˘|ŋ|u˥˩|SIL0|k|w|a˧˩˧|n|l˘|i˧˩˧|tɕː|y˧˥ˑ|SIL0|x|ɤ˧˥|SIL0|ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|l|w|ə˧˥|n|ʈʂʰ˘|w|a˧˥|n|SIL0|ts˘|ʊ˧˩˧|ŋ˘|kː|ʊ˥|ŋ|s|ɹ̩˥ˑ|SIL0|ts|w˘|ei̯˥˩|tɕ|i˥˩˘|n|SIL0|tɕ|ɥ|e˧˥|t|i˥˩|ŋ|SIL3|a˥|n|pʰ|ai̯˧˥|SIL0|i˥ˑ|p|ai̯˧˩˧|s|a˥˘|n|ʂ˘|ɻ̩˧˥|s|a˥|n|SIL0|s˘|ou̯˥|SIL0|kʰˑ|ɤ˥˩|lː|wˑ|ə˧˥ˑ|n|SIL0|i˧˥ː|ŋ|tɕ˘|j˘|e˥|SIL0|ʈʂː|a˧˩˧|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|k˘|a˥˩|n|ɕ|j˘|ɛ˥˩|n˘|SIL0|ʈʂʰˑ|w˘|ə˥˘|nː|y˥˩ˑ|nː|。"
```

The output can be listened [here](https://github.com/stefantaubert/zh-tts/raw/master/examples/synthesize-ipa.wav).
Expand All @@ -38,7 +38,7 @@ The output can be listened [here](https://github.com/stefantaubert/zh-tts/raw/ma
from pathlib import Path
from tempfile import gettempdir

from zh_tts import Synthesizer, Transcriber, normalize_audio, save_audio
from zho_tts import Synthesizer, Transcriber, normalize_audio, save_audio

text = "长江 航务 管理局 和 长江 轮船 总公司 最近 决定 安排 一百三十三 艘 客轮 迎接 长江 干线 春运。"

Expand Down Expand Up @@ -99,7 +99,7 @@ Tones and duration markers can be combined, e.g., ə˧˥ː
If you want to cite this repo, you can use the BibTeX-entry generated by GitHub (see *About => Cite this repository*).

```txt
Taubert, S. (2024). zh-tts (Version 0.0.1) [Computer software]. https://doi.org/10.5281/zenodo.10512789
Taubert, S. (2024). zho-tts (Version 0.0.1) [Computer software]. https://doi.org/10.5281/zenodo.10512789
```

## Acknowledgments
Expand Down
34 changes: 17 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "zh-tts"
name = "zho-tts"
version = "0.0.1"
description = "Command-line interface and Python library for synthesizing Chinese texts into speech."
readme = "README.md"
Expand Down Expand Up @@ -57,34 +57,34 @@ Homepage = "https://github.com/stefantaubert/zh-tts"
Issues = "https://github.com/stefantaubert/zh-tts/issues"

[project.scripts]
zh-tts = "zh_tts_cli.cli:run"
zho-tts = "zho_tts_cli.cli:run"

[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
ignore_missing_imports = true
packages = ["zh_tts", "zh_tts_cli"]
packages = ["zho_tts", "zho_tts_cli"]

[tool.setuptools.packages.find]
where = ["src"]
include = ["zh_tts", "zh_tts.*", "zh_tts_cli", "zh_tts_cli.*"]
include = ["zho_tts", "zho_tts.*", "zho_tts_cli", "zho_tts_cli.*"]
exclude = [
"zh_tts_tests",
"zh_tts_tests.*",
"zh_tts_cli_tests",
"zh_tts_cli_tests.*",
"zh_tts_debug",
"zh_tts_debug.*",
"zh_tts_cli_debug",
"zh_tts_cli_debug.*",
"zho_tts_tests",
"zho_tts_tests.*",
"zho_tts_cli_tests",
"zho_tts_cli_tests.*",
"zho_tts_debug",
"zho_tts_debug.*",
"zho_tts_cli_debug",
"zho_tts_cli_debug.*",
]
namespaces = true

[tool.pytest.ini_options]
log_cli = true
log_level = "DEBUG"
testpaths = ["src/zh_tts_tests", "src/zh_tts_cli_tests"]
testpaths = ["src/zho_tts_tests", "src/zho_tts_cli_tests"]

[tool.autopep8]
indent-size = 2
Expand All @@ -94,7 +94,7 @@ max_line_length = 100
[tool.isort]
line_length = 100
indent = 2
known_first_party = ["zh_tts", "zh_tts_cli"]
known_first_party = ["zho_tts", "zho_tts_cli"]
known_third_party = [
"scipy",
"numpy",
Expand All @@ -117,9 +117,9 @@ deps =
pytest
commands =
pytest
zh-tts
zh-tts -v
zh-tts -h
zho-tts
zho-tts -v
zho-tts -h
"""

[build-system]
Expand Down
4 changes: 0 additions & 4 deletions src/zh_tts/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions src/zho_tts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from zho_tts.helper import get_default_device, normalize_audio
from zho_tts.io import save_audio
from zho_tts.synthesizer import AVAILABLE_SPEAKERS, Synthesizer
from zho_tts.transcriber import Transcriber
File renamed without changes.
2 changes: 1 addition & 1 deletion src/zh_tts/globals.py → src/zho_tts/globals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pathlib import Path

DEFAULT_CONF_DIR = Path.home() / ".zh-tts"
DEFAULT_CONF_DIR = Path.home() / ".zho-tts"
DEFAULT_SPEAKER = "C17"
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/zh_tts/resources.py → src/zho_tts/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from waveglow import CheckpointWaveglow, convert_glow_files
from waveglow_cli import download_pretrained_model

from zh_tts.io import load_obj, save_obj
from zho_tts.io import load_obj, save_obj

SPEAKER_DICT_ZIP = "https://zenodo.org/records/7528596/files/pronunciations-narrow-speakers.zip"
SPEAKERS_DICT = "https://zenodo.org/records/7528596/files/pronunciations-narrow.dict"
Expand Down
6 changes: 3 additions & 3 deletions src/zh_tts/synthesizer.py → src/zho_tts/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from waveglow import Synthesizer as WaveglowSynthesizer
from waveglow import try_copy_to

from zh_tts.globals import DEFAULT_CONF_DIR, DEFAULT_SPEAKER
from zh_tts.helper import get_default_device, get_sample_count
from zh_tts.resources import get_taco_model, get_wg_model
from zho_tts.globals import DEFAULT_CONF_DIR, DEFAULT_SPEAKER
from zho_tts.helper import get_default_device, get_sample_count
from zho_tts.resources import get_taco_model, get_wg_model

AVAILABLE_SPEAKERS = {
"A9", "A33", "A35", "B21", "B34", "A8", "B8", "C8", "D8", "A11", "A12", "A13", "A14", "A19", "A2", "A22", "A23", "A32", "A34", "A36", "A4", "A5", "A6", "A7", "B11", "B12", "B15", "B2", "B22", "B31", "B32", "B33", "B4", "B6", "B7", "C12", "C13", "C14", "C17", "C18", "C19", "C2", "C20", "C21", "C22", "C23", "C31", "C32", "C4", "C6", "C7", "D11", "D12", "D13", "D21", "D31", "D32", "D4", "D6", "D7"
Expand Down
6 changes: 3 additions & 3 deletions src/zh_tts/transcriber.py → src/zho_tts/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
from pypinyin import Style
from txt_utils import extract_vocabulary_from_text, replace_text, transcribe_text_using_dict

from zh_tts.cn_tn import TextNorm
from zh_tts.globals import DEFAULT_CONF_DIR, DEFAULT_SPEAKER
from zh_tts.resources import get_dicts
from zho_tts.cn_tn import TextNorm
from zho_tts.globals import DEFAULT_CONF_DIR, DEFAULT_SPEAKER
from zho_tts.resources import get_dicts


class Transcriber():
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/zh_tts_cli/cli.py → src/zho_tts_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
from time import perf_counter
from typing import Callable, Generator, List, Tuple, cast

from zh_tts_cli.globals import get_conf_dir, get_work_dir
from zh_tts_cli.logging_configuration import (configure_cli_logger, configure_file_logger,
from zho_tts_cli.globals import get_conf_dir, get_work_dir
from zho_tts_cli.logging_configuration import (configure_cli_logger, configure_file_logger,
configure_root_logger, get_file_logger)
from zh_tts_cli.main import init_synthesize_ipa_parser, init_synthesize_zh_parser
from zho_tts_cli.main import init_synthesize_ipa_parser, init_synthesize_zh_parser

__APP_NAME = "zh-tts"
__APP_NAME = "zho-tts"

__version__ = version(__APP_NAME)

Expand Down
4 changes: 2 additions & 2 deletions src/zh_tts_cli/globals.py → src/zho_tts_cli/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@


def get_conf_dir() -> Path:
conf_dir = Path.home() / ".zh-tts"
conf_dir = Path.home() / ".zho-tts"
return conf_dir


def get_work_dir() -> Path:
work_dir = Path(gettempdir()) / "zh-tts"
work_dir = Path(gettempdir()) / "zho-tts"
return work_dir
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ def set_logfile_formatter(handler: Handler) -> None:


def get_cli_logger() -> Logger:
logger = getLogger("zh_tts_cli")
logger = getLogger("zho_tts_cli")
return logger


def get_file_logger() -> Logger:
flogger = getLogger("file.zh_tts_cli")
flogger = getLogger("file.zho_tts_cli")
if flogger.propagate:
flogger.propagate = False
return flogger


def configure_cli_logger(debug: bool = False) -> None:
cli_logger = getLogger("zh_tts_cli")
cli_logger = getLogger("zho_tts_cli")
cli_logger.handlers.clear()
assert len(cli_logger.handlers) == 0
console_handler = add_console_out(cli_logger)
# console_handler.setLevel(logging.DEBUG if debug else logging.INFO)
cli_logger.setLevel(logging.DEBUG if debug else logging.INFO)

core_logger = getLogger("zh_tts")
core_logger = getLogger("zho_tts")
core_logger.parent = cli_logger

file_logger = get_file_logger()
Expand Down
22 changes: 11 additions & 11 deletions src/zh_tts_cli/main.py → src/zho_tts_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
from pronunciation_dictionary import PronunciationDict, SerializationOptions, save_dict
from tacotron_cli import *

from zh_tts import *
from zh_tts.synthesizer import AVAILABLE_SPEAKERS
from zh_tts_cli.argparse_helper import (get_torch_devices, parse_device,
parse_float_between_zero_and_one,
parse_non_empty_or_whitespace, parse_non_negative_float,
parse_non_negative_integer, parse_path,
parse_positive_integer)
from zh_tts_cli.globals import get_conf_dir, get_work_dir
from zh_tts_cli.logging_configuration import get_file_logger
from zho_tts import *
from zho_tts.synthesizer import AVAILABLE_SPEAKERS
from zho_tts_cli.argparse_helper import (get_torch_devices, parse_device,
parse_float_between_zero_and_one,
parse_non_empty_or_whitespace, parse_non_negative_float,
parse_non_negative_integer, parse_path,
parse_positive_integer)
from zho_tts_cli.globals import get_conf_dir, get_work_dir
from zho_tts_cli.logging_configuration import get_file_logger


def init_synthesize_zh_parser(parser: ArgumentParser) -> Callable[[Namespace], None]:
Expand Down Expand Up @@ -85,7 +85,7 @@ def add_device_argument(parser: ArgumentParser) -> None:

def synthesize_zh(text: str, speaker: str, max_decoder_steps: int, sigma: float, denoiser_strength: float, seed: int, device: torch.device, silence_sentences: float, silence_paragraphs: float, loglevel: int, skip_normalization: bool, skip_word_segmentation: bool, skip_sentence_segmentation: bool, output: Path):
if loglevel == 0:
cli_logger = logging.getLogger("zh_tts_cli")
cli_logger = logging.getLogger("zho_tts_cli")
cli_logger.setLevel(logging.WARNING)

text_ipa = convert_zh_to_ipa(text, speaker, loglevel, skip_normalization,
Expand All @@ -96,7 +96,7 @@ def synthesize_zh(text: str, speaker: str, max_decoder_steps: int, sigma: float,

def synthesize_ipa(text_ipa: str, speaker: str, max_decoder_steps: int, sigma: float, denoiser_strength: float, seed: int, device: torch.device, silence_sentences: float, silence_paragraphs: float, loglevel: int, output: Path):
if loglevel == 0:
cli_logger = logging.getLogger("zh_tts_cli")
cli_logger = logging.getLogger("zho_tts_cli")
cli_logger.setLevel(logging.WARNING)

if loglevel >= 1:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from zh_tts.helper import get_default_device
from zh_tts_cli.cli import reset_work_dir
from zh_tts_cli.globals import get_work_dir
from zh_tts_cli.main import synthesize_ipa
from zho_tts.helper import get_default_device
from zho_tts_cli.cli import reset_work_dir
from zho_tts_cli.globals import get_work_dir
from zho_tts_cli.main import synthesize_ipa


def test_component():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from zh_tts.helper import get_default_device
from zh_tts_cli.cli import reset_work_dir
from zh_tts_cli.globals import get_work_dir
from zh_tts_cli.main import synthesize_zh
from zho_tts.helper import get_default_device
from zho_tts_cli.cli import reset_work_dir
from zho_tts_cli.globals import get_work_dir
from zho_tts_cli.main import synthesize_zh


def test_component():
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/zh_tts_tests/helper.py → src/zho_tts_tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def get_tests_conf_dir() -> Path:
result = Path("/tmp/zh-tts.tests")
result = Path("/tmp/zho-tts.tests")
result.mkdir(parents=True, exist_ok=True)
return result
# return DEFAULT_CONF_DIR
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import numpy as np
from pytest import raises

from zh_tts.helper import normalize_audio
from zh_tts.io import save_audio
from zh_tts.synthesizer import Synthesizer
from zh_tts_tests.helper import get_tests_conf_dir
from zho_tts.helper import normalize_audio
from zho_tts.io import save_audio
from zho_tts.synthesizer import Synthesizer
from zho_tts_tests.helper import get_tests_conf_dir


def test_component():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from zh_tts.transcriber import get_sentences
from zho_tts.transcriber import get_sentences


def test_component():
Expand Down
Loading

0 comments on commit dc16b87

Please sign in to comment.