Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
massongit committed Nov 26, 2017
1 parent 0e01002 commit 9d1df9b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_mecab.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,18 @@ def test_parse_tonodes_boundary(self):
if not node.is_eos():
self.assertEqual(node.feature, expected[i])

with mecab.MeCab(r'-O "" -F%m\s%s') as nm:
# with empty string option
yml1 = self.yaml.get('text5')
txt1 = self._u2str(yml1.get('text'))
pat1 = self._u2str(yml1.get('pattern'))
expected = [self._u2str(e) for e in yml1.get('expected')]

gen = nm.parse(txt1, boundary_constraints=pat1, as_nodes=True)
for i, node in enumerate(gen):
if not node.is_eos():
self.assertEqual(node.feature, expected[i])

with mecab.MeCab(r'-F%m\s%F\s[0,1]\s%s -N2') as nm:
# with N-best and output formatting
yml1 = self.yaml.get('text6')
Expand Down

0 comments on commit 9d1df9b

Please sign in to comment.