Skip to content

Commit

Permalink
add explanation test
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-northlander committed May 20, 2024
1 parent dd2b5f5 commit d335693
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test-scripts/01-integration-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ def test_tokenize_using_sudachi_tokenizer(self):
self.assertEqual(6, tokens[3]["end_offset"])
return

def test_explain_tokenizer_details(self):
body = {"tokenizer": "sudachi_tokenizer",
"text": "すだち", "explain": True}
resp = es_instance.analyze(body)
self.assertEqual(200, resp.status)

token = json.loads(resp.data)["detail"]["tokenizer"]["tokens"][0]
self.assertIn("dictionaryForm", token)
self.assertEqual("すだち", token["dictionaryForm"])
self.assertIn("normalizedForm", token)
self.assertEqual("酢橘", token["normalizedForm"])
self.assertIn("readingForm", token)
self.assertEqual("スダチ", token["readingForm"])
self.assertIn("partOfSpeech", token)
self.assertEqual(["名詞", "普通名詞", "一般", "*", "*", "*"],
token["partOfSpeech"])
return


class TestICUFiltered(unittest.TestCase):
# requires analysis-icu plugin installed
Expand Down

0 comments on commit d335693

Please sign in to comment.