TextClassifier

 TextClassifier

TextClassifier

TextClassifier-Sample
https://github.com/operando/TextClassifier-Sample

Shibuya.apk #34 - Report from Google I/O 2019
https://shibuya-apk.connpass.com/event/128668/

E77b6a5f919f7366d94f21eee9a014f5?s=128

operandoOS

May 17, 2019
Tweet

Transcript

  1. TextClassifier Shibuya.apk #34

  2. TextClassifier • Oreo(API level 26)͔Β௥Ճ͞ΕͨAPI • ςΩετ෼ྨثͷͨΊͷAPI • ෼ྨʹ͸ػցֶशͷϞσϧ͕࢖ΘΕ͍ͯΔ

  3. Smart Linkify • Android P͔Β • TextClassifierΛར༻ͯ͠Δ • https://developer.android.com/about/versions/pie/ android-9.0#text

    • Smart Text SelectionͷਐԽ൛ʁ • https://www.youtube.com/watch? v=Y2VF8tmLFHw&t=4832
  4. Smart Linkify • TextViewͱWebViewͰબ୒ΛONʹ͢Ε͹ TextClassifierΛ࢖༻ͨ͠Smart Linkify͕
 ಈ࡞͢Δ

  5. Smart Linkifyͷৄࡉ • The Machine Learning Behind Android Smart Linkify

    • https://ai.googleblog.com/2018/08/the- machine-learning-behind-android.html
  6. TextClassifierͷػೳ • TextClassification • TextLinks • TextSelection • TextLanguage(Q API)

    • ConversationActions(Q API)
  7. TextClassification • ࢦఆ͞ΕͨςΩετΛ෼ྨ͠ɺ෼ྨ͞Εͨς ΩετΛॲཧ͢ΔͨΊͷ΢ΟδΣοτΛੜ੒ ͢ΔͨΊʹ࢖༻Ͱ͖ΔTextClassification objectΛฦ͢

  8. TextLinks • ϦϯΫʹ஫ऍΛ෇͚ΔͨΊʹςΩετʹద༻ ͞ΕΔTextLinksΛੜ੒

  9. TextSelection • ςΩετબ୒ͷ։࢝ҐஔͱऴྃҐஔɺೝࣝ͞ Ε͍ͯΔΤϯςΟςΟͷछྨɺ͓ΑͼͦΕΒ ʹؔ࿈͢Δ৴པείΞΛฦ͢

  10. TextLanguage • ࢦఆ͞ΕͨςΩετͷݴޠΛݕग़

  11. ConversationActions • ༩͑ΒΕͨձ࿩ʹैͬͯΞΫγϣϯͷϦετ ΛఏҊ

  12. DEMO

  13. TextSelection GlobalScope.launch(Dispatchers.Main) { val tcm = getSystemService(TextClassificationManager::class.java) val ts: TextSelection

    = async { tcm.textClassifier.suggestSelection( TextSelection.Request.Builder( "GoogleͷαΠτURL:https://google.com" ,21,32).build()) }.await() findViewById<TextView>(R.id.result).text = ts.toString() }
  14. TextLanguage GlobalScope.launch { val tcm = getSystemService( TextClassificationManager::class.java) val tlr

    = TextLanguage.Request.Builder(text).build() val textLanguage = async { tcm.textClassifier.detectLanguage(tlr) }.await() findViewById<TextView>(R.id.result).text = textLanguage.toString() }
  15. TextLanguage GlobalScope.launch { val tcm = getSystemService (TextClassificationManager::class.java) val tlr

    = TextLanguage.Request.Builder(text).build() val textLanguage = async { tcm.textClassifier.detectLanguage(tlr) }.await() val s = textLanguage.getConfidenceScore( ULocale.JAPANESE) }
  16. TextClassifier Sample https://github.com/operando/ TextClassifier-Sample

  17. AndroidX Textclassifier https://developer.android.com/ jetpack/androidx/releases/ textclassifier

  18. ಠࣗTextClassifierΛ࣮૷ͯ͠Δྫ • https://search.siprop.org/android-9.0.0_r1.0/xref/ packages/apps/DocumentsUI/src/com/android/ documentsui/inspector/ GpsCoordinatesTextClassifier.java • TextView#setTextClassifierͰηοτ • https://developer.android.com/reference/android/

    widget/ TextView#setTextClassifier(android.view.textclassifier. TextClassifier)
  19. Implementing Text Classification • OEMͰ࢖͏Ϟσϧͱ͔ΛมߋͰ͖Δͷ͔ͳʁ • ඞཁʹԠ͡ͰϞσϧͷߋ৽ͱ͔΋Ͱ͖ͦ͏ʁ • https://source.android.com/devices/tech/ display/textclassifier

  20. TextClassifierΛѻͬͨϒϩά • https://blog.stylingandroid.com/ textclassification-part-1/ • https://blog.stylingandroid.com/ textclassification-part-2/ • https://blog.stylingandroid.com/ textclassification-part-3/

  21. Thanks!