ó Afc@s6ddd„ƒYZd„Zedkr2eƒndS(tMarkovcBs,eZd„Zd„Zd„Zd„ZRS(cCs||_||_i|_dS(N(thistsizetchoicettrans(tselfRR((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt__init__s  cCs |jj|gƒj|ƒdS(N(Rt setdefaulttappend(Rtstatetnext((s+/usr/lib64/python2.7/Demo/scripts/markov.pytadd scCs‹|j}|j}|d|d ƒxFtt|ƒƒD]2}||td||ƒ|!|||d!ƒq6W||t|ƒ|dƒdS(Nii(RR tNonetrangetlentmax(RtseqtnR ti((s+/usr/lib64/python2.7/Demo/scripts/markov.pytput s   0cCsƒ|j}|j}|j}||dƒ}xQtr~|tdt|ƒ|ƒ}||}||ƒ}|sqPn||7}q.W|S(Ni(RRRR tTrueRR (RRRRRtsubseqtoptionsR ((s+/usr/lib64/python2.7/Demo/scripts/markov.pytgets      (t__name__t __module__RR RR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyRs   cCsØddl}ddl}ddl}|jd}y|j|dƒ\}}Wnm|jk r¼d|jdGHdGHdGHdGHd GHd GHd GHd GHd GHdGHdGHdGHdGH|jdƒnXd}t}d}x›|D]“\}} d|koùdknrt|dƒ}n|dkr&t}n|dkr?|d7}n|dkrTd}n|dkrÖt}qÖqÖW|sdg}nt ||j ƒ} yùxò|D]ê} | dkrÐ|j } | j ƒrßdGHq›qßnt | dƒ} |rõdG| GdGHn| jƒ} | jƒ| jdƒ}xh|D]`}|dkr;dGHn|jƒ}|r!|rbt|ƒ}nd j|ƒ}| j|ƒq!q!Wq›WWntk r¢d!GHnX| jsµd"GHdS|rÃd#GHn|dkrIxN| jjƒD]=}|dkst|ƒ|krßt|ƒG| j|GHqßqßW|dkrEtd$ƒG| jd$GHnHnxˆtrÓ| jƒ}|rm|}n |jƒ}d}d%}xF|D]>}|t|ƒ|kr²Hd}n|G|t|ƒd7}qŒWHHqLWdS(&Niÿÿÿÿit0123456789cdwqs"Usage: %s [-#] [-cddqw] [file] ...isOptions:s$-#: 1-digit history size (default 2)s-c: characters (default)s -w: wordss-d: more debugging outputs-q: no debugging outputs3Input files (default stdin) are split in paragraphss1separated blank lines and each paragraph is splits0in words by whitespace, then reconcatenated withs#exactly one space separating words.s0Output consists of paragraphs separated by blanks4lines, where lines are no longer than 72 characters.is-0s-9s-cs-ds-qs-wt-sSorry, need stdin from filetrt processings...s s feeding ...t s-Interrupted -- continue with data read so farsNo valid input filessdone.tiH(tsystrandomtgetopttargvterrortexittFalsetintRRRtstdintisattytopentreadtclosetsplitttupletjoinRtKeyboardInterruptRtkeysR R treprR(RR R!targstoptsRtdo_wordstdebugtotatmtfilenametfttexttparalisttparatwordstdatatkeyRtlimittw((s+/usr/lib64/python2.7/Demo/scripts/markov.pyttest#s®$                           t__main__N((RRCR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyts U