Slide 1

Slide 1 text

TextClassifier Shibuya.apk #34

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

Smart Linkify • TextViewͱWebViewͰબ୒ΛONʹ͢Ε͹ TextClassifierΛ࢖༻ͨ͠Smart Linkify͕
 ಈ࡞͢Δ

Slide 5

Slide 5 text

Smart Linkifyͷৄࡉ • The Machine Learning Behind Android Smart Linkify • https://ai.googleblog.com/2018/08/the- machine-learning-behind-android.html

Slide 6

Slide 6 text

TextClassifierͷػೳ • TextClassification • TextLinks • TextSelection • TextLanguage(Q API) • ConversationActions(Q API)

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

DEMO

Slide 13

Slide 13 text

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(R.id.result).text = ts.toString() }

Slide 14

Slide 14 text

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(R.id.result).text = textLanguage.toString() }

Slide 15

Slide 15 text

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) }

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

ಠࣗ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)

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

Thanks!