Next / Previous / Contents / Shipman's homepage

6.23. Txny.__addCollision(): Add one collision

Converts a COLLISION_N node to an entry in self.__collMap.

xnomo3.py
# - - -   T x n y . _ _ a d d C o l l i s i o n   - - -

    def __addCollision ( self, collNode ):
        """Convert a COLLISION_N node to a .__collMap entry.

          [ collNode is a COLLISION_N Element ->
              self.__collMap  +:=  an entry mapping the BAD_ABBR_A
                  attribute of collNode |-> a list of the codes
                  from the content of GOOD_ABBR_N element children
                  of collNode ]
        """

        #-- 1 --
        # [ badAbbr   :=  collNode's BAD_ABBR_A attribute
        #   goodList  :=  GOOD_ABBR_N children of collNode ]
        badAbbr = collNode.attrib[rnc.BAD_ABBR_A]
        goodNodeList = collNode.findall(rnc.GOOD_ABBR_N)

        #-- 2 --
        # [ goodAbbrs  :=  a list of the contents of goodNodeList ]
        goodAbbrs = [ goodNode.text.strip()
                      for goodNode in goodNodeList ]

Standardization of bird codes for use as keys is done by Section 11.6, “fixAbbr(): Standardize a bird code”.

xnomo3.py
        #-- 3 --
        self.__collMap[abbrMod.fixAbbr(badAbbr)] = goodAbbrs