Esempio n. 1
0
 def __init__(self, data_dir: pathlib.Path=None, language='lt'):
     self.data_dir = data_dir or pathlib.Path(pres.resource_filename('gramtool', 'data'))
     self.language = language
     self.symbols = get_grammar_tree(str(self.data_dir / 'grammar.yaml'))
     self.hunspell = self._get_hunspell()
     self.frequency = get_frequency_list(str(self.data_dir / self.language / 'frequency'))
     self.grammar = self._get_grammar()
Esempio n. 2
0
 def __init__(self, data_dir: pathlib.Path = None, language='lt'):
     self.data_dir = data_dir or pathlib.Path(
         pres.resource_filename('gramtool', 'data'))
     self.language = language
     self.symbols = get_grammar_tree(str(self.data_dir / 'grammar.yaml'))
     self.hunspell = self._get_hunspell()
     self.frequency = get_frequency_list(
         str(self.data_dir / self.language / 'frequency'))
     self.grammar = self._get_grammar()
Esempio n. 3
0
    def __init__(self, lang):
        data_dir = pres.resource_filename('gramtool', 'data')
        data = lambda *args: os.path.join(data_dir, *args)  # noqa

        grammar_file = data('grammar.yaml')
        rules_file = data(lang, 'grammar')
        hunspell_dic_file = data(lang, 'hunspell.dic')
        hunspell_aff_file = data(lang, 'hunspell.aff')

        self.tree = get_grammar_tree(grammar_file)
        self.rules = get_grammar_rules(self.tree, rules_file)
        self.hunspell = get_hunspell_dict(hunspell_aff_file, hunspell_dic_file)
        self.grammar = Grammar(self.hunspell, self.tree, self.rules)
Esempio n. 4
0
    def __init__(self, lang):
        data_dir = pres.resource_filename('gramtool', 'data')
        data = lambda *args: os.path.join(data_dir, *args)  # noqa

        grammar_file = data('grammar.yaml')
        rules_file = data(lang, 'grammar')
        hunspell_dic_file = data(lang, 'hunspell.dic')
        hunspell_aff_file = data(lang, 'hunspell.aff')

        self.tree = get_grammar_tree(grammar_file)
        self.rules = get_grammar_rules(self.tree, rules_file)
        self.hunspell = get_hunspell_dict(hunspell_aff_file, hunspell_dic_file)
        self.grammar = Grammar(self.hunspell, self.tree, self.rules)
Esempio n. 5
0
    def __init__(self, lang):
        path = '..', '..', '..', 'data'
        data_dir = os.path.abspath(os.path.join(__file__, *path))
        data = lambda *args: os.path.join(data_dir, *args)

        grammar_file = data('grammar.yaml')
        rules_file = data(lang, 'grammar')
        hunspell_dic_file = data(lang, 'hunspell.dic')
        hunspell_aff_file = data(lang, 'hunspell.aff')

        self.tree = get_grammar_tree(grammar_file)
        self.rules = get_grammar_rules(self.tree, rules_file)
        self.hunspell = get_hunspell_dict(hunspell_aff_file, hunspell_dic_file)
        self.grammar = Grammar(self.hunspell, self.tree, self.rules)
Esempio n. 6
0
    def __init__(self, lang):
        path = '..', '..', '..', 'data'
        data_dir = os.path.abspath(os.path.join(__file__, *path))
        data = lambda *args: os.path.join(data_dir, *args)

        grammar_file = data('grammar.yaml')
        rules_file = data(lang, 'grammar')
        hunspell_dic_file = data(lang, 'hunspell.dic')
        hunspell_aff_file = data(lang, 'hunspell.aff')

        self.tree = get_grammar_tree(grammar_file)
        self.rules = get_grammar_rules(self.tree, rules_file)
        self.hunspell = get_hunspell_dict(hunspell_aff_file, hunspell_dic_file)
        self.grammar = Grammar(self.hunspell, self.tree, self.rules)
Esempio n. 7
0
 def symbols(self):
     grammar_file = self.data_dir / 'grammar.yaml'
     return get_grammar_tree(str(grammar_file))
Esempio n. 8
0
 def symbols(self):
     grammar_file = self.data_dir / 'grammar.yaml'
     return get_grammar_tree(str(grammar_file))