Esempio n. 1
0
    def preprocess_ent_name(self, ent_name):
        """
        Preprocesses entity name.

        :return: Preprocessed entity name.
        """
        ent_name = ent_name.strip()
        ent_name = trim1(ent_name)
        ent_name = html.unescape(ent_name)
        ent_name = ent_name.replace("_", " ")
        ent_name = ent_name.capitalize()

        ent_name = self.wiki_redirect_ent_title(ent_name)
        return ent_name
    def preprocess_ent_name(self, ent_name):
        """
        Preprocesses entity name.

        :return: Preprocessed entity name.
        """
        ent_name = ent_name.strip()
        ent_name = trim1(ent_name)
        ent_name = ent_name.replace("&", "&")
        ent_name = ent_name.replace(""", '"')
        ent_name = ent_name.replace("_", " ")
        ent_name = first_letter_to_uppercase(ent_name)

        ent_name = self.wiki_redirect_ent_title(ent_name)
        return ent_name
Esempio n. 3
0
    def preprocess_ent_name_for_wiki_id_lookup(self, ent_name):
        """
        Preprocesses entity name for wikipedia id lookups. Since the
        lookup map (wiki_name_id_map.txt) contains some special chars
        as 'Johnson & Johnson' and '"Hello, World!" program'
        we need to preserve them from predicted entity names for lookups
        to have successful match.

        :return: Preprocessed entity name for wikipedia id lookups
        """
        ent_name = ent_name.strip()
        ent_name = trim1(ent_name)
        ent_name = ent_name.replace("_", " ")
        ent_name = first_letter_to_uppercase(ent_name)

        ent_name = self.wiki_redirect_ent_title(ent_name)
        return ent_name