code: def end_of_chunk(prev_tag, tag, prev_type, type_):
      """Checks if a chunk ended between the previous and current word.
  
      Args:
          prev_tag: previous chunk tag.
          tag: current chunk tag.
          prev_type: previous type.
          type_: current type.
  
      Returns:
          chunk_end: boolean.
      """
      chunk_end = False
  
      if prev_tag == "E":
          chunk_end = True
      if prev_tag == "S":
          chunk_end = True
  
      if prev_tag == "B" and tag == "B":
          chunk_end = True
      if prev_tag == "B" and tag == "S":
          chunk_end = True
      if prev_tag == "B" and tag == "O":
          chunk_end = True
      if prev_tag == "I" and tag == "B":
          chunk_end = True
      if prev_tag == "I" and tag == "S":
          chunk_end = True
      if prev_tag == "I" and tag == "O":
          chunk_end = True
  
      if prev_tag != "O" and prev_tag != "." and prev_type != type_:
          chunk_end = True
  
      return chunk_end
  
file_path: ktrain/ktrain/text/ner/metrics.py
imports: from __future__ import absolute_import, division, print_function
  import warnings
  from collections import defaultdict
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: end_of_chunk(prev_tag, tag, prev_type, type_) and returns: chunk_end