def test_query(): dict = Dict() dict.unload() with pytest.raises(Exception): dict.query('') dict.load() assert (dict.query('') == []) assert (set(dict.query('아버지')) == set(['nc'])) assert (set(dict.query('가')) == set(['ep', 'xp', 'nc', 'jc', 'ec']))
def test_query(): dict = Dict() dict.unload() with pytest.raises(Exception): dict.query("") dict.load() assert dict.query("") == [] assert set(dict.query("아버지")) == set(["nc"]) assert set(dict.query("가")) == set(["ep", "xp", "nc", "jc", "ec"])
from hama.tagging import tag from hama.tagging.dict import Dict print(tag("a다르고 uh다르다", zipped=True)) dict = Dict() dict.load() print(dict.query("자동차"))
def test_unload(): dict = Dict() dict.unload() assert (dict.dict == None)
def test_wrong_attr(): dict = Dict() assert (dict.booboo == None)
def init(callback=None): Dict().load() TagHMM().load() if callback is not None: callback()
def pytest_runtest_setup(item): Dict().load() TagHMM().load()