łň
3ŇÇIc           @   sS   d  d k  l  Z  d   Z d   Z d   Z e d j o e   n d d g Z d S(	   i˙˙˙˙(   t   StringIOc         C   sb   d d k  l } | i t |    i   } g  } | i   D] } | | i | i | i f q< ~ S(   sŞ   
    Read an OLAC XML record and return a list of attributes.

    @param xml: XML string for conversion    
    @type xml: C{string}
    @rtype: C{list} of C{tuple}
    i˙˙˙˙(   t   etree(	   t   lxmlR   t   parseR    t   getroott   getchildrent   tagt   attribt   text(   t   xmlR   t   roott   _[1]t   element(    (    s   /p/zhu/06/nlp/nltk/nltk/olac.pyt	   read_olac   s    c         C   sa   xZ t  |   D]L \ } } } d | d G| o | Gn | o d | d | d f Gn Hq Wd  S(   Ns   %-12st   :s   (%s=%s)t   typet   code(   R   (   R	   R   R   R   (    (    s   /p/zhu/06/nlp/nltk/nltk/olac.pyt   pprint_olac   s     c          C   sN   d d k  l }  d d  k } | i i d  } t |  i   } t |  d  S(   Ni˙˙˙˙(   R   s   corpora/treebank/olac.xml(   R   R   t	   nltk.datat   datat   findt   opent   readR   (   R   t   nltkt   fileR	   (    (    s   /p/zhu/06/nlp/nltk/nltk/olac.pyt   demo!   s
    t   __main__R   R   N(   R    R   R   R   t   __name__t   __all__(    (    (    s   /p/zhu/06/nlp/nltk/nltk/olac.pys   <module>	   s   				