コード例 #1
0
ファイル: basebots.py プロジェクト: MikeyBeez/nlpia-bot
 def reset_context(self, context=None):
     self.context = {'args': self.args}
     if isinstance(context, str):
         context = {'doc': {'text': context}}
     dict_merge(self.context, context)
     logging.warning(f"Reset self.context: {self.context}")
     return self.context
コード例 #2
0
 def update_context(self, context=None):
     logging.warning(f"Updating self.context using context: {context}")
     if isinstance(context, str):
         context = {'doc': {'text': context}}
     context = {} if context is None else dict(context)
     dict_merge(self.context, context)
     logging.warning(f"Updated self.context: {self.context}")
     return self.context
コード例 #3
0
ファイル: basebots.py プロジェクト: nlpia/qary-clean
 def update_context(self, context=None):
     log.debug(f"Updating self.context using context: {repr(context)[:60]}")
     if isinstance(context, str):
         context = {'doc': {'text': context}}
     context = {} if context is None else dict(context)
     dict_merge(self.context, context)
     log.debug(f"Updated self.context: {repr(self.context)[:60]}")
     return self.context
コード例 #4
0
 def dict_merge(self, other):
     dict_merge(self, other)