Guest User

Untitled

a guest
Dec 11th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. // Which of these is a better style? Is there much of a difference?
  2.  
  3. def createMicrosoftAudio0(utterance: Utterance, svc: MsSynthSvc = MicrosoftSpeech.Synthesize): Future[SynthesizedSpeech] = {
  4. if(!utterance.text.isDefined) return Future.exception(new UtteranceTextNotFound(utterance))
  5. val req = SynthesizeRequest(utterance.convo.id, utterance.text.get)
  6. for {
  7. resp <- svc(req)
  8. } yield SynthesizedSpeed(resp._1, resp._2)
  9. }
  10.  
  11. def createMicrosoftAudio1(utterance: Utterance, svc: MsSynthSvc = MicrosoftSpeech.Synthesize): Future[SynthesizedSpeech] = {
  12. if(utterance.emptyText) return Future.exception(new UtteranceTextNotFound(utterance))
  13. val req = SynthesizeRequest.fromUtterance(utterance)
  14. svc(req).map(SynthesizedSpeech)
  15. }
Add Comment
Please, Sign In to add comment