コード例 #1
0
ファイル: test_it.py プロジェクト: DevKhokhar/pattern
 def test_gender(self):
     # Assert the accuracy of the gender disambiguation algorithm.
     from pattern.db import Datasheet
     i, n = 0, 0
     for pos, sg, pl, mf in Datasheet.load(os.path.join(PATH, "corpora", "wordforms-it-wiktionary.csv")):
         g = it.gender(sg)
         if mf in g and it.PLURAL not in g:
             i += 1
         g = it.gender(pl)
         if mf in g and it.PLURAL in g:
             i += 1
         n += 2
     self.assertTrue(float(i) / n > 0.92)
     print "pattern.it.gender()"
コード例 #2
0
 def test_gender(self):
     # Assert the accuracy of the gender disambiguation algorithm.
     from pattern.db import Datasheet
     i, n = 0, 0
     for pos, sg, pl, mf in Datasheet.load(os.path.join(PATH, "corpora", "wordforms-it-wiktionary.csv")):
         g = it.gender(sg)
         if mf in g and it.PLURAL not in g:
             i += 1
         g = it.gender(pl)
         if mf in g and it.PLURAL in g:
             i += 1
         n += 2
     self.assertTrue(float(i) / n > 0.92)
     print("pattern.it.gender()")
コード例 #3
0
from pattern.it import parse, MALE, FEMALE, PLURAL, gender

s = "studentesse"
print gender(s)