Exemplo n.º 1
0
    def __init__(self, logfile=None):
        """ Create a new sppasTGA instance.

        :param logfile: (sppasLog)

        """
        sppasBaseAnnotation.__init__(self, logfile, "Syllabification")

        # List of the symbols used to create the time groups
        self._tg_separators = list(PHONE_SYMBOLS.keys())

        # List of options to configure this automatic annotation
        self._options = dict()
        self._options['with_radius'] = 0
        self._options['original'] = False
        self._options['annotationpro'] = True
        self._options['tg_prefix_label'] = "tg_"

        # for backward compatibility, we can't simply use PHONE_SYMBOLS...
        self._tg_separators.append('#')
        self._tg_separators.append('@@')
        self._tg_separators.append('+')
        self._tg_separators.append('gb')
        self._tg_separators.append('lg')
        self._tg_separators.append('_')
Exemplo n.º 2
0
    def _phon_to_intervals(phonemes):
        """ Create the intervals to be syllabified. """

        # we could use PHONE_SYMBOLS, but for backward compatibility
        # we hardly add the symbols previously used into SPPAS.
        stop = list(PHONE_SYMBOLS.keys())
        stop.append('#')
        stop.append('@@')
        stop.append('+')
        stop.append('gb')
        stop.append('lg')

        return phonemes.export_to_intervals(stop)
Exemplo n.º 3
0
import re

from sppas import PHONE_SYMBOLS
from sppas import PHONEMES_SEPARATOR
from sppas import VARIANTS_SEPARATOR
from sppas.src.utils.makeunicode import sppasUnicode, u
from sppas.src.resources.mapping import sppasMapping
from sppas.src.resources.dictpron import sppasDictPron

from .. import ERROR_ID, WARNING_ID, OK_ID
from .phonunk import sppasPhonUnk
from .dagphon import sppasDAGPhonetizer

# ---------------------------------------------------------------------------

SIL = list(PHONE_SYMBOLS.keys())[list(PHONE_SYMBOLS.values()).index("silence")]

# ---------------------------------------------------------------------------


class sppasDictPhonetizer(object):
    """
    :author:       Brigitte Bigi
    :organization: Laboratoire Parole et Langage, Aix-en-Provence, France
    :contact:      [email protected]
    :license:      GPL, v3
    :copyright:    Copyright (C) 2011-2017  Brigitte Bigi
    :summary:      Dictionary-based automatic phonetization.

    Grapheme-to-phoneme conversion is a complex task, for which a number of
    diverse solutions have been proposed. It is a structure prediction task;
Exemplo n.º 4
0
    :summary:      Test the classes of the annlabel package.

    Includes tests of sppasLabel(), sppasTag(), sppasTagCompare().

"""
import unittest

from sppas import ORTHO_SYMBOLS, PHONE_SYMBOLS
from sppas.src.utils.makeunicode import u, b, text_type
from ..annlabel.tag import sppasTag
from ..annlabel.label import sppasLabel
from ..annlabel.tagcompare import sppasTagCompare

# ---------------------------------------------------------------------------

SIL_PHON = list(PHONE_SYMBOLS.keys())[list(
    PHONE_SYMBOLS.values()).index("silence")]
NOISE_PHON = list(PHONE_SYMBOLS.keys())[list(
    PHONE_SYMBOLS.values()).index("noise")]
SIL_ORTHO = list(ORTHO_SYMBOLS.keys())[list(
    ORTHO_SYMBOLS.values()).index("silence")]
PAUSE_ORTHO = list(ORTHO_SYMBOLS.keys())[list(
    ORTHO_SYMBOLS.values()).index("pause")]
NOISE_ORTHO = list(ORTHO_SYMBOLS.keys())[list(
    ORTHO_SYMBOLS.values()).index("noise")]

# ---------------------------------------------------------------------------


class TestTag(unittest.TestCase):
    """ Represents a typed content of a label.
Exemplo n.º 5
0
from sppas import RESOURCES_PATH, SAMPLES_PATH
from sppas.src.utils.fileutils import sppasFileUtils
from sppas.src.utils.compare import sppasCompare

from ..acm.acmbaseio import sppasBaseIO
from ..acm.readwrite import sppasACMRW
from ..modelsexc import MioFolderError
from ..modelsexc import MioFileFormatError

# ---------------------------------------------------------------------------

TEMP = sppasFileUtils().set_random()
MODEL_PATH = os.path.join(RESOURCES_PATH, "models")
DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")

SIL_PHON = list(PHONE_SYMBOLS.keys())[list(
    PHONE_SYMBOLS.values()).index("silence")]
LAUGH_PHON = list(PHONE_SYMBOLS.keys())[list(
    PHONE_SYMBOLS.values()).index("laugh")]
SIL_ORTHO = list(ORTHO_SYMBOLS.keys())[list(
    ORTHO_SYMBOLS.values()).index("silence")]

# ---------------------------------------------------------------------------


class TestMRW(unittest.TestCase):
    def test_base_io(self):
        rw = sppasBaseIO()
        self.assertEqual(len(rw.get_name()), 36)  # a GUID
        self.assertTrue(rw.is_ascii())
        self.assertFalse(rw.is_binary())