class_docstr: RPAReranker subclasses the Reranker.
  
  This does the following:
  
  1) Determine listener character from dialogue history
      This is done either via extraction from history or via prediction
  2) Construct augmented dialogue history with text candidates
  3) Predict speaker with augmented dialogue history
  4) Re-rank text candidates according to highest speaker score for (predicted) listener character
  
  The RPA Re-ranker also provides classification functionality, to just simply
  classify incoming responses.
class_docstr_tok: ["RPAReranker","subclasses","the","Reranker",".","This","does","the","following",":","1",")","Determine","listener","character","from","dialogue","history","This","is","done","either","via","extraction","from","history","or","via","prediction","2",")","Construct","augmented","dialogue","history","with","text","candidates","3",")","Predict","speaker","with","augmented","dialogue","history","4",")","Re-rank","text","candidates","according","to","highest","speaker","score","for","(","predicted",")","listener","character","The","RPA","Re-ranker","also","provides","classification","functionality",",","to","just","simply","classify","incoming","responses","."]
docstr: Given context, predict who the character is.
  
  :param context:
      dialogue context
  :param characters:
      available characters to choose from
  :param who:
      whether to predict self or partner
  
  :return whoareyou:
      return predicted self character
docstr_tok: ["Given","context",",","predict","who","the","character","is",".",":","param","context",":","dialogue","context",":","param","characters",":","available","characters","to","choose","from",":","param","who",":","whether","to","predict","self","or","partner",":","return","whoareyou",":","return","predicted","self","character"]
code: def _predict_character_from_context(
      self, context: str, characters: Dict[str, str], who: str
  ) -> str:
      """
      Given context, predict who the character is.
  
      :param context:
          dialogue context
      :param characters:
          available characters to choose from
      :param who:
          whether to predict self or partner
  
      :return whoareyou:
          return predicted self character
      """
      assert (
          not self.annotate_speaker
      ), "if annotate speaker, characters would be in dialogue history"
      control_token = WHO_ARE_YOU if who == "self" else WHO_AM_I
      utterances = self.get_utterances_from_full_context(
          context, include_context=self.include_context
      )
  
      if self.num_utterances > 0:
          utterances = utterances[: self.num_utterances]
  
      utterances.insert(-2, control_token)
      limited_context = self.delimiter.join(utterances)
      label_candidates = extract_characters(context)
      act = self.predict(
          limited_context, predictor_label_candidates=label_candidates
      )
      return act["text"]
  
imports: from typing import Optional, List, Dict
  from parlai.core.agents import create_agent_from_model_file
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from projects.light_whoami.task.agents import SpeakerClassifierTeacher
  from projects.light_whoami.task.utils import WHO_AM_I, WHO_ARE_YOU, extract_characters, maybe_annotate
  from parlai.agents.reranker.reranker import AbstractReranker, AbstractGeneratorRerankAgent, LongAbstractGeneratorRerankAgent
label_desc: Use image node_id 7 for calling the RPAReranker obj's underlying member method code with example usage: obj._predict_character_from_context(context, characters, who) and returns: act