<commit_before># -*- coding: utf-8 -*-
#
# Poio Tools for Linguists
#
# Copyright (C) 2009-2013 Poio Project
# Author: <NAME> <<EMAIL>>
# URL: <http://media.cidles.eu/poio/>
# For license information, see LICENSE.TXT

import os

import poioapi.io.pickle
import poioapi.io.graf
import poioapi.data

class TestPickle:

    def setup(self):
        self.data_structure = ['utterance',
            ['clause_unit',
                ['word', 'wfw', 'graid1'],
             'graid2'], 'translation', 'comment']

        filename = os.path.join(os.path.dirname(__file__), "sample_files",
            "balochi_graf", "balochi.pickle")

        self.pickle_parser = poioapi.io.pickle.Parser(filename, poioapi.data.GRAID)

    def test_find_childs_in_hierarchy(self):
        utterance_childs = ['clause_unit', 'translation', 'comment']

        clause_unit = ['clause_unit',
            ['word', 'wfw', 'graid1'],
                       'graid2']
        clause_unit_childs = ['word', 'graid2']

        word = ['word', 'wfw', 'graid1']
        word_childs = ['wfw', 'graid1']

        utterance_strct = self.pickle_parser._find_childs_from_structure(self.data_structure)<commit_msg>Test_pickle updated to latest parser.<commit_after># -*- coding: utf-8 -*-
#
# Poio Tools for Linguists
#
# Copyright (C) 2009-2013 Poio Project
# Author: <NAME> <<EMAIL>>
# URL: <http://media.cidles.eu/poio/>
# For license information, see LICENSE.TXT

import os

import poioapi.io.pickle
import poioapi.io.graf
import poioapi.data

class TestPickle:

    def setup(self):
        self.data_structure = ['utterance',
            ['clause_unit',
                ['word', 'wfw', 'graid1'],
             'graid2'], 'translation', 'comment']

        filename = os.path.join(os.path.dirname(__file__), "sample_files",
            "balochi_graf", "balochi.pickle")

        self.pickle_parser = poioapi.io.pickle.Parser(filename)

    def test_find_childs_in_hierarchy(self):
        utterance_childs = ['clause_unit', 'translation', 'comment']

        clause_unit = ['clause_unit',
            ['word', 'wfw', 'graid1'],
                       'graid2']
        clause_unit_childs = ['word', 'graid2']

        word = ['word', 'wfw', 'graid1']
        word_childs = ['wfw', 'graid1']

        utterance_strct = self.pickle_parser._find_childs_from_structure(self.data_structure)
{'fraction_non_alphanumeric': 0.14906303236797275, 'fraction_numerical': 0.013628620102214651, 'mean_word_length': 2.857142857142857, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6253358', 'n_tokens_mistral': 826, 'n_tokens_neox': 796, 'n_words': 152}