Ejemplo n.º 1
0
    def is_address_name(self, suspected_name):
        """
        Checking if the start of an address bears a name

        :param suspected_name: the text we think is a name
        :type suspected_name: str
        :return: if this is an address
        :rtype: str
        """
        name_parser = NameParser(self.config)
        for _ in name_parser.parse(suspected_name):
            return True
        return False
Ejemplo n.º 2
0
    def prepare_landmark_datastring(self, data):
        """Cleans up and validates the datastring"""
        data = registry.get('LP_the_regex').sub('', data).strip()

        if len(data) > 75:
            return

        name_parser = NameParser(self.config)
        if not name_parser.basic_validation(data.split()):
            return

        allowed_chars = \
            string.whitespace + string.ascii_letters + string.digits
        allowed_chars += '.,-:'

        if [x for x in data if x not in allowed_chars]:
            return

        return data
Ejemplo n.º 3
0
 def setUp(self):
     NameParser.bootstrap(TestConfig())
     self.np = NameParser(TestConfig())