code: def extract_answer(self, response, row):
      m = re.findall(r"所以答案是(.+?)。", response, re.M)
      if len(m) > 0 and m[-1] in self.choices:
          return m[-1], True
      answer_patterns = [
          r"([ABCD])是正确的",
          r"选项([ABCD])正确",
          r"答案为([ABCD])",
          r"答案是([ABCD])",
          r"答案([ABCD])",
          r"选择([ABCD])",
          r"答案：([ABCD])",
          r"选择答案([ABCD])",
      ]
      # RE extraction
      for answer_pattern in answer_patterns:
          m = re.search(answer_pattern, response, re.M)
          if m:
              answer = m.group(1)
              return answer, False
      # only containing one choice-character
      m = re.findall(r"[ABCD]", response, re.M)
      if len(m) >= 1:
          answer = m[0]
          return answer, False
      # only containing one choice-context
      choices_dict = {}
      pattern = ""
      for c in self.choices:
          choices_dict[str(row[f"{c}"])] = c
          pattern += re.escape(str(row[f"{c}"])) + "|"
      pattern = pattern[:-1]
      m = re.findall(pattern, response, re.M)
      print("w/ escape:", repr(pattern), response, (len(m) >= 1))
      if len(m) >= 1:
          answer = choices_dict[m[0]]
          return answer, False
      return random.choice("ABCD"), False
  
file_path: BigDL/python/llm/dev/benchmark/ceval/evaluators/llama.py
imports: import re
  import random
  from tqdm import tqdm
  import numpy
  import torch
  from transformers import LlamaTokenizer, GenerationConfig
  from bigdl.llm.transformers import AutoModelForCausalLM
  from evaluators.evaluator import Evaluator
label_desc: Use image node_id 6 for calling the LlamaEvaluator obj's underlying member method code with example usage: obj.extract_answer(response, row) and returns: random,  False, m,  True, answer,  False, answer,  False, answer,  False