class_docstr: Initialize an instance of UAI reader class
  
  Parameters
  ----------
  path : file or str
      Path of the file containing UAI information.
  
  string : str
      String containing UAI information.
  
  Examples
  --------
  >>> from pgmpy.readwrite import UAIReader
  >>> reader = UAIReader('TestUai.uai')
  >>> model = reader.get_model()
  
  Reference
  ---------
  [1] https://uaicompetition.github.io/uci-2022/file-formats/model-format/
  [2] https://forgemia.inra.fr/thomas.schiex/toulbar2/-/blob/master/doc/UAI08Format.txt
docstr: Returns the grammar of the UAI file.
docstr_tok: ["Returns","the","grammar","of","the","UAI","file","."]
code: def get_grammar(self):
      """
      Returns the grammar of the UAI file.
      """
      network_name = Word(alphas).setResultsName("network_name")
      no_variables = Word(nums).setResultsName("no_variables")
      grammar = network_name + no_variables
      self.no_variables = int(
          grammar.parseString(self.network)["no_variables"]
      )
      domain_variables = (
          Word(nums) * self.no_variables
      ).setResultsName("domain_variables")
      grammar += domain_variables
      no_functions = Word(nums).setResultsName("no_functions")
      grammar += no_functions
      self.no_functions = int(
          grammar.parseString(self.network)["no_functions"]
      )
      integer = Word(nums).setParseAction(lambda t: int(t[0]))
      for function in range(0, self.no_functions):
          scope_grammar = Word(nums).setResultsName(
              "fun_scope_" + str(function)
          )
          grammar += scope_grammar
          function_scope = grammar.parseString(self.network)[
              "fun_scope_" + str(function)
          ]
          function_grammar = (
              (integer) * int(function_scope)
          ).setResultsName("fun_" + str(function))
          grammar += function_grammar
  
      floatnumber = Combine(
          Word(nums) + Optional(Literal(".") + Optional(Word(nums)))
      )
      for function in range(0, self.no_functions):
          no_values_grammar = Word(nums).setResultsName(
              "fun_no_values_" + str(function)
          )
          grammar += no_values_grammar
          no_values = grammar.parseString(self.network)[
              "fun_no_values_" + str(function)
          ]
          values_grammar = (
              (floatnumber) * int(no_values)
          ).setResultsName("fun_values_" + str(function))
          grammar += values_grammar
      return grammar
  
imports: from itertools import combinations
  import numpy
  from pyparsing import Combine, Literal, Optional, Regex, Word, alphas, nums
  from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
  from pgmpy.models import BayesianNetwork, MarkovNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 2 for calling the UAIReader obj's underlying member method code with example usage: obj.get_grammar() and returns: grammar