403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/orca/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/orca//espeechfactory.pyo
z#Jc	@sdZdZdZdZdZdZdZdgZdd	kZdd	k	Z	dd	k
Z
dd	kZdd	kZdd
k
lZdeifdYZd
Zhdd6dd6dd6dd6ZdZedjoend	S(suPython wrapper for Emacspeak speech servers.

The emacspeak TTS server provides a simple but powerful and
well-tested speech-server abstraction. That server is implemented
as an external program (typically in TCL).  This wrapper class
provides Python access to available Emacspeak speech servers.

Initially, this class will provide Python access to the TTS
server commands.  Over time, this module may also implement
functionality present in Emacspeak's Lisp layer ---specifically,
higher level TTS functionality provided by the following
emacspeak modules:

0)  dtk-speak.el

1)  emacspeak-pronounce.el

2)  accs-structure.el

s$Id$sT. V. Ramans
$Revision$s$Date$s#Copyright (c) 2005-2008 Google Inc.tLGPLtSpeakeriN(t_tSpeechServercBseZdZdZhdd6dd6dd6dd6d	d
6ZhZdZdZeeZd
Z	ee	Z	ddgdZ
ee
Z
dZeeZddedZdZ
dZdZdZdZdd1dZdddZddZd1dZd1edZdd1ed Zd!d"Zd!d#Zd$d%Zd$d&Zd'Zd(Zd1d1d)Z d*Z!d+Z"d,Z#d-Z$d.Z%d/Z&d0Z'RS(2sProvides speech server abstraction.

    Class Variables:

        location -- specifies directory where Emacspeak
        speech servers are installed.

        config --  dictionary of default settings.

    Speaker objects can be initialized with the following parameters:

        engine -- TTS server to instantiate. Default: outloud
        host -- Host that runs   server. Default: localhost
        settings -- Dictionary of default settings.

    s,/usr/share/emacs/site-lisp/emacspeak/serversit	splitcapsiFtrateit
capitalizetallcapstalltpunctuationss8.{0,120}?[
,.;:!?)][]}"]?\s+|.{1,120}(?:\Z|\s+)|.{1,120}cCs
tdS(s1Returns a localized name describing this factory.sEmacspeak Speech Services(R(((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytgetFactoryNamebscCs6t}ttiitid}x|D]}|i}|djp|ddjoq+n|tijo;yt|ti|<t	}Wqt
it
iqXq+q+W|i
|oddkl}|dnxFtiiD]5}|ip|iidj	o|iqqWtiiS(	sGets available speech servers as a list.  The caller
        is responsible for calling the shutdown() method of each
        speech server returned.
        s.serverstit#i(tsleepiN(tFalsetfiletostpathtjoinRtlocationtstript_SpeechServer__activeServerstTruetdebugtprintExceptiont
LEVEL_WARNINGtclosettimeR
tvaluestprocesstpolltNonetshutdown(thaveNewServerstserversConftnameR
tserver((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytgetSpeechServersls,

!toutloudcCsX|dtijoti|dSyt|dSWntitinXdSdS(siGets a given SpeechServer based upon the info.
        See SpeechServer.getInfo() for more info.
        iN(RRRRtLEVEL_SEVERER(tinfo((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytgetSpeechServerscCs(x!tiiD]}|iqWdS(s/Cleans up and shuts down this factory.
        N(RRRR (R$((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytshutdownActiveServersst	localhostcCstii|||_d
|_d
|_tt|t	t
dg}|i|_|i|_|i
|_
|i|_|djo"tiiti|i|_n#tiitid|i|_ddkl}l}||idtd|d|d	|}|ii|iid
|_|_|i|_||_ti|iti |_!h|_"|o$|i"i#||i$|i"nd
S(sLaunches speech engine.RR+sssh-%si(tPopentPIPEt	close_fdststdintstdouttstderrN(%tspeechserverRt__init__t_engineRt_outputRt
__import__t	_getcodestglobalstlocalstgetvoicetgetratetgetvoicelisttmakeSpecialCharMapt
_specialCharsRRRRt_servert
subprocessR,R-RR0RR1R/tretcompilet_speechChunkRegexptDOTALLt_speechChunkt	_settingstupdatet	configure(tselftenginethosttinitialteR,R-tproc((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyR3s:			
"

		cCs\xU|iD]G}t||o1tt||ot||||q
q
WdS(sConfigure engine with settings.N(tkeysthasattrtcallabletgetattr(RItengineSettingstk((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyRHs
&cCs|iS(N(RF(RI((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytsettingsscCs|i|igS(s'Returns [driverName, serverId]
        (R4(RI((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytgetInfoscCshg}yDx=|iD]/}h|tii6}|iti|qWWntitinX|S(sReturns a list of speechserver.VoiceFamily instances
        representing all the voice families known by the speech server.
        (R<R2tVoiceFamilytNAMEtappendRRR'(RItfamiliestvoicetprops((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytgetVoiceFamiliess
cCs0x)|iD]\}}|i||}q
W|S(soReplaces all special characters in text by their replacements
        according to self._specialChars.
        (R>treplace(RIttexttcharR#((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt_quoteSpecialCharss
RcCstipdSd}|oIy+|i|}d|d|df}WqetitiqeXnxAd|ii|DD]#}|ii	||i
|qWdS(sAdds the text to the queue.

        Arguments:
        - text: text to be spoken
        - acss: acss.ACSS instance; if None,
                the default voice settings will be used.
                Otherwise, the acss settings will be
                used to augment/override the default
                voice settings.

        Output is produced by the next call to speak.
        Ns	q { %s }
sq {%s %%s %s}
iicssx|]}|iVqWdS(N(tgroup(t.0tt((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pys	<genexpr>s	(RUtenableSpeechR:RRRREtfinditerR5twriteRa(RIR_tacsstcmdtcodetchunk((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt	queueTexts
ii2cCs|iid||fdS(sYAdds a tone to the queue.

        Output is produced by the next call to speak.
        s	t %s %s
 N(R5Rg(RItpitchtduration((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt	queueTonescCs|iid|dS(sZAdds silence to the queue.

        Output is produced by the next call to speak.
        ssh  %sN(R5Rg(RIRn((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytqueueSilencescCsE|djo|i|}n|iid||iidS(ssSpeaks a single character immediately.

        Arguments:
        - character: text to be spoken
        - acss:      acss.ACSS instance; if None,
                     the default voice settings will be used.
                     Otherwise, the acss settings will be
                     used to augment/override the default
                     voice settings.
        s{\}sl {%s}
N(RaR5Rgtflush(RIt	characterRh((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytspeakCharacter s
cCsHx$|D]}|it||qW|iid|iidS(sSpeaks the given list of utterances immediately.

        Arguments:
        - utteranceList: list of strings to be spoken
        - acss:      acss.ACSS instance; if None,
                     the default voice settings will be used.
                     Otherwise, the acss settings will be
                     used to augment/override the default
                     voice settings.
        - interrupt: if True, stop any speech currently in progress.
        sd
N(RltstrR5RgRq(RIt
utteranceListRht	interrupttutt((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytspeakUtterances0s
cCs@tipdS|i|||iid|iidS(sASpeaks all queued text immediately.  If text is not None,
        it is added to the queue before speaking.

        Arguments:
        - text:      optional text to add to the queue before speaking
        - acss:      acss.ACSS instance; if None,
                     the default voice settings will be used.
                     Otherwise, the acss settings will be
                     used to augment/override the default
                     voice settings.
        - interrupt: if True, stops any speech in progress before
                     speaking the text
        Nsd
(RUReRlR5RgRq(RIR_RhRv((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytspeakAs

g?cCs|idc|7<dS(sIncreases the speech pitch.s
average-pitchN(RF(RItstep((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytincreaseSpeechPitchYscCs|idc|8<dS(sDecreases the speech pitch.s
average-pitchN(RF(RIRz((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytdecreaseSpeechPitch]sicCsH|idc|7<|iid|i|id|iidS(s#Increases the speech rate.
        Rstts_set_speech_rate %s
N(RFR5RgR;Rq(RIRz((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytincreaseSpeechRateascCsH|idc|8<|iid|i|id|iidS(s#Decreases the speech rate.
        Rstts_set_speech_rate %s
N(RFR5RgR;Rq(RIRz((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytdecreaseSpeechRateiscCs!|iid|iidS(s+Stops ongoing speech and flushes the queue.ss
N(R5RgRq(RI((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytstopqscCs|idjodS|iidjo7ddkl}ti|ii||iin|i	i
d|_	|_|tii
|idjoti|i=ndS(sShuts down the speech engine.Ni(tSIGKILL(RRRtsignalRRtkilltpidtwaitR5RRRtgetR4(RIR((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyR vs
cCs!|iid|iidS(sResets the speech engine.s
tts_reset
N(R5RgRq(RIR_Rh((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytresetscCs|iiddS(sSpeak TTS version info.sversion
N(R5Rg(RI((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pytversionscCsC|djo2||id<|iid||iindS(sSet punctuation mode.RtsometnoneR	stts_set_punctuations %s
N(sallRR(RFR5RgRq(RItmode((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyR	s

cCs;||id<|iid|i||iidS(sSet speech rate.Rstts_set_speech_rate %s
N(RFR5RgR;Rq(RItr((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyRs
cCsLt|odpd}||id<|iid||iidS(s,Set splitcaps mode. 1  turns on, 0 turns offiiRstts_split_caps %s
N(tboolRFR5RgRq(RItflag((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyRs
cCsLt|odpd}||id<|iid||iidS(s2Set capitalization  mode. 1  turns on, 0 turns offiiRstts_capitalize %s
N(RRFR5RgRq(RIR((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyRs
cCsLt|odpd}||id<|iid||iidS(s+Set allcaps  mode. 1  turns on, 0 turns offiiRstts_allcaps_beep %s
N(RRFR5RgRq(RIR((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyRs
cCs|idS(sShuts down the speech engine.N(R (RI((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt__del__sN((t__name__t
__module__t__doc__RtconfigRRCR
tstaticmethodR%R)R*R3RHRURVR]RaRRlRoRpRsRRxRyR{R|R}R~RR RRR	RRRRR(((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyR:sZ

		
	(													cCs)|tjotd|nt|S(sJHelper function that fetches synthesizer codes for a
    specified engine.sNo code table for %s(t
_codeTablet	Exception(RJ((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyR7s
tdectalksdtk-expsdtk-mvsdtk-softR&cCsddk}ddk}t}|i}|id|id|idxvdddd	gD]b}x>td
ddD]*}|||<|id
||f|qW||=|id||qgW|idGH|id|i	dS(s
Self test.iNRsThis is an initial test.s(Next, we'll test audio formatted output.s
average-pitchspitch-rangetrichnesststressii
isSet %s to %i. s	Reset %s.s/sleeping  while waiting for speech to complete.i((
RRhRtACSSR	RltrangeRyR
R (RRhtstatdti((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt_tests(	


	



t__main__(Rt__id__t
__author__t__version__t__date__t
__copyright__t__license__t__all__RRARRUR2t	orca_i18nRRR7RRR(((s7/usr/lib/python2.6/site-packages/orca/espeechfactory.pyt<module>'s0	z	
	


Youez - 2016 - github.com/yon3zu
LinuXploit