³ò
TKc           @   sk  d  Z  d d k Z d d k 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 „  ƒ  YZ d e f d „  ƒ  YZ	 d e	 e f d „  ƒ  YZ
 d e	 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e e f d „  ƒ  YZ d e e f d „  ƒ  YZ d e e f d „  ƒ  YZ d e
 e f d „  ƒ  YZ d e i f d „  ƒ  YZ d S(   s  
Interfaces and base classes for theorem provers and model builders.

L{Prover} is a standard interface for a theorem prover which tries to prove a goal from a 
list of assumptions.

L{ModelBuilder} is a standard interface for a model builder. Given just a set of assumptions.
the model builder tries to build a model for the assumptions. Given a set of assumptions and a 
goal M{G}, the model builder tries to find a counter-model, in the sense of a model that will satisfy
the assumptions plus the negation of M{G}. 
iÿÿÿÿNt   Proverc           B   s2   e  Z d  Z e e e d „ Z e e e d „ Z RS(   sŸ   
    Interface for trying to prove a goal from assumptions.  Both the goal and 
    the assumptions are constrained to be formulas of L{logic.Expression}.
    c         C   s   |  i  | | | ƒ d S(   s\   
        @return: Whether the proof was successful or not.
        @rtype: C{bool} 
        i    (   t   _prove(   t   selft   goalt   assumptionst   verbose(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   prove   s    c         C   s   t  ƒ  ‚ d S(   s…   
        @return: Whether the proof was successful or not, along with the proof
        @rtype: C{tuple}: (C{bool}, C{str}) 
        N(   t   NotImplementedError(   R   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   $   s    (   t   __name__t
   __module__t   __doc__t   Nonet   FalseR   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR       s   t   ModelBuilderc           B   s2   e  Z d  Z e e e d „ Z e e e d „ Z RS(   sá   
    Interface for trying to build a model of set of formulas.
    Open formulas are assumed to be universally quantified.
    Both the goal and the assumptions are constrained to be formulas 
    of L{logic.Expression}.
    c         C   s   |  i  | | | ƒ d S(   s|   
        Perform the actual model building.
        @return: Whether a model was generated
        @rtype: C{bool} 
        i    (   t   _build_model(   R   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   build_model2   s    c         C   s   t  ƒ  ‚ d S(   sÀ   
        Perform the actual model building.
        @return: Whether a model was generated, and the model itself
        @rtype: C{tuple} of (C{bool}, C{nltk.sem.evaluate.Valuation}) 
        N(   R   (   R   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   :   s    (   R   R	   R
   R   R   R   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   +   s   t   TheoremToolCommandc           B   s>   e  Z d  Z d „  Z e d „ Z d „  Z d „  Z d „  Z RS(   sh   
    This class holds a goal and a list of assumptions to be used in proving
    or model building.
    c         C   s   t  ƒ  ‚ d S(   s¯   
        Add new assumptions to the assumption list.
        
        @param new_assumptions: new assumptions
        @type new_assumptions: C{list} of C{Expression}s
        N(   R   (   R   t   new_assumptions(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   add_assumptionsH   s    c         C   s   t  ƒ  ‚ d S(   sC  
        Retract assumptions from the assumption list.
        
        @param debug: If True, give warning when C{retracted} is not present on 
        assumptions list.
        @type debug: C{bool}
        @param retracted: assumptions to be retracted
        @type retracted: C{list} of L{sem.logic.Expression}s
        N(   R   (   R   t	   retractedt   debug(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   retract_assumptionsQ   s    
c         C   s   t  ƒ  ‚ d S(   si   
        List the current assumptions.
        
        @return: C{list} of C{Expression}       
        N(   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ]   s    c         C   s   t  ƒ  ‚ d S(   sI   
        Return the goal
        
        @return: C{Expression}
        N(   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   e   s    c         C   s   t  ƒ  ‚ d S(   sC   
        Print the list of the current assumptions.       
        N(   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   print_assumptionsm   s    (	   R   R	   R
   R   R   R   R   R   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   C   s   				t   ProverCommandc           B   s/   e  Z d  Z e d „ Z e d „ Z d „  Z RS(   s    
    This class holds a C{Prover}, a goal, and a list of assumptions.  When
    prove() is called, the C{Prover} is executed with the goal and assumptions.
    c         C   s   t  ƒ  ‚ d S(   s+   
        Perform the actual proof.
        N(   R   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   y   s    c         C   s   t  ƒ  ‚ d S(   sy   
        Return the proof string
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        N(   R   (   R   t   simplify(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   proof   s    c         C   s   t  ƒ  ‚ d S(   sE   
        Return the prover object
        @return: C{Prover}
        N(   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt
   get_prover‡   s    (   R   R	   R
   R   R   t   TrueR   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   t   s   t   ModelBuilderCommandc           B   s/   e  Z d  Z e d „ Z e d „ Z d „  Z RS(   s¸   
    This class holds a C{ModelBuilder}, a goal, and a list of assumptions.  
    When build_model() is called, the C{ModelBuilder} is executed with the goal 
    and assumptions.
    c         C   s   t  ƒ  ‚ d S(   s¢   
        Perform the actual model building.
        @return: A model if one is generated; None otherwise.
        @rtype: C{nltk.sem.evaluate.Valuation} 
        N(   R   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   •   s    c         C   s   t  ƒ  ‚ d S(   s–   
        Return a string representation of the model
        
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        N(   R   (   R   t   format(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   model   s    c         C   s   t  ƒ  ‚ d S(   sR   
        Return the model builder object
        @return: C{ModelBuilder}
        N(   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   get_model_builder¦   s    (   R   R	   R
   R   R   R   R   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR      s   	t   BaseTheoremToolCommandc           B   sM   e  Z d  Z e e d „ Z d „  Z e d „ Z d „  Z d „  Z	 d „  Z
 RS(   sh   
    This class holds a goal and a list of assumptions to be used in proving
    or model building.
    c         C   s9   | |  _  | p g  |  _ n t | ƒ |  _ d |  _ d S(   sù   
        @param goal: Input expression to prove
        @type goal: L{logic.Expression}
        @param assumptions: Input expressions to use as assumptions in 
            the proof.
        @type assumptions: C{list} of L{logic.Expression}
        N(   t   _goalt   _assumptionst   listR   t   _result(   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   __init__³   s    		c         C   s   |  i  i | ƒ d |  _ d S(   s¹   
        Add new assumptions to the assumption list.
        
        @param new_assumptions: new assumptions
        @type new_assumptions: C{list} of L{sem.logic.Expression}s
        N(   R"   t   extendR   R$   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   Å   s    c            sm   t  ˆ  ƒ ‰  t ‡  f d †  |  i ƒ } | o) | |  i j o t d ƒ GH|  i ƒ  n | |  _ d |  _ d S(   sC  
        Retract assumptions from the assumption list.
        
        @param debug: If True, give warning when C{retracted} is not present on 
        assumptions list.
        @type debug: C{bool}
        @param retracted: assumptions to be retracted
        @type retracted: C{list} of L{sem.logic.Expression}s
        c            s
   |  ˆ  j S(    (    (   t   a(   R   (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   <lambda>Ú   s    s&   Assumptions list has not been changed:N(   t   sett   filterR"   t   WarningR   R   R$   (   R   R   R   t   result_list(    (   R   s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   Ï   s    
	c         C   s   |  i  S(   si   
        List the current assumptions.
        
        @return: C{list} of C{Expression}       
        (   R"   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ã   s    c         C   s   |  i  S(   sI   
        Return the goal
        
        @return: C{Expression}
        (   R!   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ë   s    c         C   s    x |  i  ƒ  D] } | GHq Wd S(   sC   
        Print the list of the current assumptions.       
        N(   R   (   R   R'   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ó   s     (   R   R	   R
   R   R%   R   R   R   R   R   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR    ®   s   	
		t   BaseProverCommandc           B   sJ   e  Z d  Z e e d „ Z e d „ Z e d „ Z e d „ Z	 d „  Z
 RS(   s    
    This class holds a C{Prover}, a goal, and a list of assumptions.  When
    prove() is called, the C{Prover} is executed with the goal and assumptions.
    c         C   s)   | |  _  t i |  | | ƒ d |  _ d S(   s™   
        @param prover: The theorem tool to execute with the assumptions
        @type prover: C{Prover}
        @see: C{BaseTheoremToolCommand}
        N(   t   _proverR    R%   R   t   _proof(   R   t   proverR   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%      s    	c         C   sK   |  i  t j o4 |  i i |  i ƒ  |  i ƒ  | ƒ \ |  _  |  _ n |  i  S(   sh   
        Perform the actual proof.  Store the result to prevent unnecessary
        re-proving.
        (   R$   R   R.   R   R   R   R/   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR     s
    	c         C   s7   |  i  d j o t d ƒ ‚ n |  i |  i | ƒ Sd S(   sy   
        Return the proof string
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        s.   You have to call prove() first to get a proof!N(   R$   R   t   LookupErrort   decorate_proofR/   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR     s    c         C   s   | S(   s¾   
        Modify and return the proof string
        @param proof_string: C{str} the proof to decorate
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        (    (   R   t   proof_stringR   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR2   #  s    c         C   s   |  i  S(   N(   R.   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ,  s    (   R   R	   R
   R   R%   R   R   R   R   R2   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR-   û   s   	t   BaseModelBuilderCommandc           B   sJ   e  Z d  Z e e d „ Z e d „ Z e d „ Z e d „ Z d „  Z	 RS(   s·   
    This class holds a C{ModelBuilder}, a goal, and a list of assumptions.  When
    build_model() is called, the C{ModelBuilder} is executed with the goal and 
    assumptions.
    c         C   s)   | |  _  t i |  | | ƒ d |  _ d S(   s«   
        @param modelbuilder: The theorem tool to execute with the assumptions
        @type modelbuilder: C{ModelBuilder}
        @see: C{BaseTheoremToolCommand}
        N(   t   _modelbuilderR    R%   R   t   _model(   R   t   modelbuilderR   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   6  s    	c         C   sK   |  i  t j o4 |  i i |  i ƒ  |  i ƒ  | ƒ \ |  _  |  _ n |  i  S(   si   
        Attempt to build a model.  Store the result to prevent unnecessary
        re-building.
        (   R$   R   R5   R   R   R   R6   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   C  s
    	c         C   s7   |  i  d j o t d ƒ ‚ n |  i |  i | ƒ Sd S(   s–   
        Return a string representation of the model
        
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        s4   You have to call build_model() first to get a model!N(   R$   R   R1   t   _decorate_modelR6   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   O  s    c         C   s   | S(   sª   
        @param valuation_str: C{str} with the model builder's output 
        @param format: C{str} indicating the format for displaying
        @return: C{str}
        (    (   R   t   valuation_strR   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR8   \  s    c         C   s   |  i  S(   N(   R5   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   d  s    (
   R   R	   R
   R   R%   R   R   R   R8   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR4   0  s   t   TheoremToolCommandDecoratorc           B   sG   e  Z d  Z d „  Z d „  Z d „  Z d „  Z e d „ Z d „  Z	 RS(   s   
    A base decorator for the C{ProverCommandDecorator} and 
    C{ModelBuilderCommandDecorator} classes from which decorators can extend.
    c         C   s   | |  _  d |  _ d S(   sC   
        @param command: C{TheoremToolCommand} to decorate
        N(   t   _commandR   R$   (   R   t   command(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   m  s    	c         C   s   |  i  i ƒ  S(   N(   R;   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   w  s    c         C   s   |  i  i ƒ  S(   N(   R;   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   z  s    c         C   s   |  i  i | ƒ d  |  _ d  S(   N(   R;   R   R   R$   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   }  s    c         C   s    |  i  i | | ƒ d  |  _ d  S(   N(   R;   R   R   R$   (   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR     s    c         C   s   |  i  i ƒ  d  S(   N(   R;   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   …  s    (
   R   R	   R
   R%   R   R   R   R   R   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR:   h  s   	
			t   ProverCommandDecoratorc           B   sD   e  Z d  Z d „  Z e d „ Z e d „ Z e d „ Z d „  Z	 RS(   su   
    A base decorator for the C{ProverCommand} class from which other 
    prover command decorators can extend.
    c         C   s   t  i |  | ƒ d |  _ d S(   sD   
        @param proverCommand: C{ProverCommand} to decorate
        N(   R:   R%   R   R/   (   R   t   proverCommand(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   Ž  s    c         C   sT   |  i  d  j o= |  i ƒ  } | i |  i ƒ  |  i ƒ  | ƒ \ |  _  |  _ n |  i  S(   N(   R$   R   R   R   R   R   R/   (   R   R   R0   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ˜  s    	c         C   s7   |  i  d j o t d ƒ ‚ n |  i |  i | ƒ Sd S(   sy   
        Return the proof string
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        s.   You have to call prove() first to get a proof!N(   R$   R   R1   R2   R/   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR      s    c         C   s   |  i  i | | ƒ S(   s¾   
        Modify and return the proof string
        @param proof_string: C{str} the proof to decorate
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        (   R;   R2   (   R   R3   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR2   «  s    c         C   s   |  i  i ƒ  S(   N(   R;   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ´  s    (
   R   R	   R
   R%   R   R   R   R   R2   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR=   ‰  s   	
	t   ModelBuilderCommandDecoratorc           B   sD   e  Z d  Z d „  Z e d „ Z e d „ Z e d „ Z d „  Z	 RS(   s{   
    A base decorator for the C{ModelBuilderCommand} class from which other 
    prover command decorators can extend.
    c         C   s   t  i |  | ƒ d |  _ d S(   sP   
        @param modelBuilderCommand: C{ModelBuilderCommand} to decorate
        N(   R:   R%   R   R6   (   R   t   modelBuilderCommand(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   ½  s    c         C   sT   |  i  t j o= |  i ƒ  } | i |  i ƒ  |  i ƒ  | ƒ \ |  _  |  _ n |  i  S(   si   
        Attempt to build a model.  Store the result to prevent unnecessary
        re-building.
        (   R$   R   R   R   R   R   R6   (   R   R   R7   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   Ç  s    	c         C   s7   |  i  d j o t d ƒ ‚ n |  i |  i | ƒ Sd S(   s–   
        Return a string representation of the model
        
        @param simplify: C{boolean} simplify the proof?
        @return: C{str}
        s4   You have to call build_model() first to get a model!N(   R$   R   R1   R8   R6   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   Ô  s    c         C   s   |  i  i | | ƒ S(   sÕ   
        Modify and return the proof string
        @param valuation_str: C{str} with the model builder's output 
        @param format: C{str} indicating the format for displaying
        @return: C{str}
        (   R;   R8   (   R   R9   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR8   á  s    c         C   s   |  i  i ƒ  S(   N(   R;   R   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ê  s    (
   R   R	   R
   R%   R   R   R   R   R8   R   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR?   ¸  s   	
	t   ParallelProverBuilderc           B   sD   e  Z d  Z d „  Z e e e d „ Z e e e d „ Z d „  Z RS(   s  
    This class stores both a prover and a model builder and when either 
    prove() or build_model() is called, then both theorem tools are run in
    parallel.  Whichever finishes first, the prover or the model builder, is the
    result that will be used.
    c         C   s   | |  _  | |  _ d  S(   N(   R.   R5   (   R   R0   R7   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   õ  s    	c         C   s   |  i  | | | ƒ d f S(   Nt    (   t   _run(   R   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ù  s    c         C   s   |  i  | | | ƒ d f S(   NRB   (   RC   (   R   R   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   ü  s    c            s½   t  ‡ ‡ ‡  ‡ f d †  ˆ d ƒ } t  ‡ ‡ ‡  ‡ f d †  ˆ d ƒ } | i ƒ  | i ƒ  x | i ƒ  o | i ƒ  o q_ W| i d  j	 o | i Sn! | i d  j	 o | i Sn d  Sd  S(   Nc              s   ˆ  i  i ˆ ˆ ˆ ƒ S(    (   R.   R   (    (   R   R   R   R   (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR(     s    t   TPc              s   ˆ  i  i ˆ ˆ ˆ ƒ S(    (   R5   R   (    (   R   R   R   R   (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR(     s    t   MB(   t   TheoremToolThreadt   startt   isAlivet   resultR   (   R   R   R   R   t	   tp_threadt	   mb_thread(    (   R   R   R   R   s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyRC   ÿ  s    $$

(	   R   R	   R
   R%   R   R   R   R   RC   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyRA   î  s
   	t   ParallelProverBuilderCommandc           B   s>   e  Z d  Z e e d „ Z e d „ Z e d „ Z d „  Z RS(   sª  
    This command stores both a prover and a model builder and when either 
    prove() or build_model() is called, then both theorem tools are run in
    parallel.  Whichever finishes first, the prover or the model builder, is the
    result that will be used.
    
    Because the theorem prover result is the opposite of the model builder
    result, we will treat self._result as meaning "proof found/no model found".
    c         C   s0   t  i |  | | | ƒ t i |  | | | ƒ d  S(   N(   R-   R%   R4   (   R   R0   R7   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%     s    c         C   s   |  i  | ƒ S(   N(   RC   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR      s    c         C   s   |  i  | ƒ S(   N(   RC   (   R   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR   #  s    c            sº   t  ‡ ‡  f d †  ˆ  d ƒ } t  ‡ ‡  f d †  ˆ  d ƒ } | i ƒ  | i ƒ  x | i ƒ  o | i ƒ  o qS W| i d  j	 o | i ˆ _ n" | i d  j	 o | i ˆ _ n ˆ i S(   Nc              s   t  i ˆ  ˆ ƒ S(    (   R-   R   (    (   R   R   (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR(   (  s    RD   c              s   t  i ˆ  ˆ ƒ S(    (   R4   R   (    (   R   R   (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR(   )  s    RE   (   RF   RG   RH   RI   R   R$   (   R   R   RJ   RK   (    (   R   R   s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyRC   &  s    

(	   R   R	   R
   R   R%   R   R   R   RC   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyRL     s
   	RF   c           B   s,   e  Z e d  „ Z d „  Z e d „  ƒ Z RS(   c         C   s8   t  i i |  ƒ | |  _ d  |  _ | |  _ | |  _ d  S(   N(   t	   threadingt   ThreadR%   R;   R   R$   t   _verboset   _name(   R   R<   R   t   name(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR%   :  s
    			c         C   su   yH |  i  ƒ  |  _ |  i o+ d |  i |  i t i t i ƒ  ƒ f GHn Wn& t j
 o } | GHd |  i GHn Xd  S(   Ns'   Thread %s finished with result %s at %ss   Thread %s completed abnormally(   R;   R$   RO   RP   t   timet	   localtimet	   Exception(   R   t   e(    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyt   runA  s    
,c         C   s   |  i  S(    (   R$   (   R   (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyR(   K  s    (   R   R	   R   R%   RV   t   propertyRI   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pyRF   9  s   	
(   R
   RM   RR   t   objectR    R   R   R   R   R    R-   R4   R:   R=   R?   RA   RL   RN   RF   (    (    (    s(   /p/zhu/06/nlp/nltk/nltk/inference/api.pys   <module>   s    1M58!/6$'