public function testFemale()
 {
     $personGenderizer = $this->makeServiceFactory()->genderizerServices()->personGenderizer();
     $inputPerson = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("Angela Merkel")->build())->build();
     $personGenderResult = $personGenderizer->assess($inputPerson);
     $this->assertEquals('FEMALE', (string) $personGenderResult->getGender());
 }
 public function testFormat()
 {
     $personNameFormatter = $this->makeServiceFactory()->formatterServices()->personNameFormatter();
     $inputPerson = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("john f. kennedy")->build())->build();
     $formatterResult = $personNameFormatter->format($inputPerson, new FormatterProperties());
     $this->assertEquals('John F. Kennedy', $formatterResult->getFormatted());
 }
 public function test_parseTwoPeople()
 {
     //setup code:
     $context = Context::builder()->priority(Priority::REALTIME())->build();
     $myApiKey = 'test';
     //grab one from nameapi.org
     $serviceFactory = new ServiceFactory($myApiKey, $context, Host::http('rc50-api.nameapi.org'), '5.0');
     $personNameParser = $serviceFactory->parserServices()->personNameParser();
     //the call:
     $inputPerson = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("Peter und Daniela Meyer")->build())->build();
     $parseResult = $personNameParser->parse($inputPerson);
     //the assertions:
     $bestMatch = $parseResult->getBestMatch();
     $this->assertEquals('MULTIPLE', (string) $bestMatch->getParsedPerson()->getPersonType());
     $people = $bestMatch->getParsedPerson()->getPeople();
     $this->assertEquals(2, sizeof($people));
     $firstPerson = $people[0];
     $this->assertEquals('Peter', $firstPerson->getAddressingGivenName());
     $this->assertEquals('Meyer', $firstPerson->getAddressingSurname());
     $this->assertEquals('MALE', (string) $firstPerson->getGender()->getGender());
     $secondPerson = $people[1];
     $this->assertEquals('Daniela', $secondPerson->getAddressingGivenName());
     $this->assertEquals('Meyer', $secondPerson->getAddressingSurname());
     $this->assertEquals('FEMALE', (string) $secondPerson->getGender()->getGender());
 }
 public function testMatch_different()
 {
     $personMatcher = $this->makeServiceFactory()->matcherServices()->personMatcher();
     $inputPerson1 = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("John F. Kennedy")->build())->ageInfo(AgeInfoFactory::forDate(1917, 5, 29))->build();
     $inputPerson2 = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("John Doe")->build())->ageInfo(AgeInfoFactory::forDate(1990, 12, 31))->build();
     $personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2);
     $this->assertEquals('DIFFERENT', (string) $personMatcherResult->getMatchType());
 }
 public function testParse()
 {
     $personNameParser = $this->makeServiceFactory()->parserServices()->personNameParser();
     $inputPerson = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("John Doe")->build())->build();
     $parseResult = $personNameParser->parse($inputPerson);
     $bestMatch = $parseResult->getBestMatch();
     $name = $bestMatch->getParsedPerson()->getFirstName();
     $this->assertEquals('John', $name->getFirst('GIVENNAME')->getString());
     $this->assertEquals('Doe', $name->getFirst('SURNAME')->getString());
 }