AlkantarClanX12
Current Path : /proc/thread-self/root/lib64/python2.7/Demo/scripts/ |
Current File : //proc/thread-self/root/lib64/python2.7/Demo/scripts/markov.pyc |
� Afc @ s6 d d d � � YZ d � Z e d k r2 e � n d S( t Markovc B s, e Z d � Z d � Z d � Z d � Z RS( c C s | | _ | | _ i | _ d S( N( t histsizet choicet trans( t selfR R ( ( s+ /usr/lib64/python2.7/Demo/scripts/markov.pyt __init__ s c C s | j j | g � j | � d S( N( R t setdefaultt append( R t statet next( ( s+ /usr/lib64/python2.7/Demo/scripts/markov.pyt add s c C s� | j } | j } | d | d � xF t t | � � D]2 } | | t d | | � | !| | | d !� q6 W| | t | � | d � d S( Ni i ( R R t Nonet ranget lent max( R t seqt nR t i( ( s+ /usr/lib64/python2.7/Demo/scripts/markov.pyt put s 0c C s� | j } | j } | j } | | d � } xQ t r~ | t d t | � | � } | | } | | � } | sq Pn | | 7} q. W| S( Ni ( R R R R t TrueR R ( R R R R R t subseqt optionsR ( ( s+ /usr/lib64/python2.7/Demo/scripts/markov.pyt get s ( t __name__t __module__R R R R ( ( ( s+ /usr/lib64/python2.7/Demo/scripts/markov.pyR s c C s� d d l } d d l } d d l } | j d } y | j | d � \ } } Wnm | j k r� d | j d GHd GHd GHd GHd GHd GHd GHd GHd GHd GHd GHd GHd GH| j d � n Xd } t } d } x� | D]� \ } } d | k o� d k n rt | d � } n | d k r&t } n | d k r?| d 7} n | d k rTd } n | d k r� t } q� q� W| sd g } n t | | j � } y� x� | D]� } | d k r�| j } | j � r�d GHq�q�n t | d � } | r�d G| Gd GHn | j � } | j � | j d � } xh | D]` } | d k r;d GHn | j � } | r!| rbt | � } n d j | � } | j | � q!q!Wq�WWn t k r�d! GHn X| j s�d"