+
    XPjL  c                   \    R t ^ RIt^ RIHu Ht ^ RItR tR t	R t
R tR tR tR tR	 tR# )
z?SentenceRegrouper: streamed token deltas -> complete sentences.Nc                     . pV F#  pVP                  V P                  V4      4       K%  	  V P                  4       pV'       d   VP                  V4       V# N)extendpushflushappend)	regrouperdeltasoutdtails   &&   J/Users/ahmed/devFolder/Ultron/claude-voice/gateway/tests/test_sentences.py_feedr      sF    
C

9>>!$% ??D

4J    c                     \         P                  ! 4       p \        V . RO4      p. ROq!V8H  q3'       g   \        P                  ! R	V3R
W34      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r2R# )Hello, sir. py0gotpy3assert %(py5)spy5N)r   zHow are you today? 	All good.)zHello, sir.zHow are you today?r   ==z%(py0)s == %(py3)s)brainSentenceRegrouperr   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanationrr   @py_assert2@py_assert1@py_format4@py_format6s         r   #test_splits_on_sentence_punctuationr*      s}    !A
G
HCDDDDDDDD3DDDDDD3DDDD3DDDDDDDDDDDDr   c                     \         P                  ! 4       p V P                  R 4      pR.q!V8H  q3'       g   \        P                  ! RV3RW34      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r2V P                  pRqc! V4      p. qV8H  q'       g   \        P                  ! RV	3RWx34      RR	\
        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R
\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p
RRV
/,          p\        \        P                  ! V4      4      hR;p;p;p;rV P                  q3! 4       pRqV8H  qw'       g   \        P                  ! RV3RWl34      RR	\
        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R
\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p
\        \        P                  ! V
4      4      hR;p;p;r|R# )zRight away, sir. And thenzRight away, sir.r   firstr   r   r   Nz I will do it.r%   py2py4py6py9assert %(py11)spy11zAnd then I will do it.py7zassert %(py9)sr   r   zJ%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.push
}(%(py4)s)
} == %(py9)s)zD%(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.flush
}()
} == %(py7)s)r   r   r   r   r   r   r   r    r!   r"   r#   r   )r%   r,   r&   r'   r(   r)   @py_assert3@py_assert5@py_assert8@py_assert7@py_format10@py_format12@py_assert6@py_format8s                 r   3test_streams_first_sentence_before_the_rest_arrivesr=      s   !AFF./E'((((((((5((((((5((((5((((((((((((66)")6"#)r)r)))))#))))))1))))1)))6)))")))#)))r))))))))77079000000000900000010000100070009000000000000r   c            	         \         P                  ! 4       p RpV P                  V4      pV'       g   \        P                  ! R4      R,           RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MR/,          p\        \        P                  ! V4      4      hR V 4       p\        V4      qU'       g   RRR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRR\        P                  ! V4      R	\        P                  ! V4      /,          p\        \        P                  ! V4      4      hR
;rER
# )zword z1a long punctuation-less run must be force-flushedz
>assert %(py0)sr   r	   c              3   Z   "   T F!  p\        V4      \        P                  8*  x  K#  	  R # 5ir   )lenr   
_MAX_CHUNK).0ss   & r   	<genexpr>Atest_hard_flush_on_runaway_without_punctuation.<locals>.<genexpr>#   s     73as1v)))3s   )+z,assert %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
}allr-   r.   Na,  word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word )r   r   r   r   _format_assertmsgr   r   r    r!   r"   r#   rF   )r%   long_runr	   @py_format1r'   r5   @py_format5s          r   .test_hard_flush_on_runaway_without_punctuationrK      s    !AH
&&
CCCCCCCCCCC3CCCC3CCCCCC73773777777777737777377777777777777r   c                  l   \         P                  ! 4       p V P                  pR q!! V4      pR.qCV8H  qU'       g   \        P                  ! RV3RW434      RR\
        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p;p;p;rTR
# )u   ما اسمك؟ u   ما اسمك؟r   r%   r-   r.   r/   r0   r1   r2   Nr   r4   r   r   r   r   r   r   r   r    r!   r"   r#   r%   r'   r5   r6   r7   r8   r9   r:   s           r   test_arabic_sentence_endrO   &   s    !A66<$<6$%<*;)<<)<<<<<<%<<<<<<1<<<<1<<<6<<<$<<<%<<<)<<<<<<<<<<r   c                  l   \         P                  ! 4       p V P                  pR q!! V4      pR.qCV8H  qU'       g   \        P                  ! RV3RW434      RR\
        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MRR\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p;p;p;rTR
# )zLine one
Line two.zLine oner   r%   r-   r.   r/   r0   r1   r2   Nr   r4   rM   rN   s           r   test_newline_flushesrQ   +   s    !A668'86'(8ZL8L88888(8888881888818886888'888(888L888888888r   c                     \         P                  ! 4       p V P                  R 4      pR.q!V8H  q3'       g   \        P                  ! RV3R	W34      RR\
        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;r2R# )
z[warm] *Well* done, sir. z[warm] Well done, sir.r   r   r   r   r   Nr   r   rM   r$   s         r   "test_emotion_tag_survives_cleaningrS   0   s    !A
&&,
-C+,,,,,,,,3,,,,,,3,,,,3,,,,,,,,,,,,r   c                     \         P                  p R q! V4      pRq2V8H  qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p ;p;p;rC\         P                  p Rq! V4      pRq2V8H  qD'       g   \        P                  ! RV3RW#34      RR\        P
                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p ;p;p;rCR
# )z**bold** and `code`zbold and coder   r   r-   r.   r/   r0   r1   r2   Nz[excited] go!r   )zS%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.clean_for_tts
}(%(py4)s)
} == %(py9)s)
r   clean_for_ttsr   r   r   r   r    r!   r"   r#   )r'   r5   r6   r7   r8   r9   r:   s          r   1test_clean_for_tts_strips_markdown_keeps_bracketsrV   7   sB   H4H45HHHHHHH5HHHHHH5HHHH5HHHHHH4HHH5HHHHHHHHHHHBB/B?B?BBBBB/BBBBBB5BBBB5BBBBBBBBB/BBB?BBBBBBBBBr   )__doc__builtinsr   _pytest.assertion.rewrite	assertionrewriter   r   r   r*   r=   rK   rO   rQ   rS   rV    r   r   <module>r]      s9    E   E18=
9
-Cr   