Skip to content

Commit

Permalink
Merge pull request #22 from eginhard/unique-chars
Browse files Browse the repository at this point in the history
refactor(bin.find_unique_chars): use existing function
  • Loading branch information
eginhard authored Mar 30, 2024
2 parents 571f065 + d76d0ef commit 018daa0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- name: Install Espeak
if: contains(fromJSON('["inference_tests", "test_text", "test_tts", "test_tts2", "test_xtts", "test_zoo0", "test_zoo1", "test_zoo2"]'), matrix.subset)
run: |
sudo apt-get update
sudo apt-get install espeak espeak-ng
- name: Install dependencies
run: |
Expand Down
14 changes: 2 additions & 12 deletions TTS/bin/find_unique_chars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from argparse import RawTextHelpFormatter

from TTS.config import load_config
from TTS.tts.datasets import load_tts_samples
from TTS.tts.datasets import find_unique_chars, load_tts_samples


def main():
Expand All @@ -29,17 +29,7 @@ def main():
)

items = train_items + eval_items

texts = "".join(item["text"] for item in items)
chars = set(texts)
lower_chars = filter(lambda c: c.islower(), chars)
chars_force_lower = [c.lower() for c in chars]
chars_force_lower = set(chars_force_lower)

print(f" > Number of unique characters: {len(chars)}")
print(f" > Unique characters: {''.join(sorted(chars))}")
print(f" > Unique lower characters: {''.join(sorted(lower_chars))}")
print(f" > Unique all forced to lower characters: {''.join(sorted(chars_force_lower))}")
find_unique_chars(items)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion TTS/tts/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _get_formatter_by_name(name):


def find_unique_chars(data_samples, verbose=True):
texts = "".join(item[0] for item in data_samples)
texts = "".join(item["text"] for item in data_samples)
chars = set(texts)
lower_chars = filter(lambda c: c.islower(), chars)
chars_force_lower = [c.lower() for c in chars]
Expand Down

0 comments on commit 018daa0

Please sign in to comment.