docstr: Check if text is offensive using string matcher and classifier.
docstr_tok: ["Check","if","text","is","offensive","using","string","matcher","and","classifier","."]
code: def check_offensive(self, text):
      """
      Check if text is offensive using string matcher and classifier.
      """
      if text == "":
          return False
      if (
          hasattr(self, "offensive_string_matcher")
          and text in self.offensive_string_matcher
      ):
          return True
      if (
          hasattr(self, "offensive_classifier")
          and text in self.offensive_classifier
      ):
          return True
  
      return False
  
file_path: ParlAI/parlai/agents/safe_local_human/safe_local_human.py
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.utils.misc import display_messages
  from parlai.utils.strings import colorize
  from parlai.agents.local_human.local_human import LocalHumanAgent
  from parlai.utils.safety import OffensiveStringMatcher, OffensiveLanguageClassifier
label_desc: Use image node_id 4 for calling the SafeLocalHumanAgent obj's underlying member method code with example usage: obj.check_offensive(text) and returns: False, False, True, True