³ò
ŽB_Kc           @   s	  d  Z  d d k Z d d k Z d d k l Z l Z l Z l Z d d k l	 Z	 d d k
 l Z l Z l Z d d k l Z d d k
 l Z d d k Z d d k Td d k Td	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ  d e! f d „  ƒ  YZ" d e# f d „  ƒ  YZ$ d e% f d „  ƒ  YZ& e' ƒ  e ƒ  e  ƒ  e ƒ  g Z( e' ƒ  e& ƒ  e" ƒ  e ƒ  g Z) e' ƒ  e& ƒ  e$ ƒ  e ƒ  g Z* d e+ f d „  ƒ  YZ, d e, f d „  ƒ  YZ- d e, f d  „  ƒ  YZ. d! e, f d" „  ƒ  YZ/ d# e f d$ „  ƒ  YZ0 e1 d% ƒ d& e2 e2 e d d d' „ ƒ Z4 d( „  Z5 e6 e6 e6 e6 d) e, d* d+ „ Z7 d, „  Z8 e9 d- j og e7 ƒ  He i: i; d. ƒ Z< e, e< d/ d0 ƒZ= d1 Z> e> i? ƒ  Z@ e= iA e@ ƒ ZB x eB D] ZC eC GHqòWn d S(2   s`   
Extension of chart parsing implementation to handle grammars with
feature structures as nodes.
iÿÿÿÿN(   t
   FeatStructt   unifyt   FeatStructParsert   TYPE(   t   logic(   t   Nonterminalt
   Productiont   ContextFreeGrammar(   t   defaultdict(   t   FeatStructNonterminal(   t   *t   FeatureTreeEdgec           B   sS   e  Z d  Z d e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   s  
    A specialized tree edge that allows shared variable bindings
    between nonterminals on the left-hand side and right-hand side.

    Each C{FeatureTreeEdge} contains a set of C{bindings}, i.e., a
    dictionary mapping from variables to values.  If the edge is not
    complete, then these bindings are simply stored.  However, if the
    edge is complete, then the constructor applies these bindings to
    every nonterminal in the edge whose symbol implements the
    interface L{SubstituteBindingsI}.
    i    c         C   s    | d j o
 h  } n | t | ƒ j oP | oI |  i | | ƒ } g  } | D] } | |  i | | ƒ qN ~ } h  } n t i |  | | | | ƒ | |  _ d S(   su  
        Construct a new edge.  If the edge is incomplete (i.e., if
        C{dot<len(rhs)}), then store the bindings as-is.  If the edge
        is complete (i.e., if C{dot==len(rhs)}), then apply the
        bindings to all nonterminals in C{lhs} and C{rhs}, and then
        clear the bindings.  See L{TreeEdge} for a description of
        the other arguments.
        N(   t   Nonet   lent   _bindt   TreeEdget   __init__t	   _bindings(   t   selft   spant   lhst   rhst   dott   bindingst   _[1]t   elt(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   -   s    	-
c         C   s%   t  | t ƒ p | Sn | i | ƒ S(   N(   t
   isinstanceR	   t   substitute_bindings(   R   t   ntR   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   F   s    c         C   s   |  i  |  i ƒ  |  i ƒ S(   N(   R   t   nextR   (   R   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   next_with_bindingsJ   s    c         C   s   |  i  i ƒ  S(   sC   
        Return a copy of this edge's bindings dictionary.
        (   R   t   copy(   R   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   M   s    c         C   se   |  i  ƒ  o t i |  ƒ SnD d d i d „  t |  i i ƒ  ƒ Dƒ ƒ } d t i |  ƒ | f Sd  S(   Ns   {%s}s   , c         s   s   x |  ] } d  | Vq Wd S(   s   %s: %rN(    (   t   .0t   item(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys	   <genexpr>W   s    s   %s %s(   t   is_completeR   t   __str__t   joint   sortedR   t   items(   R   R   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR#   S   s
    c         C   sd   |  i  | i  j o d Sn t |  i |  i |  i |  i |  i f | i | i | i | i | i f ƒ S(   Niÿÿÿÿ(   t	   __class__t   cmpt   _spant   _lhst   _rhst   _dotR   (   R   t   other(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   __cmp__\   s
    c         C   s4   t  |  i |  i |  i |  i t t |  i ƒ ƒ f ƒ S(   N(   t   hashR*   R+   R)   R,   t   tupleR%   R   (   R   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   __hash__c   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   R   R#   R.   R1   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   !   s   						t   FeatureChartc           B   s>   e  Z d  Z d „  Z d „  Z d „  Z d „  Z e d „ Z RS(   sP   
    A Chart for feature grammars.
    @see: L{Chart} for more information.
    c            s   ˆ  h  j o t  ˆ i ƒ Sn ˆ  i ƒ  } | i ƒ  t | ƒ } | ˆ i j o ˆ i | ƒ n t ‡  ‡ f d †  | Dƒ ƒ } t  ˆ i | i | g  ƒ ƒ S(   s¥   
        Returns an iterator over the edges in this chart. 
        See L{Chart.select} for more information about the
        C{restrictions} on the edges.
        c         3   s&   x |  ] } ˆ i  ˆ  | ƒ Vq Wd  S(   N(   t   _get_type_if_possible(   R    t   key(   t   restrictionsR   (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys	   <genexpr>„   s   	(   t   itert   _edgest   keyst   sortR0   t   _indexest
   _add_indext   get(   R   R8   t
   restr_keyst   vals(    (   R8   R   s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   selectr   s    
c            s“   x/ | D]' } t  t | ƒ p t d | ‚ q q Wh  } ˆ  i | <xI ˆ  i D]> ‰ t ‡  ‡ f d †  | Dƒ ƒ } | i | g  ƒ i ˆ ƒ qM Wd S(   sŠ   
        A helper function for L{select}, which creates a new index for
        a given set of attributes (aka restriction keys).
        s   Bad restriction: %sc         3   s.   x' |  ]  } ˆ  i  t ˆ | ƒ ƒ  ƒ Vq Wd  S(   N(   R6   t   getattr(   R    R7   (   R   t   edge(    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys	   <genexpr>—   s   	N(   t   hasattrt   EdgeIt
   ValueErrorR=   R:   R0   t
   setdefaultt   append(   R   R@   R7   t   indexRA   (    (   R   RD   s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR>   ˆ   s     
 c            s\   xU ˆ  i  i ƒ  D]D \ } } t ‡  ‡ f d †  | Dƒ ƒ } | i | g  ƒ i ˆ ƒ q Wd S(   sr   
        A helper function for L{insert}, which registers the new
        edge with all existing indexes.
        c         3   s.   x' |  ]  } ˆ  i  t ˆ | ƒ ƒ  ƒ Vq Wd  S(   N(   R6   RC   (   R    R7   (   R   RD   (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys	   <genexpr>¡   s   	N(   R=   R&   R0   RH   RI   (   R   RD   R@   RJ   RA   (    (   R   RD   s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   _register_with_indexes›   s
     c         C   s1   t  | t ƒ o t | j o | t Sn | Sd S(   s’   
        Helper function which returns the C{TYPE} feature of the C{item}, 
        if it exists, otherwise it returns the C{item} itself
        N(   R   t   dictR   (   R   R!   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR6   ¥   s    c         C   sš   g  } x |  i  d d d |  i ƒ D]p } t | t ƒ oZ | i ƒ  t | t j o? t | i ƒ  | d t ƒo# | |  i | d t d | ƒ7} q" q" W| S(   Nt   starti    t   endt   rename_varst   completet
   tree_class(	   RB   t   _num_leavesR   R   R   R   R   t   Truet   trees(   R   RM   RQ   RT   RD   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   parses¯   s     '(	   R2   R3   R4   RB   R>   RK   R6   t   TreeRU   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR5   l   s   			
	
t   FeatureFundamentalRulec           B   s   e  Z d  Z d „  Z RS(   s±  
    A specialized version of the fundamental rule that operates on
    nonterminals whose symbols are C{FeatStructNonterminal}s.  Rather
    tha simply comparing the nonterminals for equality, they are
    unified.  Variable bindings from these unifications are collected
    and stored in the chart using a L{FeatureTreeEdge}.  When a
    complete edge is generated, these bindings are applied to all
    nonterminals in the edge.

    The fundamental rule states that:
        - [A S{->} S{alpha} * B1 S{beta}][i:j]
        - [B2 S{->} S{gamma} *][j:k]
    licenses the edge:
        - [A S{->} S{alpha} B3 * S{beta}][i:j]
    assuming that B1 and B2 can be unified to generate B3.
    c   
      c   s·  | i  ƒ  | i ƒ  j o' | i ƒ  o | i ƒ  o t | t ƒ p d  Sn t | t ƒ oˆ t | i ƒ  t ƒ o | i ƒ  t | i	 ƒ  t j p d  Sn | i
 ƒ  } t | i ƒ  | i	 ƒ  | d t ƒ} | d  j o d  Sqn. | i ƒ  | i	 ƒ  j p d  Sn | i
 ƒ  } t d | i ƒ  | i  ƒ  f d | i	 ƒ  d | i ƒ  d | i ƒ  d d | ƒ } t } x; | i | ƒ D]* }	 | i | |	 | f ƒ o
 t } ququW| o	 | Vn d  S(   NRO   R   R   R   R   i   R   (   RN   RM   t   is_incompleteR"   R   R   R   R	   R   R   R   R   t   FalseR   R   R   t   child_pointer_listst   insertRS   (
   R   t   chartt   grammart	   left_edget
   right_edgeR   t   resultt   new_edget   changed_chartt   cpl1(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt
   apply_iterÏ   s4    ! (   R2   R3   R4   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRW   ¾   s   t    FeatureSingleEdgeFundamentalRulec           B   s    e  Z d  Z e ƒ  Z d „  Z RS(   sø   
    A specialized version of the completer / single edge fundamental rule 
    that operates on nonterminals whose symbols are C{FeatStructNonterminal}s.  
    Rather than simply comparing the nonterminals for equality, they are
    unified. 
    c         c   sØ   |  i  } | i ƒ  oa x» | i d | i ƒ  d t d | i ƒ  ƒ D]. } x% | i | | | | ƒ D] } | Vq` WqA Wn^ xZ | i d | i ƒ  d t d | i	 ƒ  ƒ D]. } x% | i | | | | ƒ D] } | VqÁ Wq¢ Wd  S(   NRN   R"   R   RM   R   (
   t   _fundamental_ruleR"   RB   RM   RY   R   Rd   RN   RS   R   (   R   R\   R]   RD   t   frR^   Ra   R_   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd   ü   s     	    (   R2   R3   R4   RW   Rf   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRe   ô   s   	t   FeatureTopDownInitRulec           B   s   e  Z d  „  Z RS(   c         c   sJ   t  d ƒ } t d | | i ƒ  f d ƒ } | i | d ƒ o	 | Vn d  S(   Ns   [*type*="[INIT]"]i    (   i    i    (    (   R	   R   RM   R[   (   R   R\   R]   t   rootRD   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd     s    (   R2   R3   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRh     s   t   FeatureTopDownPredictRulec           B   s   e  Z d  Z d „  Z RS(   sÙ  
    A specialized version of the top down predict rule that operates on
    nonterminals whose symbols are C{FeatStructNonterminal}s.  Rather
    tha simply comparing the nonterminals for equality, they are
    unified.

    The top down expand rule states that:
        - [A S{->} S{alpha} * B1 S{beta}][i:j]
    licenses the edge:
        - [B2 S{->} * S{gamma}][j:j]
    for each grammar production C{B2 S{->} S{gamma}}, assuming that B1
    and B2 can be unified.
    c      
   c   s½   | i  ƒ  o d  Sn x¡ | i d | i ƒ  ƒ D]‡ } t | i ƒ  | i ƒ  d t ƒo_ t d | i ƒ  | i ƒ  f d | i ƒ  d | i	 ƒ  d d ƒ } | i
 | d ƒ o	 | Vqµ q. q. Wd  S(   NR   RO   R   R   R   i    (    (   R"   t   productionsR   R   R   R   RS   R   RN   R   R[   (   R   R\   R]   RD   t   prodRa   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd   %  s     "(   R2   R3   R4   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRj     s   t   FeatureBottomUpPredictRulec           B   s   e  Z d  „  Z RS(   c         c   s&  | i  ƒ  o d  Sn | i ƒ  | i ƒ  f } t | t ƒ oˆ xâ | i d | i ƒ  ƒ D]g } | i ƒ  d } t | t ƒ p qV n t | | i ƒ  | i ƒ  ƒ } | i | d ƒ o	 | VqV qV Wn^ xZ | i d | i ƒ  ƒ D]@ } t | | i ƒ  | i ƒ  ƒ } | i | d ƒ o	 | VqÞ qÞ Wd  S(   NR   i    (    (    (	   RX   RM   R   R   Rk   R   R   R	   R[   (   R   R\   R]   RD   t   new_spanRl   R   Ra   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd   7  s      (   R2   R3   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRm   6  s   t!   FeatureBottomUpPredictCombineRulec           B   s   e  Z d  „  Z RS(   c         c   sL  | i  ƒ  o d  Sn t | t ƒ oº x | i d | i ƒ  ƒ D]™ } | i ƒ  d } t | t ƒ p q> n h  } t | | i ƒ  | ƒ oM t | i ƒ  | i ƒ  | i ƒ  d | ƒ } | i	 | | f ƒ o	 | Vq× q> q> Wnj xf | i d | i ƒ  ƒ D]L } t | i ƒ  | i ƒ  | i ƒ  d ƒ } | i	 | | f ƒ o	 | Vqø qø Wd  S(   NR   i    i   (
   RX   R   R   Rk   R   R   R	   R   R   R[   (   R   R\   R]   RD   Rl   R   R   Ra   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd   H  s      * '(   R2   R3   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRo   G  s   t   FeatureEmptyPredictRulec           B   s   e  Z d  „  Z RS(   c      	   c   s‹   x„ | i  d t ƒ D]p } xg t | i ƒ  d ƒ D]O } t d | | f d | i ƒ  d | i ƒ  ƒ } | i | d ƒ o	 | Vq0 q0 Wq Wd  S(   Nt   emptyi   R   R   R   (    (   Rk   RS   t   xranget
   num_leavesR   R   R   R[   (   R   R\   R]   Rl   RJ   Ra   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRd   Z  s      (   R2   R3   Rd   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRp   Y  s   t   FeatureChartParserc           B   s   e  Z e d  e d „ Z RS(   i   c      
   K   s)   t  i |  | d | d | d | | d  S(   Nt   strategyt   trace_chart_widtht   chart_class(   t   ChartParserR   (   R   R]   Ru   Rv   Rw   t   parser_args(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   u  s
    (   R2   R3   t   BU_LC_FEATURE_STRATEGYR5   R   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRt   t  s   t   FeatureTopDownChartParserc           B   s   e  Z d  „  Z RS(   c         K   s   t  i |  | t |  d  S(   N(   Rt   R   t   TD_FEATURE_STRATEGY(   R   R]   Ry   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR     s    (   R2   R3   R   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR{   €  s   t   FeatureBottomUpChartParserc           B   s   e  Z d  „  Z RS(   c         K   s   t  i |  | t |  d  S(   N(   Rt   R   t   BU_FEATURE_STRATEGY(   R   R]   Ry   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   …  s    (   R2   R3   R   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR}   „  s   t$   FeatureBottomUpLeftCornerChartParserc           B   s   e  Z d  „  Z RS(   c         K   s   t  i |  | t |  d  S(   N(   Rt   R   Rz   (   R   R]   Ry   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   ‰  s    (   R2   R3   R   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   ˆ  s   t   InstantiateVarsChartc           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s>  
    A specialized chart that 'instantiates' variables whose names
    start with '@', by replacing them with unique new variables.
    In particular, whenever a complete edge is added to the chart, any
    variables in the edge's C{lhs} whose names start with '@' will be
    replaced by unique new L{Variable}s.
    c         C   s   t  i |  | ƒ d  S(   N(   R5   R   (   R   t   tokens(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR   ™  s    c         C   s   t  ƒ  |  _ t i |  ƒ d  S(   N(   t   sett   _instantiatedR5   t
   initialize(   R   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR„   œ  s    c         C   s8   | |  i  j o t Sn |  i | ƒ t i |  | | ƒ S(   N(   Rƒ   RY   t   instantiate_edgeR5   R[   (   R   RD   t   child_pointer_list(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR[      s    c         C   s   t  | t ƒ p d Sn | i ƒ  p d Sn | |  i j o d Sn |  i | ƒ } | p d Sn |  i i | ƒ | i ƒ  i | ƒ | _	 d S(   sg  
        If the edge is a L{FeatureTreeEdge}, and it is complete, 
        then instantiate all variables whose names start with '@',
        by replacing them with unique new variables.
        
        Note that instantiation is done in-place, since the
        parsing algorithms might already hold a reference to 
        the edge for future use.
        N(
   R   R   R"   t   _edge_to_cplst	   inst_varsRƒ   t   addR   R   R*   (   R   RD   Rˆ   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR…   ¥  s    c         C   s    t  d „  | i ƒ  i ƒ  Dƒ ƒ S(   Nc         s   s<   x5 |  ]. } | i  i d  ƒ o | t i ƒ  f Vq q Wd S(   t   @N(   t   namet
   startswithR   t   unique_variable(   R    t   var(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys	   <genexpr>¿  s   	(   RL   R   t	   variables(   R   RD   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyRˆ   ¾  s    	(   R2   R3   R4   R   R„   R[   R…   Rˆ   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyR€   ‘  s   				s   Use nltk.load_parser() instead.i    c      
   C   s@   t  i i |  d | d | d | d | ƒ} t | d | d | ƒS(   s¾  
    Load a grammar from a file, and build an Earley feature parser based on
    that grammar.

    You can optionally specify a tracing level, for how much output you
    want to see:

    0: No output.
    1: Show edges from scanner and completer rules (not predictor).
    2 (default): Show all edges as they are added to the chart.
    3: Show all edges, plus the results of successful unifications.
    4: Show all edges, plus the results of all attempted unifications.
    5: Show all edges, plus the results of all attempted unifications,
    including those with cached results.

    If C{verbose} is set to C{True}, then more diagnostic information about
    grammar-loading is displayed.
    t   cachet   verboset   logic_parsert   fstruct_parsert   traceRw   (   t   nltkt   datat   loadRt   (   t   filenameR”   R   R‘   Rw   R’   R“   R]   (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   load_earleyÇ  s    	c           C   s   t  i i d ƒ S(   Ns  
S  -> NP VP
PP -> Prep NP
NP -> NP PP
VP -> VP PP
VP -> Verb NP
VP -> Verb
NP -> Det[pl=?x] Noun[pl=?x]
NP -> "John"
NP -> "I"
Det -> "the"
Det -> "my"
Det[-pl] -> "a"
Noun[-pl] -> "dog"
Noun[-pl] -> "cookie"
Verb -> "ate"
Verb -> "saw"
Prep -> "with"
Prep -> "under"
(   R•   R]   t
   parse_fcfg(    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   demo_grammarå  s    	i   s$   I saw John with a dog with my cookiec         C   só   d d  k  } d d  k } Ht ƒ  }	 | o
 |	 GHHn d G| i GH| o d G| GHn | i ƒ  }
 | i ƒ  } | |	 d | ƒ} | i |
 ƒ } | i |	 i ƒ  ƒ } |  o d | i ƒ  | GHn | o x& | D] } | GHqÍ Wn d Gt	 | ƒ GHd  S(   NiÿÿÿÿR
   s	   Sentence:R”   s   Time: %ss	   Nr trees:(
   t   syst   timeR›   R2   t   splitt   clockt   chart_parseRU   RM   R   (   t   should_print_timest   should_print_grammart   should_print_treest   should_print_sentenceR”   t   parsert   sentRœ   R   R]   R   t   tt   cpR\   RT   t   tree(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   demoû  s(    	 c          C   sy   d d  k  }  |  i d d ƒ d d  k } | i d ƒ } | i ƒ  i d d ƒ i d ƒ | i ƒ  i d d ƒ i d ƒ d  S(   Niÿÿÿÿs   for i in range(1): demo()s   /tmp/profile.outR   t   cumi<   (   t   profilet   runt   pstatst   Statst
   strip_dirst
   sort_statst   print_stats(   R¬   R®   t   p(    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pyt   run_profile  s    t   __main__s!   grammars/book_grammars/feat0.fcfgR”   i   s   Kim likes children(D   R4   t   yamlRœ   t   nltk.featstructR    R   R   R   t   nltk.semR   t   nltk.grammarR   R   R   t   nltk.compatR   R	   t	   nltk.dataR•   t   apiR\   R   R   t   ChartR5   t   FundamentalRuleRW   t   SingleEdgeFundamentalRuleRe   t   TopDownInitRuleRh   t   TopDownPredictRuleRj   t   BottomUpPredictRuleRm   t   BottomUpPredictCombineRuleRo   t   EmptyPredictRuleRp   t   LeafInitRuleR|   R~   Rz   Rx   Rt   R{   R}   R   R€   t
   deprecatedRY   R   R™   R›   RS   Rª   R´   R2   R–   R—   R]   R¨   R¦   Rž   R   t   nbest_parseRT   R©   (    (    (    s-   /p/zhu/06/nlp/nltk/nltk/parse/featurechart.pys   <module>   sp   "

KR6	6				 