def create_name(self, set_to_person=True, gender=None, create_new_last=False): if gender is None: gender = self.gender if create_new_last: name_obj = create_random_name(world_data=self.world_obj.world_data, tags=self.world_obj.tags, rand_seed=self.rand_seed_next, gender=gender, pattern=self.name_file_pattern) self.family_name = name_obj.get('name_parts')[-1] else: name_obj = create_random_name(world_data=self.world_obj.world_data, tags=self.world_obj.tags, rand_seed=self.rand_seed_next, gender=gender, pattern=self.name_file_pattern, override={'namefile|given': self.family_name}) name = name_obj['name'] if set_to_person: self.name = name return name_obj
def family_name(self): val = self.get('family_name', default='') if not val: val = self.get('family.father.family_name', default='') if not val: val = self.get('family.mother.family_name', default='') if not val: name_obj = create_random_name(world_data=self.world_obj.world_data, tags=self.world_obj.tags, rand_seed=self.rand_seed_next, pattern='namefile|family') val = name_obj.get('name') self.family_name = val return val
def mother(self): mother_name = self.get('mother_name', None) mother_family_name = '' if not mother_name: name_obj = create_random_name(world_data=self.world_obj.world_data, tags=self.world_obj.tags, rand_seed=self.rand_seed_next, gender='Female', pattern=self.name_file_pattern) mother_name = name_obj['name'] self.set('mother_name', mother_name) mother_family_name = name_obj['name_parts'][-1] mother = self.world_obj.get_person(mother_name) if not mother: mother_data = {"name": mother_name, "family_name": mother_family_name, "age": self.age + numpy.random.randint(30) + self.world_obj.age_of_consent } role = 'Grandmother' if self.role in ['Father', 'Mother'] else 'Mother' mother = Person(self.world_obj, data=mother_data, gender='Female', role=role) return mother