Exemple #1
0
    def __init__(self, knowledgebase=None, *args, **kwargs):
        super(Frontend, self).__init__(*args, **kwargs)

        if 'providers' not in kwargs:
            self.knowledgebase = knowledgebase or get_knowledgebase(
                frontend=self,
                fetcher=kwargs.get('fetcher')
            )

        logging.getLogger("edn_format").setLevel(logging.WARNING)
Exemple #2
0
    def resolve_error(self, cls, symbol, attr):
        kb = get_knowledgebase()

        if isinstance(attr, LispType):
            attr = attr.val
        else:
            attr = attr

        attr = attr.lower()

        # TODO: seems hacky, move to its own method and allow for multiple
        # error conditions
        if 'wikibase-person' in kb.get_classes(symbol) and \
           attr.lower().startswith('death-') and \
           kb.get(cls, symbol, 'birth-date'):
            return self._err("Currently alive")

        return self._err("Unknown")
 def setUp(self):
     self.log = logging.getLogger("resolver-testing")
     self.fe = Frontend()
     self.kb = get_knowledgebase()
     self.term_resolver = resolvers.TermResolver()