Exemplo n.º 1
0
	def processText(self,text):
		#this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
		text = text.encode(self.currentEncoding, 'replace') # special unicode symbols may encode to backquote. For this reason, backquote processing is after this.
		text = text.rstrip()
		if _ibmeci.params[9] in (65536, 65537, 393216, 655360, 720897): text = resub(english_fixes, text) #Applies to all languages with dual language support.
		if _ibmeci.params[9] in (65536, 65537, 393216, 655360, 720897) and _ibmeci.isIBM: text = resub(english_ibm_fixes, text)
		if _ibmeci.params[9] in (131072,  131073) and not _ibmeci.isIBM: text = resub(spanish_fixes, text)
		if _ibmeci.params[9] in ('esp', 131072) and _ibmeci.isIBM: text = resub(spanish_ibm_fixes, text)
		if _ibmeci.params[9] in (196609, 196608):
			text = text.replace(br'quil', br'qil') #Sometimes this string make everything buggy with IBMTTS in French
		if  _ibmeci.params[9] in ('deu', 262144):
			text = resub(german_fixes, text)
		if  _ibmeci.params[9] in ('ptb', 458752) and _ibmeci.isIBM:
			text = resub(portuguese_ibm_fixes, text)
		if not self._backquoteVoiceTags:
			text=text.replace(b'`', b' ') # no embedded commands
		if self._shortpause:
			text = pause_re.sub(br'\1 `p1\2\3\4', text) # this enforces short, JAWS-like pauses.
		if not _ibmeci.isIBM:
			text = time_re.sub(br'\1:\2 \3', text) # apparently if this isn't done strings like 2:30:15 will only announce 2:30
		embeds=b''
		if self._ABRDICT:
			embeds+=b"`da1 "
		else:
			embeds+=b"`da0 "
		if self._phrasePrediction:
			embeds+=b"`pp1 "
		else:
			embeds+=b"`pp0 "
		if self._sendParams:
			embeds+=b"`vv%d `vs%d " % (_ibmeci.getVParam(ECIVoiceParam.eciVolume), _ibmeci.getVParam(ECIVoiceParam.eciSpeed))
		text = b"%s %s" % (embeds.rstrip(), text) # bring all the printf stuff into one call, in one string. This avoids all the concatonation and printf additions of the previous organization.
		return text
Exemplo n.º 2
0
 def processText(self, text):
     text = text.rstrip()
     if _ibmeci.params[9] in (65536, 65537):
         text = resub(english_fixes, text)
     if _ibmeci.params[9] in (131072, 131073):
         text = resub(spanish_fixes, text)
     if _ibmeci.params[9] in (196609, 196608):
         text = resub(french_fixes, text)
         text = text.replace(
             'quil', 'qil'
         )  #Sometimes this string make everything buggy with IBMTTS in French
     if self._backquoteVoiceTags:
         #this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
         text = text.replace('`',
                             ' ').encode('mbcs',
                                         'replace')  #no embedded commands
         text = b"`pp0 `vv%d %s" % (_ibmeci.getVParam(
             ECIVoiceParam.eciVolume), text)
         text = resub(anticrash_res, text)
     else:
         #this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
         text = text.encode('mbcs', 'replace')
         text = resub(anticrash_res, text)
         text = b"`pp0 `vv%d %s" % (_ibmeci.getVParam(
             ECIVoiceParam.eciVolume), text.replace(b'`', b' ')
                                    )  #no embedded commands
     text = pause_re.sub(br'\1 `p1\2\3', text)
     text = time_re.sub(br'\1:\2 \3', text)
     return text
Exemplo n.º 3
0
	def _get_bth(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciBreathiness)
Exemplo n.º 4
0
	def _get_rgh(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciRoughness)
Exemplo n.º 5
0
	def _get_hsz(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciHeadSize)
Exemplo n.º 6
0
	def _get_inflection(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciPitchFluctuation)
Exemplo n.º 7
0
	def _get_volume(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciVolume)
Exemplo n.º 8
0
	def _get_pitch(self):
		return _ibmeci.getVParam(ECIVoiceParam.eciPitchBaseline)
Exemplo n.º 9
0
	def _get_rate(self):
		val = _ibmeci.getVParam(ECIVoiceParam.eciSpeed)
		if self._rateBoost: val=int(round(val/self.RATE_BOOST_MULTIPLIER))
		return self._paramToPercent(val, minRate, maxRate)