-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from himkt/add-attributes-to-token
Add attributes to token
- Loading branch information
Showing
2 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Test for word tokenizers""" | ||
import unittest | ||
|
||
from tiny_tokenizer.tiny_tokenizer_token import Token | ||
|
||
|
||
class TokenTest(unittest.TestCase): | ||
"""Test ordinal word tokenizer.""" | ||
|
||
def test_token_without_feature(self): | ||
token = Token(surface="大崎") | ||
self.assertEqual("大崎", token.surface) | ||
self.assertEqual("", token.feature) | ||
|
||
def test_token_with_postag(self): | ||
token = Token(surface="大崎", postag="名詞") | ||
self.assertEqual("大崎", token.surface) | ||
self.assertEqual("名詞", token.feature) | ||
|
||
def test_token_with_postag2(self): | ||
token = Token( | ||
surface="大崎", | ||
postag="名詞", | ||
postag2="固有名詞,人名,姓", | ||
conj_type="*", | ||
conj_form="*", | ||
origin_form="大崎", | ||
yomi="オオサキ", | ||
pron="オーサキ") | ||
|
||
self.assertEqual( | ||
"名詞,固有名詞,人名,姓,*,*,大崎,オオサキ,オーサキ", | ||
token.feature) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters