MCPcopy Create free account
hub / github.com/clips/pattern / test_find_tokens

Method test_find_tokens

test/test_text.py:68–79  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 pass
67
68 def test_find_tokens(self):
69 # Assert the default tokenizer and its optional parameters.
70 p = text.Parser()
71 v1 = p.find_tokens(u"Schrödinger's cat is alive!", punctuation="", replace={})
72 v2 = p.find_tokens(u"Schrödinger's cat is dead!", punctuation="!", replace={"'s": " 's"})
73 v3 = p.find_tokens(u"etc.", abbreviations=set())
74 v4 = p.find_tokens(u"etc.", abbreviations=set(("etc.",)))
75 self.assertEqual(v1[0], u"Schrödinger's cat is alive!")
76 self.assertEqual(v2[0], u"Schrödinger 's cat is dead !")
77 self.assertEqual(v3[0], "etc .")
78 self.assertEqual(v4[0], "etc.")
79 print "pattern.text.Parser.find_tokens()"
80
81 def test_find_tags(self):
82 # Assert the default part-of-speech tagger and its optional parameters.

Callers

nothing calls this directly

Calls 1

find_tokensMethod · 0.95

Tested by

no test coverage detected