예제 #1
0
def test__mk_segmenter(string, expected):
    model = tu.MockFlatCatSegmentModel()
    segment = fseg.mk_segmenter(model)
    # print segment
    # print segment(string)
    # print (string, ) if type(string) in (unicode, str) else string
    assert (segment(string) == expected)
예제 #2
0
def test__segment_many(strings, expected, flatten):
    mmodel = tu.MockMorfessorSegmentModel()
    fmodel = tu.MockFlatCatSegmentModel()
    segmenters = mkt.mk_segmenters([("morfessor2", mmodel),
                                    ("flatcat", fmodel)])
    assert (list(mkt.segment_many(segmenters, strings,
                                  flatten=flatten)) == expected)
예제 #3
0
def test__segment_many(strings, expected, flatten):
    model = tu.MockFlatCatSegmentModel()
    assert (list(fseg.segment_many(model, strings,
                                   flatten=flatten)) == expected)
예제 #4
0
def test__segment_text(string, expected):
    model = tu.MockFlatCatSegmentModel()
    assert (fseg.segment_text(model, string) == expected)
예제 #5
0
def test__dual_segment_many(strings, expected, flatten):
    mmodel = tu.MockMorfessorSegmentModel()
    fmodel = tu.MockFlatCatSegmentModel()
    assert (list(
        mkt.dual_segment_many(mmodel, fmodel, strings,
                              flatten=flatten)) == expected)
예제 #6
0
def test__segment_text(string, expected):
    mmodel = tu.MockMorfessorSegmentModel()
    fmodel = tu.MockFlatCatSegmentModel()
    segment = mkt.mk_dual_segmenter(mmodel, fmodel)
    assert (mkt.segment_text(segment, string) == expected)
예제 #7
0
def test__mk_segmenters(string, expected):
    mmodel = tu.MockMorfessorSegmentModel()
    fmodel = tu.MockFlatCatSegmentModel()
    segment = mkt.mk_segmenters([("morfessor2", mmodel), ("flatcat", fmodel)])
    assert (segment(string) == expected)
예제 #8
0
def test__dual_segment_many_and_to_string_pairs(strings, expected):
    mmodel = tu.MockMorfessorSegmentModel()
    fmodel = tu.MockFlatCatSegmentModel()
    data = mkt.dual_segment_many(mmodel, fmodel, strings)
    assert (list(mkt.to_string_pairs(data)) == expected)