class_docstr: LM Chunk Teacher, base.
  
  Provides functionality for subclassed teachers for extracting data from world log
  files, generated via `generate_lm_data.py`
class_docstr_tok: ["LM","Chunk","Teacher",",","base",".","Provides","functionality","for","subclassed","teachers","for","extracting","data","from","world","log","files",",","generated","via","`","generate_lm_data.py","`"]
docstr: Return an episode given xturns and yturns.
  
  :param xturns:
      list of context turns
  :param yturns:
      list of label turns
  
  :return episodes:
      return built episodes
docstr_tok: ["Return","an","episode","given","xturns","and","yturns",".",":","param","xturns",":","list","of","context","turns",":","param","yturns",":","list","of","label","turns",":","return","episodes",":","return","built","episodes"]
code: def _get_ep_from_turns(
      self, xturns: List[Message], yturns: List[Message]
  ) -> List[Message]:
      """
      Return an episode given xturns and yturns.
  
      :param xturns:
          list of context turns
      :param yturns:
          list of label turns
  
      :return episodes:
          return built episodes
      """
      eps = []
      for xturn, yturn in zip(xturns, yturns):
          turn = {}
          # standard fields
          turn["text"] = (
              xturn.get("text")
              .strip()
              .replace(TOKEN_KNOWLEDGE, f"{TOKEN_KNOWLEDGE} ")
              .replace(TOKEN_END_KNOWLEDGE, f" {TOKEN_END_KNOWLEDGE}")
          )
          # subtract 1 to get rid of newline char
          if len(turn["text"].split("\n")) == 1:
              # no actual context here...
              turn[NO_KNOWLEDGE_FIELD] = ""
          else:
              newline_correction = int(turn["text"].endswith("\n"))
              turn[NO_KNOWLEDGE_FIELD] = turn["text"][
                  : turn["text"].index(TOKEN_KNOWLEDGE)
                  - newline_correction
              ]
          turn["labels"] = [yturn.get("text").strip()]
          turn["episode_done"] = False
          # my fields
          if not self.opt["exclude_retrieved_docs"]:
              turn[CONST.RETRIEVED_DOCS] = yturn["retrieved_docs"]
              turn[CONST.RETRIEVED_DOCS_TITLES] = [
                  d.split(" / ")[0] for d in yturn["retrieved_docs"]
              ]
              turn[CONST.RETRIEVED_DOCS_URLS] = [
                  "" for _ in yturn["retrieved_docs"]
              ]
              turn[CONST.SELECTED_DOCS] = [yturn["gold_doc"]]
              turn[CONST.SELECTED_DOCS_TITLES] = [
                  yturn["gold_doc"].split(" / ")[0]
              ]
              turn[CONST.SELECTED_DOCS_URLS] = []
              turn[CONST.SELECTED_SENTENCES] = [yturn["knowledge"]]
          else:
              turn[CONST.SELECTED_DOCS_TITLES] = [
                  yturn["gold_doc"].split(" / ")[0]
              ]
              turn[CONST.SELECTED_SENTENCES] = [yturn["knowledge"]]
  
          turn["search_query"] = yturn["search_query"]
          turn["f1_overlap"] = yturn["f1_overlap"]
          if self.passes_filters(xturn, yturn):
              eps.append(self.finalize_message(turn))
      if eps:
          eps[-1].force_set("episode_done", True)
      return eps
  
imports: from abc import ABC, abstractmethod
  import os
  from typing import Tuple, List, Optional, Any, Dict
  import random
  from parlai.core.message import Message
  from parlai.core.metrics import F1Metric, BleuMetric, RougeMetric, AverageMetric, ExactMatchMetric, normalize_answer
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.teachers import ChunkTeacher, ChunkOutput
  import parlai.tasks.wizard_of_internet.constants
  from parlai.utils.conversations import Conversations
  from parlai.utils.data import DatatypeHelper
  import parlai.utils.logging
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE, TOKEN_END_KNOWLEDGE
  from projects.seeker.utils import extract_entities, remove_possible_title_from_text
label_desc: Use image node_id 3 for calling the AbstractLMChunkTeacher obj's underlying member method code with example usage: obj._get_ep_from_turns(xturns, yturns) and returns: eps