<commit_before>"""This module contains the DFA implementation"""
# !/usr/bin/python
import imp
import copy
try:
    print 'Checking for pywrapfst module:',
    imp.find_module('pywrapfst')
    print 'OK'
    from pywrapfstdfa import PywrapfstDFA, TropicalWeight

    class DFA(PywrapfstDFA):
        """The DFA class implemented using openFst library"""
        def copy(self):
            mma = DFA()
            mma.automaton =self.automaton.copy()
            mma.alphabet = copy.deepcopy(self.alphabet)
            mma.isyms = copy.deepcopy(self.isyms)
            mma.osyms = copy.deepcopy(self.osyms)
            return mma

        pass
except ImportError:
    print 'FAIL'
    try:
        print 'Checking for fst module:',
        imp.find_module('fst')
        print 'OK'
        from fstdfa import FstDFA, TropicalWeight

        class DFA(FstDFA):
            """The DFA class implemented using openFst library"""
            pass

    except ImportError:
        print 'FAIL'
        print 'Fallback to python implementation:OK'
        from pythondfa import PythonDFA, TropicalWeight

        class DFA(PythonDFA):
            """The DFA class implemented using python"""

            def copy(self):
                mma = DFA()
                mma.states = copy.deepcopy(self.states)
                mma.alphabet = copy.deepcopy(self.alphabet)
                mma.isyms = copy.deepcopy(self.isyms)
                mma.osyms = copy.deepcopy(self.osyms)
                return mma
            pass<commit_msg>change DFA priority<commit_after>"""This module contains the DFA implementation"""
# !/usr/bin/python
import imp
import copy
try:
    print 'Checking for fst module:',
    imp.find_module('fst')
    print 'OK'
    from fstdfa import FstDFA, TropicalWeight


    class DFA(FstDFA):
        """The DFA class implemented using openFst library"""
        pass
except ImportError:
    print 'FAIL'
    try:
        print 'Checking for pywrapfst module:',
        imp.find_module('pywrapfst')
        print 'OK'
        from pywrapfstdfa import PywrapfstDFA, TropicalWeight

        class DFA(PywrapfstDFA):
            """The DFA class implemented using openFst library"""

            def copy(self):
                mma = DFA()
                mma.automaton = self.automaton.copy()
                mma.alphabet = copy.deepcopy(self.alphabet)
                mma.isyms = copy.deepcopy(self.isyms)
                mma.osyms = copy.deepcopy(self.osyms)
                return mma

    except ImportError:
        print 'FAIL'
        print 'Fallback to python implementation:OK'
        from pythondfa import PythonDFA, TropicalWeight

        class DFA(PythonDFA):
            """The DFA class implemented using python"""

            def copy(self):
                mma = DFA()
                mma.states = copy.deepcopy(self.states)
                mma.alphabet = copy.deepcopy(self.alphabet)
                mma.isyms = copy.deepcopy(self.isyms)
                mma.osyms = copy.deepcopy(self.osyms)
                return mma
            pass
{'fraction_non_alphanumeric': 0.08945478289258897, 'fraction_numerical': 0.0, 'mean_word_length': 1.9236641221374047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '178303', 'n_tokens_mistral': 940, 'n_tokens_neox': 884, 'n_words': 228}