Ejemplo n.º 1
0
 def test_pluralize(self):
     # Assert "auto's" as plural of "auto".
     self.assertEqual("auto's", nl.inflect.pluralize("auto"))
     # Assert the accuracy of the pluralization algorithm.
     from pattern.db import Datasheet
     i, n = 0, 0
     for pred, attr, sg, pl in Datasheet.load(os.path.join(PATH, "corpora", "wordforms-nl-celex.csv")):
         if nl.pluralize(sg) == pl:
             i += 1
         n += 1
     self.assertTrue(float(i) / n > 0.74)
     print("pattern.nl.pluralize()")
Ejemplo n.º 2
0
 def test_pluralize(self):
     # Assert "auto's" as plural of "auto".
     self.assertEqual("auto's", nl.inflect.pluralize("auto"))
     # Assert the accuracy of the pluralization algorithm.
     from pattern.db import Datasheet
     i, n = 0, 0
     for pred, attr, sg, pl in Datasheet.load(os.path.join(PATH, "corpora", "wordforms-nl-celex.csv")):
         if nl.pluralize(sg) == pl:
             i +=1
         n += 1
     self.assertTrue(float(i) / n > 0.74)
     print "pattern.nl.pluralize()"