MCPcopy Index your code
hub / github.com/clips/pattern / test_pluralize

Method test_pluralize

test/test_en.py:40–53  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 print "pattern.en.inflect.article()"
39
40 def test_pluralize(self):
41 # Assert "octopodes" for classical plural of "octopus".
42 # Assert "octopuses" for modern plural.
43 self.assertEqual("octopodes", en.inflect.pluralize("octopus", classical=True))
44 self.assertEqual("octopuses", en.inflect.pluralize("octopus", classical=False))
45 # Assert the accuracy of the pluralization algorithm.
46 from pattern.db import Datasheet
47 i, n = 0, 0
48 for sg, pl in Datasheet.load(os.path.join(PATH, "corpora", "wordforms-en-celex.csv")):
49 if en.inflect.pluralize(sg) == pl:
50 i +=1
51 n += 1
52 self.assertTrue(float(i) / n > 0.95)
53 print "pattern.en.inflect.pluralize()"
54
55 def test_singularize(self):
56 # Assert the accuracy of the singularization algorithm.

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected