class_docstr: A dictionary which represents an assignment of values to variables.
  
  An assignment can only assign values from its domain.
  
  If an unknown expression *a* is passed to a model *M*\ 's
  interpretation function *i*, *i* will first check whether *M*\ 's
  valuation assigns an interpretation to *a* as a constant, and if
  this fails, *i* will delegate the interpretation of *a* to
  *g*. *g* only assigns values to individual variables (i.e.,
  members of the class ``IndividualVariableExpression`` in the ``logic``
  module. If a variable is not assigned a value by *g*, it will raise
  an ``Undefined`` exception.
  
  A variable *Assignment* is a mapping from individual variables to
  entities in the domain. Individual variables are usually indicated
  with the letters ``'x'``, ``'y'``, ``'w'`` and ``'z'``, optionally
  followed by an integer (e.g., ``'x0'``, ``'y332'``).  Assignments are
  created using the ``Assignment`` constructor, which also takes the
  domain as a parameter.
  
      >>> from nltk.sem.evaluate import Assignment
      >>> dom = set(['u1', 'u2', 'u3', 'u4'])
      >>> g3 = Assignment(dom, [('x', 'u1'), ('y', 'u2')])
      >>> g3 == {'x': 'u1', 'y': 'u2'}
      True
  
  There is also a ``print`` format for assignments which uses a notation
  closer to that in logic textbooks:
  
      >>> print(g3)
      g[u1/x][u2/y]
  
  It is also possible to update an assignment using the ``add`` method:
  
      >>> dom = set(['u1', 'u2', 'u3', 'u4'])
      >>> g4 = Assignment(dom)
      >>> g4.add('x', 'u1')
      {'x': 'u1'}
  
  With no arguments, ``purge()`` is equivalent to ``clear()`` on a dictionary:
  
      >>> g4.purge()
      >>> g4
      {}
  
  :param domain: the domain of discourse
  :type domain: set
  :param assign: a list of (varname, value) associations
  :type assign: list
class_docstr_tok: ["A","dictionary","which","represents","an","assignment","of","values","to","variables",".","An","assignment","can","only","assign","values","from","its","domain",".","If","an","unknown","expression","*","a","*","is","passed","to","a","model","*","M","*","\\","'s","interpretation","function","*","i","*",",","*","i","*","will","first","check","whether","*","M","*","\\","'s","valuation","assigns","an","interpretation","to","*","a","*","as","a","constant",",","and","if","this","fails",",","*","i","*","will","delegate","the","interpretation","of","*","a","*","to","*","g","*",".","*","g","*","only","assigns","values","to","individual","variables","(","i.e.",",","members","of","the","class","``","IndividualVariableExpression","``","in","the","``","logic","``","module",".","If","a","variable","is","not","assigned","a","value","by","*","g","*",",","it","will","raise","an","``","Undefined","``","exception",".","A","variable","*","Assignment","*","is","a","mapping","from","individual","variables","to","entities","in","the","domain",".","Individual","variables","are","usually","indicated","with","the","letters","``","'","x","'","``",",","``","'","y","'","``",",","``","'","w","'","``","and","``","'","z","'","``",",","optionally","followed","by","an","integer","(","e.g.",",","``","'x0","'","``",",","``","'y332","'","``",")",".","Assignments","are","created","using","the","``","Assignment","``","constructor",",","which","also","takes","the","domain","as","a","parameter",".",">",">",">","from","nltk.sem.evaluate","import","Assignment",">",">",">","dom","=","set","(","[","'u1","'",",","'u2","'",",","'u3","'",",","'u4","'","]",")",">",">",">","g3","=","Assignment","(","dom",",","[","(","'","x","'",",","'u1","'",")",",","(","'","y","'",",","'u2","'",")","]",")",">",">",">","g3","==","{","'","x","'",":","'u1","'",",","'","y","'",":","'u2","'","}","True","There","is","also","a","``","print","``","format","for","assignments","which","uses","a","notation","closer","to","that","in","logic","textbooks",":",">",">",">","print","(","g3",")","g","[","u1\/x","]","[","u2\/y","]","It","is","also","possible","to","update","an","assignment","using","the","``","add","``","method",":",">",">",">","dom","=","set","(","[","'u1","'",",","'u2","'",",","'u3","'",",","'u4","'","]",")",">",">",">","g4","=","Assignment","(","dom",")",">",">",">","g4.add","(","'","x","'",",","'u1","'",")","{","'","x","'",":","'u1","'","}","With","no","arguments",",","``","purge","(",")","``","is","equivalent","to","``","clear","(",")","``","on","a","dictionary",":",">",">",">","g4.purge","(",")",">",">",">","g4","{","}",":","param","domain",":","the","domain","of","discourse",":","type","domain",":","set",":","param","assign",":","a","list","of","(","varname",",","value",")","associations",":","type","assign",":","list"]
code: def __getitem__(self, key):
      if key in self:
          return dict.__getitem__(self, key)
      else:
          raise Undefined("Not recognized as a variable: '%s'" % key)
  
imports: import inspect
  import re
  import sys
  import textwrap
  from pprint import pformat
  from nltk.decorators import decorator
  from nltk.sem.logic import AbstractVariableExpression, AllExpression, AndExpression, ApplicationExpression, EqualityExpression, ExistsExpression, Expression, IffExpression, ImpExpression, IndividualVariableExpression, IotaExpression, LambdaExpression, NegatedExpression, OrExpression, Variable, is_indvar
label_desc: Use image node_id 2 for calling the Assignment obj's underlying member method code with example usage: obj.__getitem__(key) and returns: dict