<commit_before>#!/usr/bin/env Python
from __future__ import unicode_literals, print_function

import unittest
import flite
import types


class TestVectorWithIPASpace(unittest.TestCase):
    def setUp(self):
        self.vwis = flite.VectorsWithIPASpace()

    def test_data_structure1(self):
        for seg in self.vwis.word_to_segs('DRY-dipped'):
            self.assertEqual(len(seg), 6)
            self.assertIsInstance(seg[0], types.StringTypes)
            self.assertIsInstance(seg[1], types.IntType)
            self.assertIsInstance(seg[2], types.StringTypes)
            self.assertIsInstance(seg[3], types.StringTypes)
            self.assertIsInstance(seg[4], types.IntType)
            self.assertIsInstance(seg[5], types.ListType)
            self.assertTrue(len(seg[5]) == self.vwis.num_panphon_fts)
            for v in seg[5]:
                self.assertIn(v, [-1, 0, 1])

    def test_data_structure2(self):
        for seg in self.vwis.word_to_segs('$variable'):
            self.assertEqual(len(seg), 6)
            self.assertIsInstance(seg[0], types.StringTypes)
            self.assertIsInstance(seg[1], types.IntType)
            self.assertIsInstance(seg[2], types.StringTypes)
            self.assertIsInstance(seg[3], types.StringTypes)
            self.assertIsInstance(seg[4], types.IntType)
            self.assertIsInstance(seg[5], types.ListType)
            self.assertTrue(len(seg[5]) == self.vwis.num_panphon_fts)
            for v in seg[5]:
                self.assertIn(v, [-1, 0, 1])<commit_msg>Added test to test_flite.py<commit_after>#!/usr/bin/env Python
from __future__ import unicode_literals, print_function

import unittest
import flite
import types


class TestVectorWithIPASpace(unittest.TestCase):
    def setUp(self):
        self.vwis = flite.VectorsWithIPASpace()

    def test_data_structure1(self):
        for seg in self.vwis.word_to_segs('DRY-dipped'):
            self.assertEqual(len(seg), 6)
            self.assertIsInstance(seg[0], types.StringTypes)
            self.assertIsInstance(seg[1], types.IntType)
            self.assertIsInstance(seg[2], types.StringTypes)
            self.assertIsInstance(seg[3], types.StringTypes)
            self.assertIsInstance(seg[4], types.IntType)
            self.assertIsInstance(seg[5], types.ListType)
            self.assertTrue(len(seg[5]) == self.vwis.num_panphon_fts)
            for v in seg[5]:
                self.assertIn(v, [-1, 0, 1])

    def test_data_structure2(self):
        for seg in self.vwis.word_to_segs('$variable'):
            self.assertEqual(len(seg), 6)
            self.assertIsInstance(seg[0], types.StringTypes)
            self.assertIsInstance(seg[1], types.IntType)
            self.assertIsInstance(seg[2], types.StringTypes)
            self.assertIsInstance(seg[3], types.StringTypes)
            self.assertIsInstance(seg[4], types.IntType)
            self.assertIsInstance(seg[5], types.ListType)
            self.assertTrue(len(seg[5]) == self.vwis.num_panphon_fts)
            for v in seg[5]:
                self.assertIn(v, [-1, 0, 1])

    def test_data_structure3(self):
        for seg in self.vwis.word_to_segs('<NAME>'):
            self.assertEqual(len(seg), 6)
            self.assertIsInstance(seg[0], types.StringTypes)
            self.assertIsInstance(seg[1], types.IntType)
            self.assertIsInstance(seg[2], types.StringTypes)
            self.assertIsInstance(seg[3], types.StringTypes)
            self.assertIsInstance(seg[4], types.IntType)
            self.assertIsInstance(seg[5], types.ListType)
            self.assertTrue(len(seg[5]) == self.vwis.num_panphon_fts)
            for v in seg[5]:
                self.assertIn(v, [-1, 0, 1])
{'fraction_non_alphanumeric': 0.12214151197202044, 'fraction_numerical': 0.017487220877051384, 'mean_word_length': 2.6202531645569622, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '6097016', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1177, 'n_words': 190}