<commit_before># Lint as: python3
"""
A class for Celtic initial consonant mutations. Features include triggers, targets, and string maps.
"""

#from __future__ import absolute_import
#from __future__ import division
#from __future__ import google_type_annotations
#from __future__ import print_function

from dataclasses import dataclass
from absl import app
from absl import flags
from pynini import *

FLAGS = flags.FLAGS

@dataclass
class CelticMutationHandler:
    """A class containing language-specific info for Celtic consonant mutation.

    Attributes:
        language: A string indicating the language.
        graphemes: A union of strings of the graphemes of the language.
        soft_triggers: A union of strings of soft mutation triggers.
        soft_map: A string_map or union of transducers for the soft mutation.
        hard_triggers: A union of strings of hard mutation triggers.
        hard_map: A string_map or union of transducers for the hard mutation.
        spirant_triggers: A union of strings of spirant mutation triggers.
        spirant_map: A string_map or union of transducers for the spirant mutation.
        mixed_triggers: A union of strings of mixed mutation triggers.
        mixed_map: A string_map or union of transducers for the mixed mutation.
        lenition_triggers: A union of strings of lenition triggers.
        lenition_map: A string_map or union of transducers for lenition.
        eclipsis_triggers: A union of strings of eclipsis triggers.
        eclipsis_map: A string_map or union of transducers for eclipsis.
        triggers: A union of all triggers for the language.
        sigma_star: A cyclic, unweighted acceptor representing
            the closure over the alphabet.
        preprocessing: A union of language-specific transducers
            for preprocessing a string.
        postprocessing: A union of language-specific transducers
            for postprocessing a string.
    """

    def __init__(self, language: str) -> None:

        self.language = language
        self.soft_triggers = "None"
        self.soft_map = "None"
        self.hard_triggers = "None"
        self.hard_map = "None"
        self.spirant_triggers = "None"
        self.spirant_map = "None"
        self.mixed_triggers = "None"
        self.mixed_map = "None"
        self.nasal_triggers = "None"
        self.nasal_map = "None"
        self.lenition_triggers = "None"
        self.lenition_map = "None"
        self.eclipsis_triggers = "None"
        self.eclipsis_map = "None"

        space = " "
        self.sigma_star = union(*("[{}]".format(i) for i in range(1, 256))
                                ).optimize().closure()

        if self.language == "breton":

            self.graphemes = union("a", "b", "ch", "c'h", "d", "e", "f", "g",<commit_msg>removed unnecessary 'space' constant used in old sigma_star<commit_after># Lint as: python3
"""
A class for Celtic initial consonant mutations. Features include triggers, targets, and string maps.
"""

#from __future__ import absolute_import
#from __future__ import division
#from __future__ import google_type_annotations
#from __future__ import print_function

from dataclasses import dataclass
from absl import app
from absl import flags
from pynini import *

FLAGS = flags.FLAGS

@dataclass
class CelticMutationHandler:
    """A class containing language-specific info for Celtic consonant mutation.

    Attributes:
        language: A string indicating the language.
        graphemes: A union of strings of the graphemes of the language.
        soft_triggers: A union of strings of soft mutation triggers.
        soft_map: A string_map or union of transducers for the soft mutation.
        hard_triggers: A union of strings of hard mutation triggers.
        hard_map: A string_map or union of transducers for the hard mutation.
        spirant_triggers: A union of strings of spirant mutation triggers.
        spirant_map: A string_map or union of transducers for the spirant mutation.
        mixed_triggers: A union of strings of mixed mutation triggers.
        mixed_map: A string_map or union of transducers for the mixed mutation.
        lenition_triggers: A union of strings of lenition triggers.
        lenition_map: A string_map or union of transducers for lenition.
        eclipsis_triggers: A union of strings of eclipsis triggers.
        eclipsis_map: A string_map or union of transducers for eclipsis.
        triggers: A union of all triggers for the language.
        sigma_star: A cyclic, unweighted acceptor representing
            the closure over the alphabet.
        preprocessing: A union of language-specific transducers
            for preprocessing a string.
        postprocessing: A union of language-specific transducers
            for postprocessing a string.
    """

    def __init__(self, language: str) -> None:

        self.language = language
        self.soft_triggers = "None"
        self.soft_map = "None"
        self.hard_triggers = "None"
        self.hard_map = "None"
        self.spirant_triggers = "None"
        self.spirant_map = "None"
        self.mixed_triggers = "None"
        self.mixed_map = "None"
        self.nasal_triggers = "None"
        self.nasal_map = "None"
        self.lenition_triggers = "None"
        self.lenition_map = "None"
        self.eclipsis_triggers = "None"
        self.eclipsis_map = "None"

        self.sigma_star = union(*("[{}]".format(i) for i in range(1, 256))
                                ).optimize().closure()

        if self.language == "breton":

            self.graphemes = union("a", "b", "ch", "c'h", "d", "e", "f", "g",
{'fraction_non_alphanumeric': 0.07021577644145738, 'fraction_numerical': 0.0017686593562079944, 'mean_word_length': 2.740079365079365, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3611733', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1542, 'n_words': 587}