O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Copyright © Up-frontier, Inc. All rights reserved.
Speech Framework
1
Copyright © Up-frontier, Inc. All rights reserved.
アジェンダ
• Speech Framework とは
• 使い⽅
• 使いどころ
2
Copyright © Up-frontier, Inc. All rights reserved.
アジェンダ
• Speech Framework とは
• 使い⽅
• 使いどころ
3
Copyright © Up-frontier, Inc. All rights reserved.
…の前に、まずは
Keyboard Dictation
4
Copyright © Up-frontier, Inc. All rights reserved.
Keyboard Dictation
• iPhone 4S からキーボードに内蔵
されていた、⾳声⼊⼒機能
• OS の機能であって、

ア...
Copyright © Up-frontier, Inc. All rights reserved.
Keyboard Dictation
• iPhone 4S からキーボードに内蔵
されていた、⾳声⼊⼒機能
• OS の機能であって、

ア...
Copyright © Up-frontier, Inc. All rights reserved.
Keyboard Dictation
• 有効無効の設定を知るための API がない
• 必ずキーボードとセット
• キーボード⾔語に依存
7
Copyright © Up-frontier, Inc. All rights reserved.
…では改めて
Speech Framework
8
Copyright © Up-frontier, Inc. All rights reserved.
Speech Framework
• 平たく⾔うと、⾳声認識APIです
• 受け取った⾳声をテキストとして扱う
• 認識の部分は Siriと同...
Copyright © Up-frontier, Inc. All rights reserved.
• マイクを利⽤したリアルタイム⾳声
• wavやmp3などの⾳声データでもOK
10
Copyright © Up-frontier, Inc. All rights reserved.
注意点
• 基本ネットワーク接続が必須
• リクエストに制限あり (アプリごと、端末ごと)
• 機密情報は NG (password, hea...
Copyright © Up-frontier, Inc. All rights reserved.
アジェンダ
• Speech Framework とは
• 使い⽅
• 使いどころ
12
Copyright © Up-frontier, Inc. All rights reserved.
①
ユーザの許可を得る
13
Copyright © Up-frontier, Inc. All rights reserved.
ユーザ許可
SFSpeechRecognizer.requestAuthorization { status in
switch status...
Copyright © Up-frontier, Inc. All rights reserved.
ユーザ許可
SFSpeechRecognizer.requestAuthorization { status in
switch status...
Copyright © Up-frontier, Inc. All rights reserved.
ユーザ許可
SFSpeechRecognizer.requestAuthorization { status in
switch status...
Copyright © Up-frontier, Inc. All rights reserved.
17
Copyright © Up-frontier, Inc. All rights reserved.
18
Copyright © Up-frontier, Inc. All rights reserved.
Info.plist
<key>NSSpeechRecognitionUsageDescription</key>
<string>Speec...
Copyright © Up-frontier, Inc. All rights reserved.
Info.plist
<key>NSSpeechRecognitionUsageDescription</key>
<string>Speec...
Copyright © Up-frontier, Inc. All rights reserved.
②
リクエストを作る
21
Copyright © Up-frontier, Inc. All rights reserved.
リクエスト
guard let audioURL = R.file.speechMp3() else {
print("Could not g...
Copyright © Up-frontier, Inc. All rights reserved.
リクエスト
guard let audioURL = R.file.speechMp3() else {
print("Could not g...
Copyright © Up-frontier, Inc. All rights reserved.
リクエスト
guard let audioURL = R.file.speechMp3() else {
print("Could not g...
Copyright © Up-frontier, Inc. All rights reserved.
③
タスクを作って実⾏
25
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: "ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: "ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: "ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: “ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: “ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: “ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: “ja...
Copyright © Up-frontier, Inc. All rights reserved.
タスク
let recognizer = SFSpeechRecognizer(
locale: Locale(identifier: “ja...
Copyright © Up-frontier, Inc. All rights reserved.
使い⽅まとめ
1. ユーザに許可を求めて
2. リクエストを作って
3. SFSpeechRecognizer にタスクとしてお願い
34
Copyright © Up-frontier, Inc. All rights reserved.
アジェンダ
• Speech Framework とは
• 使い⽅
• 使いどころ
35
Copyright © Up-frontier, Inc. All rights reserved.
⾶びつく前に
• Keyboard Dictation で実現できないかを

まず考える
• リクエスト制限などを考えると、

コアの機能には...
Copyright © Up-frontier, Inc. All rights reserved.
考えられるユースケース
• 「チーズ」という⾔葉に反応して、

⾃動でシャッターを切るカメラ (WWDCビデ
オ)
• 外国語の発⾳練習
• ...
Copyright © Up-frontier, Inc. All rights reserved.
考えられるユースケース
Speech Framework を利⽤した、英単語の発⾳練習アプリ
38
Copyright © Up-frontier, Inc. All rights reserved.
考えられるユースケース
Speech Framework を利⽤した、英単語の発⾳練習アプリ
39
Copyright © Up-frontier, Inc. All rights reserved.
まとめ
• 本家 Apple 製の⾳声認識API
• 解析エンジンは Siri と同様のもの
• マイク⼊⼒とファイル⼊⼒の両⽅で利⽤可能
•...
Próximos SlideShares
Carregando em…5
×

Speech Framework

1.389 visualizações

Publicada em

iOS 10 で追加された Speech Framework の概要や使い方についてまとめました。

Publicada em: Celular
  • www.HelpWriting.net is a really good site. thanks
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Did u try to use external powers for studying? Like ⇒ www.WritePaper.info ⇐ ? They helped me a lot once.
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Hello! I do no use writing service very often, only when I really have problems. But this one, I like best of all. The team of writers operates very quickly. It's called ⇒ www.HelpWriting.net ⇐ Hope this helps!
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Hi there! I just wanted to share a list of sites that helped me a lot during my studies: .................................................................................................................................... www.EssayWrite.best - Write an essay .................................................................................................................................... www.LitReview.xyz - Summary of books .................................................................................................................................... www.Coursework.best - Online coursework .................................................................................................................................... www.Dissertations.me - proquest dissertations .................................................................................................................................... www.ReMovie.club - Movies reviews .................................................................................................................................... www.WebSlides.vip - Best powerpoint presentations .................................................................................................................................... www.WritePaper.info - Write a research paper .................................................................................................................................... www.EddyHelp.com - Homework help online .................................................................................................................................... www.MyResumeHelp.net - Professional resume writing service .................................................................................................................................. www.HelpWriting.net - Help with writing any papers ......................................................................................................................................... Save so as not to lose
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Seja a primeira pessoa a gostar disto

Speech Framework

  1. 1. Copyright © Up-frontier, Inc. All rights reserved. Speech Framework 1
  2. 2. Copyright © Up-frontier, Inc. All rights reserved. アジェンダ • Speech Framework とは • 使い⽅ • 使いどころ 2
  3. 3. Copyright © Up-frontier, Inc. All rights reserved. アジェンダ • Speech Framework とは • 使い⽅ • 使いどころ 3
  4. 4. Copyright © Up-frontier, Inc. All rights reserved. …の前に、まずは Keyboard Dictation 4
  5. 5. Copyright © Up-frontier, Inc. All rights reserved. Keyboard Dictation • iPhone 4S からキーボードに内蔵 されていた、⾳声⼊⼒機能 • OS の機能であって、
 アプリの機能ではない • 設定 → ⼀般 → 
 キーボード → ⾳声⼊⼒ 5
  6. 6. Copyright © Up-frontier, Inc. All rights reserved. Keyboard Dictation • iPhone 4S からキーボードに内蔵 されていた、⾳声⼊⼒機能 • OS の機能であって、
 アプリの機能ではない • 設定 → ⼀般 → 
 キーボード → ⾳声⼊⼒ 6 これ
  7. 7. Copyright © Up-frontier, Inc. All rights reserved. Keyboard Dictation • 有効無効の設定を知るための API がない • 必ずキーボードとセット • キーボード⾔語に依存 7
  8. 8. Copyright © Up-frontier, Inc. All rights reserved. …では改めて Speech Framework 8
  9. 9. Copyright © Up-frontier, Inc. All rights reserved. Speech Framework • 平たく⾔うと、⾳声認識APIです • 受け取った⾳声をテキストとして扱う • 認識の部分は Siriと同じエンジン を利⽤ • リッチな結果(ベストと候補、確度など) • ⾳声ファイルからの⼊⼒も可能 9
  10. 10. Copyright © Up-frontier, Inc. All rights reserved. • マイクを利⽤したリアルタイム⾳声 • wavやmp3などの⾳声データでもOK 10
  11. 11. Copyright © Up-frontier, Inc. All rights reserved. 注意点 • 基本ネットワーク接続が必須 • リクエストに制限あり (アプリごと、端末ごと) • 機密情報は NG (password, health, financial) • ユーザに親切な UI を⼼がける
 - 録⾳中、認識途中の結果、最終的な認識結果 11
  12. 12. Copyright © Up-frontier, Inc. All rights reserved. アジェンダ • Speech Framework とは • 使い⽅ • 使いどころ 12
  13. 13. Copyright © Up-frontier, Inc. All rights reserved. ① ユーザの許可を得る 13
  14. 14. Copyright © Up-frontier, Inc. All rights reserved. ユーザ許可 SFSpeechRecognizer.requestAuthorization { status in switch status { case .authorized: case .denied: case .notDetermined: case .restricted: } } 14
  15. 15. Copyright © Up-frontier, Inc. All rights reserved. ユーザ許可 SFSpeechRecognizer.requestAuthorization { status in switch status { case .authorized: case .denied: case .notDetermined: case .restricted: } } 15 よくある権限ステータス (位置情報アクセスなど)
  16. 16. Copyright © Up-frontier, Inc. All rights reserved. ユーザ許可 SFSpeechRecognizer.requestAuthorization { status in switch status { case .authorized: case .denied: case .notDetermined: case .restricted: } } 16 デバイス判断で NG 前述の”リクエスト制限”によるもの?
  17. 17. Copyright © Up-frontier, Inc. All rights reserved. 17
  18. 18. Copyright © Up-frontier, Inc. All rights reserved. 18
  19. 19. Copyright © Up-frontier, Inc. All rights reserved. Info.plist <key>NSSpeechRecognitionUsageDescription</key> <string>SpeechFramework の使⽤⽬的</string> 19
  20. 20. Copyright © Up-frontier, Inc. All rights reserved. Info.plist <key>NSSpeechRecognitionUsageDescription</key> <string>SpeechFramework の使⽤⽬的</string> 20 ローカライズが必要な場合は、 InfoPlist.string を利⽤しましょう。 (plistじゃ視認性も悪いしね)
  21. 21. Copyright © Up-frontier, Inc. All rights reserved. ② リクエストを作る 21
  22. 22. Copyright © Up-frontier, Inc. All rights reserved. リクエスト guard let audioURL = R.file.speechMp3() else { print("Could not get file URL!") return } let request = SFSpeechURLRecognitionRequest(url: audioURL) 22
  23. 23. Copyright © Up-frontier, Inc. All rights reserved. リクエスト guard let audioURL = R.file.speechMp3() else { print("Could not get file URL!") return } let request = SFSpeechURLRecognitionRequest(url: audioURL) 23 対象のファイルのURLを⽣成して
  24. 24. Copyright © Up-frontier, Inc. All rights reserved. リクエスト guard let audioURL = R.file.speechMp3() else { print("Could not get file URL!") return } let request = SFSpeechURLRecognitionRequest(url: audioURL) 24 リクエストを⽣成する
  25. 25. Copyright © Up-frontier, Inc. All rights reserved. ③ タスクを作って実⾏ 25
  26. 26. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: "ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 26
  27. 27. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: "ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 27 ロケールを指定して SFSpeechRecognizer を⽣成
  28. 28. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: "ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 28 en-US を指定すれば、⽶英語
  29. 29. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: “ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 29 事前に⽣成した request を指定して タスクメソッドを実⾏する。
  30. 30. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: “ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 30 結果はクロージャで受け取る
  31. 31. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: “ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 31
  32. 32. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: “ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 32 1番確度の⾼いものを いい感じのフォーマットで受け取る
  33. 33. Copyright © Up-frontier, Inc. All rights reserved. タスク let recognizer = SFSpeechRecognizer( locale: Locale(identifier: “ja-JP")) recognizer?.recognitionTask(with: request) { result, error in guard let result = result else { print("Error on recognition task: (error)") return } self.textView.text = result
 .bestTranscription.formattedString print(result.transcriptions) } 33 bestTranscription 導出過程の候補はここにある
  34. 34. Copyright © Up-frontier, Inc. All rights reserved. 使い⽅まとめ 1. ユーザに許可を求めて 2. リクエストを作って 3. SFSpeechRecognizer にタスクとしてお願い 34
  35. 35. Copyright © Up-frontier, Inc. All rights reserved. アジェンダ • Speech Framework とは • 使い⽅ • 使いどころ 35
  36. 36. Copyright © Up-frontier, Inc. All rights reserved. ⾶びつく前に • Keyboard Dictation で実現できないかを
 まず考える • リクエスト制限などを考えると、
 コアの機能には持ってきにくい
 - 具体的な制限回数については明記なし 36
  37. 37. Copyright © Up-frontier, Inc. All rights reserved. 考えられるユースケース • 「チーズ」という⾔葉に反応して、
 ⾃動でシャッターを切るカメラ (WWDCビデ オ) • 外国語の発⾳練習 • ⾃作キーボードアプリに⾳声⼊⼒機能を実装 • Podcast やボイスレコーダーのテキスト起こし 37
  38. 38. Copyright © Up-frontier, Inc. All rights reserved. 考えられるユースケース Speech Framework を利⽤した、英単語の発⾳練習アプリ 38
  39. 39. Copyright © Up-frontier, Inc. All rights reserved. 考えられるユースケース Speech Framework を利⽤した、英単語の発⾳練習アプリ 39
  40. 40. Copyright © Up-frontier, Inc. All rights reserved. まとめ • 本家 Apple 製の⾳声認識API • 解析エンジンは Siri と同様のもの • マイク⼊⼒とファイル⼊⼒の両⽅で利⽤可能 • 利⽤回数や利⽤時間に制限がある 40

×