# Path: yaya/dictionary/person_dict.py
# class PersonDict:
#     def __init__(self):
#         self.trie = DoubleArrayTrie.load(config.PERSON_DICT_NAME, enum_cls=NR)
#         self.matrix = HMMMatrix.load(config.PERSON_TR_PATH, NR)


import os
import yaya.config
from unittest import TestCase
from yaya.collection.dict import *
from yaya.dictionary.person_dict import PersonDict
        words.append(u"一举 n 1")
        words.append(u"一举一动 n 1")
        words.append(u"一举成名 n 1")
        words.append(u"一举成名天下知 n 1")
        words.append(u"啊 n 1")
        words.append(u"埃及 n 1")
        words.append(u"阿拉伯 n 1")
        words.append(u"阿拉伯人 n 1")
        words.append(u"阿根廷 n 1")
        words.append(u"阿胶 n 1")
        words.sort()
        trie=DoubleArrayTrie.load_from_list(words)
        self.assertEqual(trie.get(u"一举")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举一动")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举成名")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举成名天下知")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"啊")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"埃及")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"阿拉伯")[1].nature, NATURE.n)

    def test_load_dict(self):
        new_trie = DoubleArrayTrie.load_dict_file(os.path.join("data", "test.txt"))
        self.assertGreater(new_trie.exact_match_search(u"注册机"), 0)

    def test_load_big(self):
        trie = DoubleArrayTrie.load(yaya.config.CORE_DICT_NAME)
        self.assertGreater(trie.exact_match_search(u"法兰西斯"), 0)
        self.assertIsNotNone(trie.get(u"法兰西")[1].nature, u"核心字典里的value字段不应该None")



# Path: yaya/dictionary/person_dict.py
# class PersonDict:
#     def __init__(self):
#         self.trie = DoubleArrayTrie.load(config.PERSON_DICT_NAME, enum_cls=NR)
#         self.matrix = HMMMatrix.load(config.PERSON_TR_PATH, NR)


# Path: test/test_dict.py
import os
import yaya.config
from unittest import TestCase
from yaya.collection.dict import *
from yaya.dictionary.person_dict import PersonDict

        words.append(u"一举 n 1")
        words.append(u"一举一动 n 1")
        words.append(u"一举成名 n 1")
        words.append(u"一举成名天下知 n 1")
        words.append(u"啊 n 1")
        words.append(u"埃及 n 1")
        words.append(u"阿拉伯 n 1")
        words.append(u"阿拉伯人 n 1")
        words.append(u"阿根廷 n 1")
        words.append(u"阿胶 n 1")
        words.sort()
        trie=DoubleArrayTrie.load_from_list(words)
        self.assertEqual(trie.get(u"一举")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举一动")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举成名")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"一举成名天下知")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"啊")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"埃及")[1].nature, NATURE.n)
        self.assertEqual(trie.get(u"阿拉伯")[1].nature, NATURE.n)

    def test_load_dict(self):
        new_trie = DoubleArrayTrie.load_dict_file(os.path.join("data", "test.txt"))
        self.assertGreater(new_trie.exact_match_search(u"注册机"), 0)

    def test_load_big(self):
        trie = DoubleArrayTrie.load(yaya.config.CORE_DICT_NAME)
        self.assertGreater(trie.exact_match_search(u"法兰西斯"), 0)
        self.assertIsNotNone(trie.get(u"法兰西")[1].nature, u"核心字典里的value字段不应该None")



    def test_search(self):