Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] SAMPA support without the need for mbrola #127

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions phonemizer/backend/espeak/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
"""Base class of espeak backends for the phonemizer"""

import abc
import re
from logging import Logger
from typing import Optional, Union, Pattern

from phonemizer.backend.base import BaseBackend
from phonemizer.backend.espeak.wrapper import EspeakWrapper
from phonemizer.logger import get_logger
from phonemizer.punctuation import Punctuation
from phonemizer.separator import Separator


Expand All @@ -32,6 +31,9 @@ class BaseEspeakBackend(BaseBackend):
facilities to find espeak library and read espeak version.

"""
# a regular expression to find phonemes stresses in espeak output
_ESPEAK_STRESS_RE = re.compile(r"[ˈˌ'-]+")

def __init__(self, language: str,
punctuation_marks: Optional[Union[str, Pattern]] = None,
preserve_punctuation: bool = False,
Expand Down
4 changes: 1 addition & 3 deletions phonemizer/backend/espeak/espeak.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

class EspeakBackend(BaseEspeakBackend):
"""Espeak backend for the phonemizer"""
# a regular expression to find phonemes stresses in espeak output
_ESPEAK_STRESS_RE = re.compile(r"[ˈˌ'-]+")

# pylint: disable=too-many-arguments
def __init__(self, language: str,
Expand Down Expand Up @@ -88,7 +86,7 @@ def _phonemize_aux(self, text, offset, separator, strip):
output = []
lang_switches = []
for num, line in enumerate(text, start=1):
line = self._espeak.text_to_phonemes(line, self._tie)
line = self._espeak.text_to_phonemes(line, self._tie, ipa=True)
line, has_switch = self._postprocess_line(
line, num, separator, strip)
output.append(line)
Expand Down
75 changes: 75 additions & 0 deletions phonemizer/backend/espeak/mbrola-foldings/af1
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
volume 16

0 l/2 NULL 0 l
0 l/ NULL 0 l
0 r/ NULL 0 r
0 r- NULL 0 r
0 R NULL 0 r
0 w/ NULL 0 w
0 j/ NULL 0 j
0 ; NULL 0 NULL
0 g- NULL 0 NULL
0 @- NULL 0 NULL
0 * NULL 0 r

0 x2 NULL 0 x
0 S NULL 0 s
0 Z NULL 0 z
0 _! NULL 0 ?
0 e@ NULL 0 e
0 A: NULL 0 a
0 o@ NULL 0 o
0 Y@ NULL 0 2
0 a NULL 0 A
0 I NULL 0 @
0 & NULL 0 {
0 W NULL 0 9
0 eI NULL 0 &
0 @U NULL 0 $
0 Yy NULL 0 }
0 A~ NULL 0 A
0 e~ NULL 0 E
0 o~ NULL 0 O
0 aI NULL 60 A j
0 AI NULL 75 a j
0 OI NULL 60 O j
0 oI NULL 70 u j
0 uI NULL 60 u j
0 aU NULL 60 A u
0 iu NULL 50 i u
0 e: NULL 0 E
0 i: NULL 0 i
0 u: NULL 0 u

0 @2 NULL 0 @
0 @5 NULL 0 @
0 I2 NULL 0 i
0 a# NULL 0 a
0 aa NULL 0 a
0 0 NULL 0 O
0 A@ NULL 0 a
0 i@ NULL 0 e
0 i@3 NULL 0 e
0 e@ NULL 60 E @
0 o@ NULL 70 O @
0 O@ NULL 70 O @
0 U@ NULL 60 u @
0 O: NULL 0 O
0 oU NULL 0 $
0 @2 NULL 0 @
0 3 NULL 0 @
0 3: NULL 0 @
0 U NULL 0 u
0 V NULL 0 a
0 aI@ NULL 60 { @
0 aU@ NULL 70 A @
0 @L NULL 0 l
0 T NULL 0 t
0 D NULL 0 z
0 dZ NULL 40 d z
0 tS NULL 40 t s
0 c NULL 0 k




68 changes: 68 additions & 0 deletions phonemizer/backend/espeak/mbrola-foldings/ar1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
volume 50

0 a : 50 a a
0 a NULL 0 a
0 A NULL 0 H
0 b b 20 b b
0 b NULL 0 b
1 dH dH 40 d. d.
1 dH a 50 d. a.
1 dH i 50 d. i.
1 dH u 50 d. u.
0 dH NULL 0 d.
0 d : 50 d d
0 D NULL 0 D
0 dZ NULL 0 Z
0 d NULL 0 d
0 f NULL 0 f
0 Q NULL 0 G
0 g NULL 0 g
1 H a 40 X a
1 H i 40 X i
0 h NULL 0 h
1 H u 40 X u
0 H NULL 0 X
0 i : 50 i i
0 i NULL 0 i
0 y NULL 0 y
0 j : 50 j j
0 j NULL 0 j
0 k NULL 0 k
0 l/ NULL 0 l
0 l NULL 0 l
0 m m 100 n m
0 m NULL 0 m
0 n NULL 0 n
4 ? NULL 0 _
64 ? NULL 0 _
0 ? NULL 0 ?
0 p NULL 0 p
0 q NULL 0 q
0 r/ NULL 0 r
0 r NULL 0 r
0 S : 50 S S
0 S NULL 0 S
1 s[ a 50 s. a.
1 s[ i 50 s. i.
1 s[ u 50 s. u.
0 s[ : 0 s. s.
0 s[ NULL 0 s.
0 s : 50 s s
0 s NULL 0 s
0 t : 50 t t
0 T NULL 0 T
1 t[ a 0 t. a.
1 t[ i 0 t. i.
1 t[ u 0 t. u.
0 t[ : 0 t. t.
0 t[ NULL 0 t.
0 t NULL 0 t
0 u : 50 u u
0 u NULL 0 u
0 w NULL 0 w
0 X NULL 0 x
1 Z a 0 z. a.
1 Z i 0 z. i.
1 Z u 0 z. u.
0 Z NULL 0 z.
0 z NULL 0 z
70 changes: 70 additions & 0 deletions phonemizer/backend/espeak/mbrola-foldings/ar2
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// This is complete duplicate of ar1 file except volume
// which is lower here to avoid saturation
volume 14

0 a : 50 a a
0 a NULL 0 a
0 A NULL 0 H
0 b b 20 b b
0 b NULL 0 b
1 dH dH 40 d. d.
1 dH a 50 d. a.
1 dH i 50 d. i.
1 dH u 50 d. u.
0 dH NULL 0 d.
0 d : 50 d d
0 D NULL 0 D
0 dZ NULL 0 Z
0 d NULL 0 d
0 f NULL 0 f
0 gH NULL 0 G
0 g NULL 0 g
1 H a 40 X a
1 H i 40 X i
0 h NULL 0 h
1 H u 40 X u
0 H NULL 0 X
0 i : 50 i i
0 i NULL 0 i
0 y NULL 0 y
0 j : 50 j j
0 j NULL 0 j
0 k NULL 0 k
0 l/ NULL 0 l
0 l NULL 0 l
0 m m 100 n m
0 m NULL 0 m
0 n NULL 0 n
4 ? NULL 0 _
64 ? NULL 0 _
0 ? NULL 0 ?
0 p NULL 0 p
0 q NULL 0 q
0 r/ NULL 0 r
0 r NULL 0 r
0 S : 50 S S
0 S NULL 0 S
1 s[ a 50 s. a.
1 s[ i 50 s. i.
1 s[ u 50 s. u.
0 s[ : 0 s. s.
0 s[ NULL 0 s.
0 s : 50 s s
0 s NULL 0 s
0 t : 50 t t
0 T NULL 0 T
1 t[ a 0 t. a.
1 t[ i 0 t. i.
1 t[ u 0 t. u.
0 t[ : 0 t. t.
0 t[ NULL 0 t.
0 t NULL 0 t
0 u : 50 u u
0 u NULL 0 u
0 w NULL 0 w
0 X NULL 0 x
1 Z a 0 z. a.
1 Z i 0 z. i.
1 Z u 0 z. u.
0 Z NULL 0 z.
0 z NULL 0 z
88 changes: 88 additions & 0 deletions phonemizer/backend/espeak/mbrola-foldings/ca
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
volume 17

0 l/2 NULL 0 l
0 l/ NULL 0 l
0 l2 NULL 0 l
0 r/ NULL 0 R
0 r/2 NULL 0 R
0 r- NULL 0 R
0 l- NULL 0 l
0 w/ NULL 0 w
0 j/ NULL 0 j
0 ; NULL 0 NULL
0 g- NULL 0 NULL
0 @3 NULL 0 NULL
0 * NULL 0 R
0 : NULL 0 NULL

0 Y NULL 0 2
0 W NULL 0 9
0 W2 NULL 0 9
0 E2 NULL 0 E
0 o2 NULL 0 o
0 A~ NULL 0 a~
0 E~ NULL 0 e~
0 O~ NULL 0 o~
0 W~ NULL 0 9~
0 w^i NULL 50 H i
0 wA NULL 50 w a
0 r NULL 0 R
0 n^ NULL 75 n j
0 c NULL 0 k

0 I NULL 0 i
0 U NULL 0 u
0 y" NULL 0 y
0 E NULL 0 e
0 E: NULL 0 E
0 h NULL 0 NULL
0 n2 NULL 0 n
0 p2 NULL 0 p
0 r2 NULL 0 R
0 t2 NULL 0 t
0 t3 NULL 0 t
0 z2 NULL 0 z
0 z3 NULL 0 z

0 @- NULL 0 @
0 a- NULL 0 a
0 e- NULL 0 e
0 y- NULL 0 y
0 i: NULL 0 i
0 i- NULL 0 i
0 u: NULL 0 u
0 eI NULL 60 E j
0 aU NULL 60 a w
0 oU NULL 0 o
0 o3 NULL 0 o
0 o- NULL 0 o
0 @L NULL 40 @ l
0 @2 NULL 0 @
0 @5 NULL 0 @
0 3 NULL 0 @
0 a# NULL 0 a
0 I2 NULL 0 i
0 aa NULL 0 a
0 V NULL 0 @
0 0 NULL 0 O
0 3: NULL 0 9
0 aI NULL 60 a j
0 OI NULL 60 O j
0 e@ NULL 0 E
0 i@ NULL 60 i @
0 i@3 NULL 60 i @
0 e@ NULL 60 E @
0 o@ NULL 70 o @
0 O@ NULL 70 O @
0 O: NULL 0 O
0 O2 NULL 0 O
0 A: NULL 0 a
0 A@ NULL 70 a @
0 U@ NULL 60 u @
0 aI@ NULL 70 a @
0 aU@ NULL 0 a

0 dZ NULL 40 d Z
0 tS NULL 40 t S
0 T NULL 0 t
0 D NULL 0 z
Loading