コード例 #1
0
 def test_is_not_blank(self):
     du = DameUtils()
     self.assertEqual(du.is_not_blank("  "), False)
     self.assertEqual(du.is_not_blank("ok"), True)
コード例 #2
0
ファイル: test_dame_utils.py プロジェクト: uritau/damegender
 def test_is_not_blank_method_returns_correct_result(self):
     du = DameUtils()
     self.assertEqual(du.is_not_blank("  "), False)
     self.assertEqual(du.is_not_blank("ok"), True)
コード例 #3
0
ファイル: api2gender.py プロジェクト: uritau/damegender
du = DameUtils()

if (len(sys.argv) > 1):
    if (args.api == "genderguesser"):
        dgg = DameGenderGuesser()
        print(dgg.guess(args.name))
    elif (args.api == "genderapi"):
        dga = DameGenderApi()
        print(dga.guess(args.name, binary=False))
        print("accuracy: " + str(dga.accuracy(args.name)))
    elif (args.api == "genderize"):
        dg = DameGenderize()
        print(dg.guess(args.name))
        print("probability: " + str(dg.prob(args.name)))
    elif (args.api == "namsor"):
        dn = DameNamsor()
        if (du.is_not_blank(args.surname)):
            print(dn.guess(str(args.name), str(args.surname)))
            print("scale: " + str(dn.scale(str(args.name), str(args.surname))))
        else:
            print("Surname is required in namsor api")
    elif (args.api == "nameapi"):
        dn = DameNameapi()
        print(dn.guess(str(args.name), str(args.surname)))
        print("confidence: " + str(dn.confidence(str(args.name), str(args.surname))))
    elif (args.api == "average"):
        da = DameAll()
        average = da.average(args.name, args.surname)
        print("average: " + str(average))