MCPcopy Create free account
hub / github.com/daisy/MathCAT / get_string_none

Method get_string_none

src/tts.rs:480–508  ·  view source on GitHub ↗

auto pausing can't be known until neighboring strings are computed we create a unique string in this case and compute the real value later

(&self, command: &TTSCommandRule,  prefs: &PreferenceManager, is_start_tag: bool)

Source from the content-addressed store, hash-verified

478 // auto pausing can't be known until neighboring strings are computed
479 // we create a unique string in this case and compute the real value later
480 fn get_string_none(&self, command: &TTSCommandRule, prefs: &PreferenceManager, is_start_tag: bool) -> String {
481 // they only thing to do is handle "pause" with some punctuation hacks along with 'spell'
482 if is_start_tag {
483 if command.command == TTSCommand::Pause {
484 let amount = command.value.get_num();
485 // only ',' and ';' are used as '.' didn't seem to reliably generate pauses in tests
486 return crate::speech::CONCAT_INDICATOR.to_string() + (
487 if amount == PAUSE_AUTO {
488 PAUSE_AUTO_STR
489 } else {
490 let amount = amount * TTS::get_pause_multiplier(prefs);
491 if amount <= MIN_PAUSE {
492 ""
493 } else if amount <= 250.0 {
494 ","
495 } else {
496 ";"
497 }
498 }
499 );
500 } else if command.command == TTSCommand::Spell {
501 // debug!("spell rule: {}", command.value.get_string());
502 return command.value.get_string().to_string();
503 } else if let TTSCommandValue::Pronounce(p) = &command.value {
504 return crate::speech::CONCAT_INDICATOR.to_string() + &p.text;
505 }
506 };
507 return "".to_string();
508 }
509
510 fn get_string_sapi5(&self, command: &TTSCommandRule, prefs: &PreferenceManager, is_start_tag: bool) -> String {
511 return match &command.command {

Callers 2

replace_stringMethod · 0.80
compute_auto_pauseMethod · 0.80

Calls 2

get_numMethod · 0.80
get_stringMethod · 0.80

Tested by

no test coverage detected