class_docstr: Defines the conditional probability distribution table (CPD table)
  
  Parameters
  ----------
  variable: int, string (any hashable python object)
      The variable whose CPD is defined.
  
  variable_card: integer
      Cardinality/no. of states of `variable`
  
  values: 2D array, 2D list or 2D tuple
      Values for the CPD table. Please refer the example for the
      exact format needed.
  
  evidence: array-like
      List of variables in evidences(if any) w.r.t. which CPD is defined.
  
  evidence_card: array-like
      cardinality/no. of states of variables in `evidence`(if any)
  
  Examples
  --------
  For a distribution of P(grade|diff, intel)
  
  +---------+-------------------------+------------------------+
  |diff:    |          easy           |         hard           |
  +---------+------+--------+---------+------+--------+--------+
  |aptitude:| low  | medium |  high   | low  | medium |  high  |
  +---------+------+--------+---------+------+--------+--------+
  |gradeA   | 0.1  | 0.1    |   0.1   |  0.1 |  0.1   |   0.1  |
  +---------+------+--------+---------+------+--------+--------+
  |gradeB   | 0.1  | 0.1    |   0.1   |  0.1 |  0.1   |   0.1  |
  +---------+------+--------+---------+------+--------+--------+
  |gradeC   | 0.8  | 0.8    |   0.8   |  0.8 |  0.8   |   0.8  |
  +---------+------+--------+---------+------+--------+--------+
  
  values should be
  [[0.1,0.1,0.1,0.1,0.1,0.1],
  [0.1,0.1,0.1,0.1,0.1,0.1],
  [0.8,0.8,0.8,0.8,0.8,0.8]]
  
  >>> cpd = TabularCPD('grade',3,[[0.1,0.1,0.1,0.1,0.1,0.1],
  ...                             [0.1,0.1,0.1,0.1,0.1,0.1],
  ...                             [0.8,0.8,0.8,0.8,0.8,0.8]],
  ...                             evidence=['diff', 'intel'], evidence_card=[2,3])
  >>> print(cpd)
  +---------+---------+---------+---------+---------+---------+---------+
  | diff    | diff_0  | diff_0  | diff_0  | diff_1  | diff_1  | diff_1  |
  +---------+---------+---------+---------+---------+---------+---------+
  | intel   | intel_0 | intel_1 | intel_2 | intel_0 | intel_1 | intel_2 |
  +---------+---------+---------+---------+---------+---------+---------+
  | grade_0 | 0.1     | 0.1     | 0.1     | 0.1     | 0.1     | 0.1     |
  +---------+---------+---------+---------+---------+---------+---------+
  | grade_1 | 0.1     | 0.1     | 0.1     | 0.1     | 0.1     | 0.1     |
  +---------+---------+---------+---------+---------+---------+---------+
  | grade_2 | 0.8     | 0.8     | 0.8     | 0.8     | 0.8     | 0.8     |
  +---------+---------+---------+---------+---------+---------+---------+
  >>> cpd.values
  array([[[ 0.1,  0.1,  0.1],
          [ 0.1,  0.1,  0.1]],
         [[ 0.1,  0.1,  0.1],
          [ 0.1,  0.1,  0.1]],
         [[ 0.8,  0.8,  0.8],
          [ 0.8,  0.8,  0.8]]])
  >>> cpd.variables
  ['grade', 'diff', 'intel']
  >>> cpd.cardinality
  array([3, 2, 3])
  >>> cpd.variable
  'grade'
  >>> cpd.variable_card
  3
class_docstr_tok: ["Defines","the","conditional","probability","distribution","table","(","CPD","table",")","Parameters","--","--","--","--","--","variable",":","int",",","string","(","any","hashable","python","object",")","The","variable","whose","CPD","is","defined",".","variable_card",":","integer","Cardinality\/no",".","of","states","of","`","variable","`","values",":","2D","array",",","2D","list","or","2D","tuple","Values","for","the","CPD","table",".","Please","refer","the","example","for","the","exact","format","needed",".","evidence",":","array-like","List","of","variables","in","evidences","(","if","any",")","w.r.t",".","which","CPD","is","defined",".","evidence_card",":","array-like","cardinality\/no",".","of","states","of","variables","in","`","evidence","`","(","if","any",")","Examples","--","--","--","--","For","a","distribution","of","P","(","grade|diff",",","intel",")","+","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","+","|diff",":","|","easy","|","hard","|","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","+","|aptitude",":","|","low","|","medium","|","high","|","low","|","medium","|","high","|","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","+","|gradeA","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","+","|gradeB","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","+","|gradeC","|","0.8","|","0.8","|","0.8","|","0.8","|","0.8","|","0.8","|","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","-+","--","--","--","+","--","--","--","--","+","--","--","--","--","+","values","should","be","[","[","0.1,0.1,0.1,0.1,0.1,0.1","]",",","[","0.1,0.1,0.1,0.1,0.1,0.1","]",",","[","0.8,0.8,0.8,0.8,0.8,0.8","]","]",">",">",">","cpd","=","TabularCPD","(","'grade',3",",","[","[","0.1,0.1,0.1,0.1,0.1,0.1","]",",","...","[","0.1,0.1,0.1,0.1,0.1,0.1","]",",","...","[","0.8,0.8,0.8,0.8,0.8,0.8","]","]",",","...","evidence=","[","'diff","'",",","'intel","'","]",",","evidence_card=","[","2,3","]",")",">",">",">","print","(","cpd",")","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","|","diff","|","diff_0","|","diff_0","|","diff_0","|","diff_1","|","diff_1","|","diff_1","|","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","|","intel","|","intel_0","|","intel_1","|","intel_2","|","intel_0","|","intel_1","|","intel_2","|","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","|","grade_0","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","|","grade_1","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","0.1","|","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","|","grade_2","|","0.8","|","0.8","|","0.8","|","0.8","|","0.8","|","0.8","|","+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+","--","--","--","--","-+",">",">",">","cpd.values","array","(","[","[","[","0.1",",","0.1",",","0.1","]",",","[","0.1",",","0.1",",","0.1","]","]",",","[","[","0.1",",","0.1",",","0.1","]",",","[","0.1",",","0.1",",","0.1","]","]",",","[","[","0.8",",","0.8",",","0.8","]",",","[","0.8",",","0.8",",","0.8","]","]","]",")",">",">",">","cpd.variables","[","'grade","'",",","'diff","'",",","'intel","'","]",">",">",">","cpd.cardinality","array","(","[","3",",","2",",","3","]",")",">",">",">","cpd.variable","'grade'",">",">",">","cpd.variable_card","3"]
code: def _truncate_strtable(self, cdf_str):
      terminal_width, terminal_height = get_terminal_size()
  
      list_rows_str = cdf_str.split("\n")
  
      table_width, table_height = len(list_rows_str[0]), len(
          list_rows_str
      )
  
      colstr_i = np.array(
          [
              pos
              for pos, char in enumerate(list_rows_str[0])
              if char == "+"
          ]
      )
  
      if table_width > terminal_width:
          half_width = terminal_width // 2 - 3
  
          left_i = colstr_i[colstr_i < half_width][-1]
          right_i = colstr_i[(table_width - colstr_i) < half_width][0]
  
          new_cdf_str = []
          for temp_row_str in list_rows_str:
              left = temp_row_str[: left_i + 1]
              right = temp_row_str[right_i:]
              if temp_row_str[left_i] == "+":
                  joiner = "-----"
              else:
                  joiner = " ... "
              new_cdf_str.append(left + joiner + right)
  
          cdf_str = "\n".join(new_cdf_str)
  
      # TODO: vertical limiter
      # if table_height > terminal_height:
      #     half_height = terminal_height // 2
  
      return cdf_str
  
imports: import csv
  import numbers
  from itertools import chain, product
  from shutil import get_terminal_size
  from warnings import warn
  import numpy
  import torch
  from pgmpy import config
  from pgmpy.extern import tabulate
  from pgmpy.factors.discrete import DiscreteFactor
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 7 for calling the TabularCPD obj's underlying member method code with example usage: obj._truncate_strtable(cdf_str) and returns: cdf_str