Ejemplo n.º 1
0
 def test_dame_namsor_scale(self):
     dn = DameNamsor()
     if (dn.config['DEFAULT']['namsor'] == 'yes'):
         self.assertEqual(-1.0, round(dn.scale("David", "Arroyo")))
Ejemplo n.º 2
0
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))
Ejemplo n.º 3
0
 def test_dame_namsor_scale_method_returns_correct_result(self):
     g = DameNamsor()
     self.assertEqual(-1.0, g.scale("David", "Arroyo"))
Ejemplo n.º 4
0
     else:
         print("You must enable genderapi in config.cfg file")
 elif (args.api == "genderize"):
     if (dg.config['DEFAULT']['genderize'] == 'yes'):
         dg = DameGenderize()
         print(dg.guess(args.name))
         print("probability: " + str(dg.prob(args.name)))
     else:
         print("You must enable genderize in config.cfg file")
 elif (args.api == "namsor"):
     if (dg.config['DEFAULT']['namsor'] == 'yes'):
         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")
     else:
         print("You must enable namsor in config.cfg file")
 elif (args.api == "nameapi"):
     if (dg.config['DEFAULT']['nameapi'] == 'yes'):
         dn = DameNameapi()
         print(dn.guess(str(args.name), str(args.surname)))
         print("confidence: " +
               str(dn.confidence(str(args.name), str(args.surname))))
     else:
         print("You must enable nameapi in config.cfg file")
 elif (args.api == "wikidata"):
     sparql_query = """
     prefix schema: <http://schema.org/>