| | | |
Offset 1, 10 lines modified | Offset 1, 11 lines modified |
| |
1 | package·com.android.textclassifier; | 1 | package·com.android.textclassifier; |
| |
| 2 | import·java.util.Iterator; |
2 | import·android.view.textclassifier.TextSelection$Builder; | 3 | import·android.view.textclassifier.TextSelection$Builder; |
3 | import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions; | 4 | import·com.google.android.textclassifier.AnnotatorModel$SelectionOptions; |
4 | import·android.view.textclassifier.TextSelection; | 5 | import·android.view.textclassifier.TextSelection; |
5 | import·android.view.textclassifier.TextSelection$Request; | 6 | import·android.view.textclassifier.TextSelection$Request; |
6 | import·com.google.android.textclassifier.ActionsSuggestionsModel$ConversationMessage; | 7 | import·com.google.android.textclassifier.ActionsSuggestionsModel$ConversationMessage; |
7 | import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestionOptions; | 8 | import·com.google.android.textclassifier.ActionsSuggestionsModel$ActionSuggestionOptions; |
8 | import·com.google.android.textclassifier.ActionsSuggestionsModel$Conversation; | 9 | import·com.google.android.textclassifier.ActionsSuggestionsModel$Conversation; |
Offset 15, 14 lines modified | Offset 16, 15 lines modified |
15 | import·com.android.textclassifier.common.statsd.SelectionEventConverter; | 16 | import·com.android.textclassifier.common.statsd.SelectionEventConverter; |
16 | import·android.view.textclassifier.SelectionEvent; | 17 | import·android.view.textclassifier.SelectionEvent; |
17 | import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan; | 18 | import·com.google.android.textclassifier.AnnotatorModel$AnnotatedSpan; |
18 | import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions; | 19 | import·com.google.android.textclassifier.AnnotatorModel$AnnotationOptions; |
19 | import·android.view.textclassifier.TextLinks$Builder; | 20 | import·android.view.textclassifier.TextLinks$Builder; |
20 | import·android.view.textclassifier.TextLinks; | 21 | import·android.view.textclassifier.TextLinks; |
21 | import·android.view.textclassifier.TextLinks$Request; | 22 | import·android.view.textclassifier.TextLinks$Request; |
| 23 | import·com.google.common.collect.UnmodifiableIterator; |
22 | import·com.android.textclassifier.utils.IndentingPrintWriter; | 24 | import·com.android.textclassifier.utils.IndentingPrintWriter; |
23 | import·android.icu.util.ULocale; | 25 | import·android.icu.util.ULocale; |
24 | import·android.view.textclassifier.TextLanguage$Builder; | 26 | import·android.view.textclassifier.TextLanguage$Builder; |
25 | import·android.view.textclassifier.TextLanguage; | 27 | import·android.view.textclassifier.TextLanguage; |
26 | import·android.view.textclassifier.TextLanguage$Request; | 28 | import·android.view.textclassifier.TextLanguage$Request; |
27 | import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase; | 29 | import·com.google.android.textclassifier.AnnotatorModel$AnnotationUsecase; |
28 | import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions; | 30 | import·com.google.android.textclassifier.AnnotatorModel$ClassificationOptions; |
Offset 38, 20 lines modified | Offset 40, 18 lines modified |
38 | import·android.view.View; | 40 | import·android.view.View; |
39 | import·android.content.pm.ResolveInfo; | 41 | import·android.content.pm.ResolveInfo; |
40 | import·com.android.textclassifier.common.intent.LabeledIntent; | 42 | import·com.android.textclassifier.common.intent.LabeledIntent; |
41 | import·android.content.res.Configuration; | 43 | import·android.content.res.Configuration; |
42 | import·android.content.res.Resources; | 44 | import·android.content.res.Resources; |
43 | import·java.io.FileNotFoundException; | 45 | import·java.io.FileNotFoundException; |
44 | import·android.os.ParcelFileDescriptor; | 46 | import·android.os.ParcelFileDescriptor; |
45 | import·java.io.File; | |
46 | import·java.util.Objects; | 47 | import·java.util.Objects; |
47 | import·com.google.android.textclassifier.LangIdModel$LanguageResult; | 48 | import·com.google.android.textclassifier.LangIdModel$LanguageResult; |
48 | import·java.util.Map; | 49 | import·java.util.Map; |
49 | import·android.util.ArrayMap; | 50 | import·android.util.ArrayMap; |
50 | import·com.google.common.base.Function; | |
51 | import·com.google.common.collect.ImmutableList; | 51 | import·com.google.common.collect.ImmutableList; |
52 | import·android.content.Intent; | 52 | import·android.content.Intent; |
53 | import·android.view.View$OnClickListener; | 53 | import·android.view.View$OnClickListener; |
54 | import·android.app.PendingIntent; | 54 | import·android.app.PendingIntent; |
55 | import·android.app.RemoteAction; | 55 | import·android.app.RemoteAction; |
56 | import·com.android.textclassifier.common.intent.LabeledIntent$Result; | 56 | import·com.android.textclassifier.common.intent.LabeledIntent$Result; |
57 | import·java.util.Collection; | 57 | import·java.util.Collection; |
Offset 66, 61 lines modified | Offset 66, 77 lines modified |
66 | import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult; | 66 | import·com.google.android.textclassifier.AnnotatorModel$ClassificationResult; |
67 | import·java.util.List; | 67 | import·java.util.List; |
68 | import·com.android.textclassifier.common.logging.ResultIdUtils; | 68 | import·com.android.textclassifier.common.logging.ResultIdUtils; |
69 | import·com.google.common.base.Optional; | 69 | import·com.google.common.base.Optional; |
70 | import·android.os.LocaleList; | 70 | import·android.os.LocaleList; |
71 | import·com.android.textclassifier.common.base.TcLog; | 71 | import·com.android.textclassifier.common.base.TcLog; |
72 | import·android.os.Looper; | 72 | import·android.os.Looper; |
| 73 | import·java.util.function.Supplier; |
| 74 | import·java.util.function.Function; |
73 | import·com.google.common.base.Preconditions; | 75 | import·com.google.common.base.Preconditions; |
74 | import·com.android.textclassifier.common.statsd.TextClassifierEventLogger; | 76 | import·com.android.textclassifier.common.statsd.TextClassifierEventLogger; |
75 | import·com.android.textclassifier.common.intent.TemplateIntentFactory; | 77 | import·com.android.textclassifier.common.intent.TemplateIntentFactory; |
76 | import·com.google.android.textclassifier.LangIdModel; | 78 | import·com.google.android.textclassifier.LangIdModel; |
77 | import·com.android.textclassifier.common.statsd.GenerateLinksLogger; | 79 | import·com.android.textclassifier.common.statsd.GenerateLinksLogger; |
78 | import·android.view.textclassifier.TextClassifier; | 80 | import·android.view.textclassifier.TextClassifier; |
79 | import·android.content.Context; | 81 | import·android.content.Context; |
80 | import·com.google.android.textclassifier.AnnotatorModel; | 82 | import·com.google.android.textclassifier.AnnotatorModel; |
81 | import·com.google.android.textclassifier.ActionsSuggestionsModel; | 83 | import·com.google.android.textclassifier.ActionsSuggestionsModel; |
| 84 | import·java.io.File; |
| |
82 | final·class·TextClassifierImpl | 85 | final·class·TextClassifierImpl |
83 | { | 86 | { |
| 87 | ····private·static·final·File·ANNOTATOR_UPDATED_MODEL_FILE; |
| 88 | ····private·static·final·File·FACTORY_MODEL_DIR; |
| 89 | ····private·static·final·File·UPDATED_ACTIONS_MODEL; |
| 90 | ····private·static·final·File·UPDATED_LANG_ID_MODEL_FILE; |
84 | ····private·ModelFileManager$ModelFile·actionModelInUse; | 91 | ····private·ModelFileManager$ModelFile·actionModelInUse; |
85 | ····private·ActionsSuggestionsModel·actionsImpl; | 92 | ····private·ActionsSuggestionsModel·actionsImpl; |
| 93 | ····private·final·ModelFileManager·actionsModelFileManager; |
86 | ····private·AnnotatorModel·annotatorImpl; | 94 | ····private·AnnotatorModel·annotatorImpl; |
| 95 | ····private·final·ModelFileManager·annotatorModelFileManager; |
87 | ····private·ModelFileManager$ModelFile·annotatorModelInUse; | 96 | ····private·ModelFileManager$ModelFile·annotatorModelInUse; |
88 | ····private·final·Context·context; | 97 | ····private·final·Context·context; |
89 | ····private·final·TextClassifier·fallback; | 98 | ····private·final·TextClassifier·fallback; |
90 | ····private·final·GenerateLinksLogger·generateLinksLogger; | 99 | ····private·final·GenerateLinksLogger·generateLinksLogger; |
91 | ····private·LangIdModel·langIdImpl; | 100 | ····private·LangIdModel·langIdImpl; |
| 101 | ····private·final·ModelFileManager·langIdModelFileManager; |
92 | ····private·ModelFileManager$ModelFile·langIdModelInUse; | 102 | ····private·ModelFileManager$ModelFile·langIdModelInUse; |
93 | ····private·final·Object·lock; | 103 | ····private·final·Object·lock; |
94 | ····private·final·ModelFileManager·modelFileManager; | |
95 | ····private·final·TextClassifierSettings·settings; | 104 | ····private·final·TextClassifierSettings·settings; |
96 | ····private·final·TemplateIntentFactory·templateIntentFactory; | 105 | ····private·final·TemplateIntentFactory·templateIntentFactory; |
97 | ····private·final·TextClassifierEventLogger·textClassifierEventLogger; | 106 | ····private·final·TextClassifierEventLogger·textClassifierEventLogger; |
98 | ···· | 107 | ···· |
99 | ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings,·final·ModelFileManager·modelFileManager)·{ | |
100 | ········this(context,·textClassifierSettings,·modelFileManager,·TextClassifier.NO_OP); | 108 | ····static·{ |
| 109 | ········FACTORY_MODEL_DIR·=·new·File("/etc/textclassifier/"); |
| 110 | ········ANNOTATOR_UPDATED_MODEL_FILE·=·new·File("/data/misc/textclassifier/textclassifier.model"); |
| 111 | ········UPDATED_LANG_ID_MODEL_FILE·=·new·File("/data/misc/textclassifier/lang_id.model"); |
| 112 | ········UPDATED_ACTIONS_MODEL·=·new·File("/data/misc/textclassifier/actions_suggestions.model"); |
101 | ····} | 113 | ····} |
102 | ···· | 114 | ···· |
| 115 | ····TextClassifierImpl(final·Context·context,·final·TextClassifierSettings·textClassifierSettings)·{ |
| 116 | ········this(context,·textClassifierSettings,·TextClassifier.NO_OP); |
| 117 | ····} |
| 118 | ···· |
103 | ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·ModelFileManager·modelFileManager,·TextClassifier·fallback)·{ | 119 | ····TextClassifierImpl(Context·context,·TextClassifierSettings·settings,·TextClassifier·fallback)·{ |
104 | ········this.lock·=·new·Object(); | 120 | ········this.lock·=·new·Object(); |
105 | ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger(); | 121 | ········this.textClassifierEventLogger·=·new·TextClassifierEventLogger(); |
106 | ········Preconditions.checkNotNull((Object)context); | 122 | ········Preconditions.checkNotNull((Object)context); |
107 | ········context·=·context; | 123 | ········context·=·context; |
108 | ········this.context·=·context; | 124 | ········this.context·=·context; |
109 | ········Preconditions.checkNotNull((Object)settings); | |
110 | ········settings·=·settings; | |
111 | ········this.settings·=·settings; | |
112 | ········Preconditions.checkNotNull((Object)modelFileManager); | |
113 | ········modelFileManager·=·modelFileManager; | |
114 | ········this.modelFileManager·=·modelFileManager; | |
115 | ········Preconditions.checkNotNull((Object)fallback); | 125 | ········Preconditions.checkNotNull((Object)fallback); |
116 | ········fallback·=·fallback; | 126 | ········fallback·=·fallback; |
117 | ········this.fallback·=·fallback; | 127 | ········this.fallback·=·fallback; |
| 128 | ········Preconditions.checkNotNull((Object)settings); |
| 129 | ········settings·=·settings; |
| 130 | ········this.settings·=·settings; |
118 | ········this.generateLinksLogger·=·new·GenerateLinksLogger(this.settings.getGenerateLinksLogSampleRate()); | 131 | ········this.generateLinksLogger·=·new·GenerateLinksLogger(settings.getGenerateLinksLogSampleRate()); |
| 132 | ········this.annotatorModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"textclassifier\\.(.*)\\.model",·TextClassifierImpl.ANNOTATOR_UPDATED_MODEL_FILE,·(Function)-$$Lambda$jJq8RXuVdjYF3lPq-77PEw1NJLM.INSTANCE,·(Function)-$$Lambda$NxwbyZSxofZ4Z5SQhfXmtLQ1nxk.INSTANCE)); |
| 133 | ········this.langIdModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"lang_id.model",·TextClassifierImpl.UPDATED_LANG_ID_MODEL_FILE,·(Function)-$$Lambda$0biFK4yZBmWN1EO2wtnXskzuEcE.INSTANCE,·(Function)-$$Lambda$TextClassifierImpl$GgWuU910BaKzzHu6MQGYGCHOgkg.INSTANCE)); |
| 134 | ········this.actionsModelFileManager·=·new·ModelFileManager((Supplier)new·ModelFileManager$ModelFileSupplierImpl(TextClassifierImpl.FACTORY_MODEL_DIR,·"actions_suggestions\\.(.*)\\.model",·TextClassifierImpl.UPDATED_ACTIONS_MODEL,·(Function)-$$Lambda$9N8WImc0VBjy2oxI_Gk5_Pbye_A.INSTANCE,·(Function)-$$Lambda$XeE_KI7QgMKzF9vYRSoFWAolyuA.INSTANCE)); |
119 | ········this.templateIntentFactory·=·new·TemplateIntentFactory(); | 135 | ········this.templateIntentFactory·=·new·TemplateIntentFactory(); |
120 | ····} | 136 | ····} |
121 | ···· | 137 | ···· |
122 | ····private·static·void·checkMainThread()·{ | 138 | ····private·static·void·checkMainThread()·{ |
123 | ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{ | 139 | ········if·(Looper.myLooper()·==·Looper.getMainLooper())·{ |
124 | ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception()); | 140 | ············TcLog.e("TextClassifierImpl",·"TextClassifier·called·on·main·thread",·(Throwable)new·Exception()); |
125 | ········} | 141 | ········} |
Offset 237, 15 lines modified | Offset 253, 15 lines modified |
237 | ········//···165:·aload···········11 | 253 | ········//···165:·aload···········11 |
238 | ········//···167:·invokevirtual···com/google/android/textclassifier/AnnotatorModel$ClassificationResult.getRemoteActionTemplates:()[Lcom/google/android/textclassifier/RemoteActionTemplate; | 254 | ········//···167:·invokevirtual···com/google/android/textclassifier/AnnotatorModel$ClassificationResult.getRemoteActionTemplates:()[Lcom/google/android/textclassifier/RemoteActionTemplate; |
239 | ········//···170:·astore··········11 | 255 | ········//···170:·astore··········11 |
240 | ········//···172:·aload···········7 | 256 | ········//···172:·aload···········7 |
241 | ········//···174:·aload···········11 | 257 | ········//···174:·aload···········11 |
242 | ········//···176:·invokevirtual···com/android/textclassifier/common/intent/TemplateIntentFactory.create:([Lcom/google/android/textclassifier/RemoteActionTemplate;)Lcom/google/common/collect/ImmutableList; | 258 | ········//···176:·invokevirtual···com/android/textclassifier/common/intent/TemplateIntentFactory.create:([Lcom/google/android/textclassifier/RemoteActionTemplate;)Lcom/google/common/collect/ImmutableList; |
243 | ········//···179:·astore··········7 | 259 | ········//···179:·astore··········7 |
244 | ········//···181:·getstatic·······com/android/textclassifier/-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4.INSTANCE:Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$GPO8b-cUZbGymN45fgVNo11JSJ4; | 260 | ········//···181:·getstatic·······com/android/textclassifier/-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o.INSTANCE:Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$JRO8dEkAfMFOqu4-iyLbagDQA_o; |
245 | ········//···184:·astore··········11 | 261 | ········//···184:·astore··········11 |
246 | ········//···186:·new·············Ljava/util/ArrayList; | 262 | ········//···186:·new·············Ljava/util/ArrayList; |
247 | ········//···189:·astore··········13 | 263 | ········//···189:·astore··········13 |
248 | ········//···191:·aload···········13 | 264 | ········//···191:·aload···········13 |
249 | ········//···193:·invokespecial···java/util/ArrayList.<init>:()V | 265 | ········//···193:·invokespecial···java/util/ArrayList.<init>:()V |
250 | ········//···196:·aload···········7 | 266 | ········//···196:·aload···········7 |
251 | ········//···198:·invokevirtual···com/google/common/collect/ImmutableList.iterator:()Lcom/google/common/collect/UnmodifiableIterator; | 267 | ········//···198:·invokevirtual···com/google/common/collect/ImmutableList.iterator:()Lcom/google/common/collect/UnmodifiableIterator; |
Offset 340, 19 lines modified | Offset 356, 19 lines modified |
340 | ········//···397:·invokevirtual···java/util/ArrayList.add:(Ljava/lang/Object;)Z | 356 | ········//···397:·invokevirtual···java/util/ArrayList.add:(Ljava/lang/Object;)Z |
341 | ········//···400:·pop············ | 357 | ········//···400:·pop············ |
342 | ········//···401:·goto············210 | 358 | ········//···401:·goto············210 |
343 | ········//···404:·new·············Landroid/os/Bundle; | 359 | ········//···404:·new·············Landroid/os/Bundle; |
344 | ········//···407:·astore··········7 | 360 | ········//···407:·astore··········7 |
345 | ········//···409:·aload···········7 | 361 | ········//···409:·aload···········7 |
346 | ········//···411:·invokespecial···android/os/Bundle.<init>:()V | 362 | ········//···411:·invokespecial···android/os/Bundle.<init>:()V |
347 | ········//···414:·new·············Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$SO6kNnhgVauK__jmLEoCiyGozHw; | 363 | ········//···414:·new·············Lcom/android/textclassifier/-$$Lambda$TextClassifierImpl$Qwks3xU-K0S5rmi-r5zY7rcmhrA; |
348 | ········//···417:·astore··········10 | 364 | ········//···417:·astore··········10 |
349 | ········//···419:·aload···········10 | 365 | ········//···419:·aload···········10 |
350 | ········//···421:·aload···········13 | 366 | ········//···421:·aload···········13 |
351 | ········//···423:·invokespecial···com/android/textclassifier/-$$Lambda$TextClassifierImpl$SO6kNnhgVauK__jmLEoCiyGozHw.<init>:(Ljava/util/ArrayList;)V | 367 | ········//···423:·invokespecial···com/android/textclassifier/-$$Lambda$TextClassifierImpl$Qwks3xU-K0S5rmi-r5zY7rcmhrA.<init>:(Ljava/util/ArrayList;)V |
352 | ········//···426:·aload···········5 | 368 | ········//···426:·aload···········5 |
353 | ········//···428:·aload···········10 | 369 | ········//···428:·aload···········10 |
354 | ········//···430:·invokevirtual···com/google/common/base/Optional.transform:(Lcom/google/common/base/Function;)Lcom/google/common/base/Optional; | 370 | ········//···430:·invokevirtual···com/google/common/base/Optional.transform:(Lcom/google/common/base/Function;)Lcom/google/common/base/Optional; |
355 | ········//···433:·astore··········5 | 371 | ········//···433:·astore··········5 |
356 | ········//···435:·invokestatic····com/google/common/base/Optional.absent:()Lcom/google/common/base/Optional; | 372 | ········//···435:·invokestatic····com/google/common/base/Optional.absent:()Lcom/google/common/base/Optional; |
357 | ········//···438:·astore··········10 | 373 | ········//···438:·astore··········10 |
358 | ········//···440:·aload···········5 | 374 | ········//···440:·aload···········5 |
Offset 601, 23 lines modified | Offset 617, 23 lines modified |
601 | ········synchronized·(this.lock)·{ | 617 | ········synchronized·(this.lock)·{ |
602 | ············return·new·ConversationActions(list2,·ActionsSuggestionsHelper.createResultId(this.context,·conversationActions$Request.getConversation(),·Optional.fromNullable((Object)this.actionModelInUse),·Optional.fromNullable((Object)this.annotatorModelInUse),·Optional.fromNullable((Object)this.langIdModelInUse))); | 618 | ············return·new·ConversationActions(list2,·ActionsSuggestionsHelper.createResultId(this.context,·conversationActions$Request.getConversation(),·Optional.fromNullable((Object)this.actionModelInUse),·Optional.fromNullable((Object)this.annotatorModelInUse),·Optional.fromNullable((Object)this.langIdModelInUse))); |
603 | ········} | 619 | ········} |
604 | ····} | 620 | ····} |
605 | ···· | 621 | ···· |
606 | ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{ | 622 | ····private·static·View$OnClickListener·createIntentOnClickListener(final·PendingIntent·pendingIntent)·{ |
607 | ········Preconditions.checkNotNull((Object)pendingIntent); | 623 | ········Preconditions.checkNotNull((Object)pendingIntent); |
608 | ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$2dNQE4N9CXjJ-oio8KtmeiaIZ_M(pendingIntent); | 624 | ········return·(View$OnClickListener)new·-$$Lambda$TextClassifierImpl$wlF5Lmygug2HifzLlH779V8jReI(pendingIntent); |
609 | ····} | 625 | ····} |
610 | ···· | 626 | ···· |
611 | ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{ | 627 | ····private·static·PendingIntent·createPendingIntent(final·Context·context,·final·Intent·intent,·final·int·n)·{ |
612 | ········return·PendingIntent.getActivity(context,·n,·intent,·134217728); | 628 | ········return·PendingIntent.getActivity(context,·n,·intent,·134217728); |
613 | ····} | 629 | ····} |
614 | ···· | 630 | ···· |
615 | ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{ | 631 | ····private·ImmutableList·detectLanguageTags(final·Optional·optional,·final·CharSequence·charSequence)·{ |
616 | ········return·(ImmutableList)optional.transform((Function)new·-$$Lambda$TextClassifierImpl$rAyJ3L-N3WE5epfPetkTw3MVoy4(this,·charSequence)).or((Object)ImmutableList.of()); | 632 | ········return·(ImmutableList)optional.transform((com.google.common.base.Function)new·-$$Lambda$TextClassifierImpl$AY5eoUbVCLXhR9opqmynv0zcSU0(this,·charSequence)).or((Object)ImmutableList.of()); |
617 | ····} | 633 | ····} |
618 | ···· | 634 | ···· |
619 | ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{ | 635 | ····private·static·EntityConfidence·detectLanguages(final·LangIdModel·langIdModel,·final·CharSequence·charSequence,·final·float·n)·{ |
620 | ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString()); | 636 | ········final·LangIdModel$LanguageResult[]·detectLanguages·=·langIdModel.detectLanguages(charSequence.toString()); |
621 | ········final·ArrayMap·arrayMap·=·new·ArrayMap(); | 637 | ········final·ArrayMap·arrayMap·=·new·ArrayMap(); |
622 | ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{ | 638 | ········for·(int·length·=·detectLanguages.length,·i·=·0;·i·<·length;·++i)·{ |
623 | ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i]; | 639 | ············final·LangIdModel$LanguageResult·langIdModel$LanguageResult·=·detectLanguages[i]; |
Offset 626, 34 lines modified | Offset 642, 34 lines modified |
626 | ············} | 642 | ············} |
627 | ········} | 643 | ········} |
628 | ········return·new·EntityConfidence((Map)arrayMap); | 644 | ········return·new·EntityConfidence((Map)arrayMap); |
629 | ····} | 645 | ····} |
630 | ···· | 646 | ···· |
631 | ····private·ActionsSuggestionsModel·getActionsImpl()·{ | 647 | ····private·ActionsSuggestionsModel·getActionsImpl()·{ |
632 | ········synchronized·(this.lock)·{ | 648 | ········synchronized·(this.lock)·{ |
633 | ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("actions_suggestions",·LocaleList.getDefault()); | 649 | ············final·ModelFileManager$ModelFile·bestModelFile·=·this.actionsModelFileManager.findBestModelFile(LocaleList.getDefault()); |
634 | ············if·(bestModelFile·==·null)·{ | 650 | ············if·(bestModelFile·==·null)·{ |
635 | ················return·null; | 651 | ················return·null; |
636 | ············} | 652 | ············} |
637 | ············Label_0244:·{ | 653 | ············Label_0237:·{ |
638 | ················if·(this.actionsImpl·!=·null)·{ | 654 | ················if·(this.actionsImpl·!=·null)·{ |
639 | ····················final·Object·a·=·this.actionModelInUse; | 655 | ····················final·Object·a·=·this.actionModelInUse; |
640 | ····················if·(Objects.equals(a,·bestModelFile))·{ | 656 | ····················if·(Objects.equals(a,·bestModelFile))·{ |
641 | ························break·Label_0244; | 657 | ························break·Label_0237; |
642 | ····················} | 658 | ····················} |
643 | ················} | 659 | ················} |
644 | ················final·String·s·=·"TextClassifierImpl"; | 660 | ················final·String·s·=·"TextClassifierImpl"; |
645 | ················final·StringBuilder·sb·=·new·StringBuilder(); | 661 | ················final·StringBuilder·sb·=·new·StringBuilder(); |
646 | ················sb.append("Loading·"); | 662 | ················sb.append("Loading·"); |
647 | ················sb.append(bestModelFile); | 663 | ················sb.append(bestModelFile); |
648 | ················TcLog.d(s,·sb.toString()); | 664 | ················TcLog.d(s,·sb.toString()); |
649 | ················final·Object·a·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456); | 665 | ················final·Object·a·=·ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456); |
650 | ················Label_0212:·{ | 666 | ················Label_0205:·{ |
651 | ····················if·(a·!=·null)·{ | 667 | ····················if·(a·!=·null)·{ |
652 | ························break·Label_0212; | 668 | ························break·Label_0205; |
653 | ····················} | 669 | ····················} |
654 | ····················final·String·s2·=·"TextClassifierImpl"; | 670 | ····················final·String·s2·=·"TextClassifierImpl"; |
655 | ····················try·{ | 671 | ····················try·{ |
656 | ························final·StringBuilder·sb2·=·new·StringBuilder(); | 672 | ························final·StringBuilder·sb2·=·new·StringBuilder(); |
657 | ························sb2.append("Failed·to·read·the·model·file:·"); | 673 | ························sb2.append("Failed·to·read·the·model·file:·"); |
658 | ························sb2.append(bestModelFile.getPath()); | 674 | ························sb2.append(bestModelFile.getPath()); |
659 | ························TcLog.d(s2,·sb2.toString()); | 675 | ························TcLog.d(s2,·sb2.toString()); |
Offset 680, 58 lines modified | Offset 696, 57 lines modified |
680 | ············} | 696 | ············} |
681 | ············try·{ | 697 | ············try·{ |
682 | ················list·=·LocaleList.getDefault(); | 698 | ················list·=·LocaleList.getDefault(); |
683 | ················break·Label_0022; | 699 | ················break·Label_0022; |
684 | ············} | 700 | ············} |
685 | ············finally·{ | 701 | ············finally·{ |
686 | ················//·monitorexit(lock) | 702 | ················//·monitorexit(lock) |
687 | ················//·iftrue(Label_0232:,·list·==·null) | 703 | ················final·StringBuilder·sb; |
| 704 | ················Label_0238:·{ |
| 705 | ····················sb·=·new·StringBuilder(); |
| 706 | ················} |
| 707 | ················sb.append("No·annotator·model·for·"); |
| 708 | ················sb.append(list.toLanguageTags()); |
| 709 | ················throw·new·FileNotFoundException(sb.toString()); |
688 | ················//·iftrue(Label_0236:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile)) | 710 | ················//·iftrue(Label_0229:,·this.annotatorImpl·!=·null·&&·Objects.equals((Object)this.annotatorModelInUse,·(Object)bestModelFile)) |
| 711 | ················//·iftrue(Label_0238:,·bestModelFile·==·null) |
| 712 | ················ModelFileManager$ModelFile·bestModelFile·=·null; |
| 713 | ············Label_0063: |
| 714 | ················while·(true)·{ |
| 715 | ····················break·Label_0063; |
| 716 | ····················bestModelFile·=·this.annotatorModelFileManager.findBestModelFile(list); |
| 717 | ····················continue; |
| 718 | ················} |
| 719 | ················final·String·s·=·"TextClassifierImpl"; |
| 720 | ················final·StringBuilder·sb2·=·new·StringBuilder(); |
| 721 | ················sb2.append("Loading·"); |
| 722 | ················sb2.append(bestModelFile); |
| 723 | ················TcLog.d(s,·sb2.toString()); |
| 724 | ················list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456); |
| 725 | ················//·iftrue(Label_0225:,·list·==·null) |
689 | ················//·monitorexit(lock) | 726 | ················//·monitorexit(lock) |
690 | ················//·iftrue(Label_0245:,·bestModelFile·==·null) | |
691 | ················while·(true)·{ | 727 | ················while·(true)·{ |
692 | ················Label_0232: | |
693 | ····················while·(true)·{ | |
694 | ························final·ModelFileManager$ModelFile·bestModelFile; | |
695 | ····················Block_6: | 728 | ····················Block_6:·{ |
696 | ························while·(true)·{ | |
697 | ····························final·String·s·=·"TextClassifierImpl"; | |
698 | ····························final·StringBuilder·sb·=·new·StringBuilder(); | |
699 | ····························sb.append("Loading·"); | |
700 | ····························sb.append(bestModelFile); | |
701 | ····························TcLog.d(s,·sb.toString()); | |
702 | ····························list·=·(LocaleList)ParcelFileDescriptor.open(new·File(bestModelFile.getPath()),·268435456); | |
703 | ····························break·Block_6; | 729 | ························break·Block_6; |
704 | ····························final·StringBuilder·sb2; | |
705 | ····························Label_0245:·{ | |
706 | ································sb2·=·new·StringBuilder(); | |
707 | ····························} | |
708 | ····························sb2.append("No·annotator·model·for·"); | |
709 | ····························sb2.append(list.toLanguageTags()); | |
710 | ····························throw·new·FileNotFoundException(sb2.toString()); | |
711 | ····························continue; | |
712 | ························} | |
713 | ························try·{ | |
714 | ····························this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd()); | |
715 | ····························final·Optional·langIdImpl·=·this.getLangIdImpl(); | |
716 | ····························if·(langIdImpl.isPresent())·{ | |
717 | ································this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get()); | |
718 | ····························} | |
719 | ····························this.annotatorModelInUse·=·bestModelFile; | |
720 | ························} | |
721 | ························finally·{ | |
722 | ····························maybeCloseAndLogError((ParcelFileDescriptor)list); | 730 | ························maybeCloseAndLogError((ParcelFileDescriptor)list); |
723 | ························} | |
724 | ························break·Label_0232; | |
725 | ························final·TextClassifierImpl·textClassifierImpl; | 731 | ························final·TextClassifierImpl·textClassifierImpl; |
| 732 | ························Label_0229: |
726 | ························return·textClassifierImpl.annotatorImpl; | 733 | ························return·textClassifierImpl.annotatorImpl; |
727 | ························bestModelFile·=·this.modelFileManager.findBestModelFile("annotator",·list); | |
728 | ························continue; | |
729 | ····················} | 734 | ····················} |
| 735 | ····················try·{ |
| 736 | ························this.annotatorImpl·=·new·AnnotatorModel(((ParcelFileDescriptor)list).getFd()); |
| 737 | ························final·Optional·langIdImpl·=·this.getLangIdImpl(); |
| 738 | ························if·(langIdImpl.isPresent())·{ |
| 739 | ····························this.annotatorImpl.setLangIdModel((LangIdModel)langIdImpl.get()); |
| 740 | ························} |
| 741 | ························this.annotatorModelInUse·=·bestModelFile; |
| 742 | ····················} |
| 743 | ····················finally·{ |
730 | ····················maybeCloseAndLogError((ParcelFileDescriptor)list); | 744 | ························maybeCloseAndLogError((ParcelFileDescriptor)list); |
| 745 | ····················} |
731 | ····················continue; | 746 | ····················continue; |
732 | ················} | 747 | ················} |
733 | ············} | 748 | ············} |
734 | ········} | 749 | ········} |
735 | ····} | 750 | ····} |
736 | ···· | 751 | ···· |
737 | ····private·Collection·getEntitiesForHints(final·Collection·collection)·{ | 752 | ····private·Collection·getEntitiesForHints(final·Collection·collection)·{ |
Offset 743, 21 lines modified | Offset 758, 21 lines modified |
743 | ············return·this.settings.getEntityListEditable(); | 758 | ············return·this.settings.getEntityListEditable(); |
744 | ········} | 759 | ········} |
745 | ········return·this.settings.getEntityListNotEditable(); | 760 | ········return·this.settings.getEntityListNotEditable(); |
746 | ····} | 761 | ····} |
747 | ···· | 762 | ···· |
748 | ····private·Optional·getLangIdImpl()·{ | 763 | ····private·Optional·getLangIdImpl()·{ |
749 | ········synchronized·(this.lock)·{ | 764 | ········synchronized·(this.lock)·{ |
750 | ············final·ModelFileManager$ModelFile·bestModelFile·=·this.modelFileManager.findBestModelFile("lang_id",·(LocaleList)null); | 765 | ············final·ModelFileManager$ModelFile·bestModelFile·=·this.langIdModelFileManager.findBestModelFile((LocaleList)null); |
751 | ············if·(bestModelFile·==·null)·{ | 766 | ············if·(bestModelFile·==·null)·{ |
752 | ················return·Optional.absent(); | 767 | ················return·Optional.absent(); |
753 | ············} | 768 | ············} |
754 | ············Label_0188:·{ | 769 | ············Label_0194:·{ |
755 | ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{ | 770 | ················if·(this.langIdImpl·!=·null·&&·Objects.equals(this.langIdModelInUse,·bestModelFile))·{ |
756 | ····················break·Label_0188; | 771 | ····················break·Label_0194; |
757 | ················} | 772 | ················} |
758 | ················final·String·s·=·"TextClassifierImpl"; | 773 | ················final·String·s·=·"TextClassifierImpl"; |
759 | ················final·StringBuilder·sb·=·new·StringBuilder(); | 774 | ················final·StringBuilder·sb·=·new·StringBuilder(); |
760 | ················sb.append("Loading·"); | 775 | ················sb.append("Loading·"); |
761 | ················sb.append(bestModelFile); | 776 | ················sb.append(bestModelFile); |
762 | ················TcLog.d(s,·sb.toString()); | 777 | ················TcLog.d(s,·sb.toString()); |
763 | ················try·{ | 778 | ················try·{ |
Offset 831, 15 lines modified | Offset 846, 15 lines modified |
831 | ········} | 846 | ········} |
832 | ········catch·(IOException·ex)·{ | 847 | ········catch·(IOException·ex)·{ |
833 | ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex); | 848 | ············TcLog.e("TextClassifierImpl",·"Error·closing·file.",·(Throwable)ex); |
834 | ········} | 849 | ········} |
835 | ····} | 850 | ····} |
836 | ···· | 851 | ···· |
837 | ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{ | 852 | ····private·static·Optional·maybeCreateExtrasForTranslate(final·List·list,·final·LangIdModel·langIdModel)·{ |
838 | ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((Predicate)-$$Lambda$TextClassifierImpl$gY8JATzhlR_76-3FXEFdECxZ_Rg.INSTANCE).first(); | 853 | ········final·Optional·first·=·FluentIterable.from((Iterable)list).filter((Predicate)-$$Lambda$rm5za8qxlTZUvnydaEE0tVLEw0A.INSTANCE).filter((Predicate)-$$Lambda$TextClassifierImpl$_9AKIndHE_v2Sz1V8d6jhA82Gc4.INSTANCE).first(); |
839 | ········if·(!first.isPresent())·{ | 854 | ········if·(!first.isPresent())·{ |
840 | ············return·Optional.absent(); | 855 | ············return·Optional.absent(); |
841 | ········} | 856 | ········} |
842 | ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get()); | 857 | ········final·Pair·topLanguage·=·ExtrasUtils.getTopLanguage((Intent)first.get()); |
843 | ········if·(topLanguage·==·null)·{ | 858 | ········if·(topLanguage·==·null)·{ |
844 | ············return·Optional.absent(); | 859 | ············return·Optional.absent(); |
845 | ········} | 860 | ········} |
Offset 880, 15 lines modified | Offset 895, 29 lines modified |
880 | ················ZonedDateTime·zonedDateTime; | 895 | ················ZonedDateTime·zonedDateTime; |
881 | ················if·(textClassification$Request.getReferenceTime()·!=·null)·{ | 896 | ················if·(textClassification$Request.getReferenceTime()·!=·null)·{ |
882 | ····················zonedDateTime·=·textClassification$Request.getReferenceTime(); | 897 | ····················zonedDateTime·=·textClassification$Request.getReferenceTime(); |
883 | ················} | 898 | ················} |
884 | ················else·{ | 899 | ················else·{ |
885 | ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault()); | 900 | ····················zonedDateTime·=·ZonedDateTime.now(ZoneId.systemDefault()); |
886 | ················} | 901 | ················} |
887 | ················final·AnnotatorModel$ClassificationResult[]·classifyText·=·this.getAnnotatorImpl(textClassification$Request.getDefaultLocales()).classifyText(string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·AnnotatorModel$ClassificationOptions.builder().setReferenceTimeMsUtc(zonedDateTime.toInstant().toEpochMilli()).setReferenceTimezone(zonedDateTime.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(String.join((CharSequence)",",·(Iterable<?·extends·CharSequence>)detectLanguageTags)).setAnnotationUsecase(AnnotatorModel$AnnotationUsecase.SMART.getValue()).setUserFamiliarLanguageTags(LocaleList.getDefault().toLanguageTags()).build(),·(Object)this.context,·this.getResourceLocalesString()); | 902 | ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textClassification$Request.getDefaultLocales()); |
| 903 | ················final·int·startIndex·=·textClassification$Request.getStartIndex(); |
| 904 | ················final·int·endIndex·=·textClassification$Request.getEndIndex(); |
| 905 | ················final·long·epochMilli; |
| 906 | ················final·String·id; |
| 907 | ················final·String·join; |
| 908 | ················final·int·value; |
| 909 | ················final·String·languageTags; |
| 910 | ················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join,·value,·languageTags); |
| 911 | ················epochMilli·=·zonedDateTime.toInstant().toEpochMilli(); |
| 912 | ················id·=·zonedDateTime.getZone().getId(); |
| 913 | ················join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags); |
| 914 | ················value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue(); |
| 915 | ················languageTags·=·LocaleList.getDefault().toLanguageTags(); |
| 916 | ················final·AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·startIndex,·endIndex,·annotatorModel$ClassificationOptions,·(Object)this.context,·this.getResourceLocalesString()); |
888 | ················if·(classifyText.length·>·0)·{ | 917 | ················if·(classifyText.length·>·0)·{ |
889 | ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl); | 918 | ····················return·this.createClassificationResult(classifyText,·string,·textClassification$Request.getStartIndex(),·textClassification$Request.getEndIndex(),·langIdImpl); |
890 | ················} | 919 | ················} |
891 | ············} | 920 | ············} |
892 | ········} | 921 | ········} |
893 | ········finally·{ | 922 | ········finally·{ |
894 | ············final·Throwable·t; | 923 | ············final·Throwable·t; |
Offset 921, 15 lines modified | Offset 950, 35 lines modified |
921 | ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{ | 950 | ····void·dump(final·IndentingPrintWriter·indentingPrintWriter)·{ |
922 | ········final·Object·lock·=·this.lock; | 951 | ········final·Object·lock·=·this.lock; |
923 | ········//·monitorenter(lock) | 952 | ········//·monitorenter(lock) |
924 | ········final·String·s·=·"TextClassifierImpl:"; | 953 | ········final·String·s·=·"TextClassifierImpl:"; |
925 | ········try·{ | 954 | ········try·{ |
926 | ············indentingPrintWriter.println(s); | 955 | ············indentingPrintWriter.println(s); |
927 | ············indentingPrintWriter.increaseIndent(); | 956 | ············indentingPrintWriter.increaseIndent(); |
928 | ············this.modelFileManager.dump(indentingPrintWriter); | 957 | ············indentingPrintWriter.println("Annotator·model·file(s):"); |
| 958 | ············indentingPrintWriter.increaseIndent(); |
| 959 | ············final·UnmodifiableIterator·iterator·=·this.annotatorModelFileManager.listModelFiles().iterator(); |
| 960 | ············while·(((Iterator)iterator).hasNext())·{ |
| 961 | ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator).next()).toString()); |
| 962 | ············} |
| 963 | ············indentingPrintWriter.decreaseIndent(); |
| 964 | ············indentingPrintWriter.println("LangID·model·file(s):"); |
| 965 | ············indentingPrintWriter.increaseIndent(); |
| 966 | ············final·UnmodifiableIterator·iterator2·=·this.langIdModelFileManager.listModelFiles().iterator(); |
| 967 | ············while·(((Iterator)iterator2).hasNext())·{ |
| 968 | ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator2).next()).toString()); |
| 969 | ············} |
| 970 | ············indentingPrintWriter.decreaseIndent(); |
| 971 | ············indentingPrintWriter.println("Actions·model·file(s):"); |
| 972 | ············indentingPrintWriter.increaseIndent(); |
| 973 | ············final·UnmodifiableIterator·iterator3·=·this.actionsModelFileManager.listModelFiles().iterator(); |
| 974 | ············while·(((Iterator)iterator3).hasNext())·{ |
| 975 | ················indentingPrintWriter.println(((ModelFileManager$ModelFile)((Iterator<ModelFileManager$ModelFile>)iterator3).next()).toString()); |
| 976 | ············} |
| 977 | ············indentingPrintWriter.decreaseIndent(); |
929 | ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback); | 978 | ············indentingPrintWriter.printPair("mFallback",·(Object)this.fallback); |
930 | ············indentingPrintWriter.decreaseIndent(); | 979 | ············indentingPrintWriter.decreaseIndent(); |
931 | ············indentingPrintWriter.println(); | 980 | ············indentingPrintWriter.println(); |
932 | ············this.settings.dump(indentingPrintWriter); | 981 | ············this.settings.dump(indentingPrintWriter); |
933 | ········} | 982 | ········} |
934 | ········finally·{ | 983 | ········finally·{ |
935 | ········} | 984 | ········} |
Offset 941, 31 lines modified | Offset 990, 39 lines modified |
941 | ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength()); | 990 | ········Preconditions.checkArgument(textLinks$Request.getText().length()·<=·this.getMaxGenerateLinksTextLength(),·"text.length()·cannot·be·greater·than·%s",·this.getMaxGenerateLinksTextLength()); |
942 | ········checkMainThread(); | 991 | ········checkMainThread(); |
943 | ········final·String·string·=·textLinks$Request.getText().toString(); | 992 | ········final·String·string·=·textLinks$Request.getText().toString(); |
944 | ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string); | 993 | ········final·TextLinks$Builder·textLinks$Builder·=·new·TextLinks$Builder(string); |
945 | ········try·{ | 994 | ········try·{ |
946 | ············final·long·currentTimeMillis·=·System.currentTimeMillis(); | 995 | ············final·long·currentTimeMillis·=·System.currentTimeMillis(); |
947 | ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault()); | 996 | ············final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault()); |
948 | ············Collection·entityTypes; | 997 | ············Collection·collection; |
949 | ············if·(textLinks$Request.getEntityConfig()·!=·null)·{ | 998 | ············if·(textLinks$Request.getEntityConfig()·!=·null)·{ |
950 | ················entityTypes·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints())); | 999 | ················collection·=·textLinks$Request.getEntityConfig().resolveEntityListModifications(this.getEntitiesForHints(textLinks$Request.getEntityConfig().getHints())); |
951 | ············} | 1000 | ············} |
952 | ············else·{ | 1001 | ············else·{ |
953 | ················entityTypes·=·this.settings.getEntityListDefault(); | 1002 | ················collection·=·this.settings.getEntityListDefault(); |
954 | ············} | 1003 | ············} |
955 | ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales()); | 1004 | ············final·String·concatenateLocales·=·concatenateLocales(textLinks$Request.getDefaultLocales()); |
956 | ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText()); | 1005 | ············final·ImmutableList·detectLanguageTags·=·this.detectLanguageTags(this.getLangIdImpl(),·textLinks$Request.getText()); |
957 | ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales()); | 1006 | ············final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textLinks$Request.getDefaultLocales()); |
958 | ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request); | 1007 | ············final·boolean·serializedEntityDataEnabled·=·ExtrasUtils.isSerializedEntityDataEnabled(textLinks$Request); |
959 | ············final·AnnotatorModel$AnnotatedSpan[]·annotate·=·annotatorImpl.annotate(string,·AnnotatorModel$AnnotationOptions.builder().setReferenceTimeMsUtc(now.toInstant().toEpochMilli()).setReferenceTimezone(now.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(String.join((CharSequence)",",·(Iterable<?·extends·CharSequence>)detectLanguageTags)).setEntityTypes(entityTypes).setAnnotationUsecase(AnnotatorModel$AnnotationUsecase.SMART.getValue()).setIsSerializedEntityDataEnabled(serializedEntityDataEnabled).build()); | 1008 | ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions·=·new(com.google.android.textclassifier.AnnotatorModel$AnnotationOptions.class); |
| 1009 | ············final·long·epochMilli·=·now.toInstant().toEpochMilli(); |
| 1010 | ············final·String·id·=·now.getZone().getId(); |
| 1011 | ············final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)detectLanguageTags); |
| 1012 | ············final·int·value·=·AnnotatorModel$AnnotationUsecase.SMART.getValue(); |
| 1013 | ············final·AnnotatorModel$AnnotationOptions·annotatorModel$AnnotationOptions2·=·annotatorModel$AnnotationOptions; |
| 1014 | ············final·long·n·=·currentTimeMillis; |
| 1015 | ············new·AnnotatorModel$AnnotationOptions(epochMilli,·id,·concatenateLocales,·join,·collection,·value,·serializedEntityDataEnabled); |
| 1016 | ············final·AnnotatorModel$AnnotatedSpan[]·annotate·=·annotatorImpl.annotate(string,·annotatorModel$AnnotationOptions2); |
960 | ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{ | 1017 | ············for·(int·length·=·annotate.length,·i·=·0;·i·<·length;·++i)·{ |
961 | ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i]; | 1018 | ················final·AnnotatorModel$AnnotatedSpan·annotatorModel$AnnotatedSpan·=·annotate[i]; |
962 | ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification(); | 1019 | ················final·AnnotatorModel$ClassificationResult[]·classification·=·annotatorModel$AnnotatedSpan.getClassification(); |
963 | ················if·(classification.length·!=·0)·{ | 1020 | ················if·(classification.length·!=·0)·{ |
964 | ····················if·(entityTypes.contains(classification[0].getCollection()))·{ | 1021 | ····················if·(collection.contains(classification[0].getCollection()))·{ |
965 | ························final·ArrayMap·arrayMap·=·new·ArrayMap(); | 1022 | ························final·ArrayMap·arrayMap·=·new·ArrayMap(); |
966 | ························for·(int·j·=·0;·j·<·classification.length;·++j)·{ | 1023 | ························for·(int·j·=·0;·j·<·classification.length;·++j)·{ |
967 | ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore()); | 1024 | ····························((Map<String,·Float>)arrayMap).put(classification[j].getCollection(),·classification[j].getScore()); |
968 | ························} | 1025 | ························} |
969 | ························final·Bundle·bundle·=·new·Bundle(); | 1026 | ························final·Bundle·bundle·=·new·Bundle(); |
970 | ························if·(serializedEntityDataEnabled)·{ | 1027 | ························if·(serializedEntityDataEnabled)·{ |
971 | ····························ExtrasUtils.putEntities(bundle,·classification); | 1028 | ····························ExtrasUtils.putEntities(bundle,·classification); |
Offset 981, 18 lines modified | Offset 1038, 18 lines modified |
981 | ················s·=·this.context.getPackageName(); | 1038 | ················s·=·this.context.getPackageName(); |
982 | ············} | 1039 | ············} |
983 | ············else·{ | 1040 | ············else·{ |
984 | ················s·=·textLinks$Request.getCallingPackageName(); | 1041 | ················s·=·textLinks$Request.getCallingPackageName(); |
985 | ············} | 1042 | ············} |
986 | ············final·String·s2·=·s; | 1043 | ············final·String·s2·=·s; |
987 | ············synchronized·(this.lock)·{ | 1044 | ············synchronized·(this.lock)·{ |
988 | ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE); | 1045 | ················final·Optional·transform·=·Optional.fromNullable((Object)this.annotatorModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE); |
989 | ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE); | 1046 | ················final·Optional·transform2·=·Optional.fromNullable((Object)this.langIdModelInUse).transform((com.google.common.base.Function)-$$Lambda$2YrDcjRKLOb8HwDLV5g9t6JgsSg.INSTANCE); |
990 | ················//·monitorexit(this.lock) | 1047 | ················//·monitorexit(this.lock) |
991 | ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·currentTimeMillis,·transform,·transform2); | 1048 | ················this.generateLinksLogger.logGenerateLinks(textLinks$Request.getText(),·build,·s2,·currentTimeMillis2·-·n,·transform,·transform2); |
992 | ················return·build; | 1049 | ················return·build; |
993 | ············} | 1050 | ············} |
994 | ········} | 1051 | ········} |
995 | ········finally·{ | 1052 | ········finally·{ |
996 | ············final·Throwable·t; | 1053 | ············final·Throwable·t; |
997 | ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t); | 1054 | ············TcLog.e("TextClassifierImpl",·"Error·getting·links·info.",·t); |
998 | ············return·this.fallback.generateLinks(textLinks$Request); | 1055 | ············return·this.fallback.generateLinks(textLinks$Request); |
Offset 1019, 15 lines modified | Offset 1076, 15 lines modified |
1019 | ········Preconditions.checkNotNull((Object)conversationActions$Request); | 1076 | ········Preconditions.checkNotNull((Object)conversationActions$Request); |
1020 | ········checkMainThread(); | 1077 | ········checkMainThread(); |
1021 | ········try·{ | 1078 | ········try·{ |
1022 | ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl(); | 1079 | ············final·ActionsSuggestionsModel·actionsImpl·=·this.getActionsImpl(); |
1023 | ············if·(actionsImpl·==·null)·{ | 1080 | ············if·(actionsImpl·==·null)·{ |
1024 | ················return·this.fallback.suggestConversationActions(conversationActions$Request); | 1081 | ················return·this.fallback.suggestConversationActions(conversationActions$Request); |
1025 | ············} | 1082 | ············} |
1026 | ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(java.util.function.Function)new·-$$Lambda$TextClassifierImpl$8TEt_aVD6KfKHt3Yd93I5TAKLlc(this,·this.getLangIdImpl())); | 1083 | ············final·ActionsSuggestionsModel$ConversationMessage[]·nativeMessages·=·ActionsSuggestionsHelper.toNativeMessages(conversationActions$Request.getConversation(),·(Function)new·-$$Lambda$TextClassifierImpl$vIDgmWc1v5udtaerRtDyTyU4pws(this,·this.getLangIdImpl())); |
1027 | ············if·(nativeMessages.length·==·0)·{ | 1084 | ············if·(nativeMessages.length·==·0)·{ |
1028 | ················return·this.fallback.suggestConversationActions(conversationActions$Request); | 1085 | ················return·this.fallback.suggestConversationActions(conversationActions$Request); |
1029 | ············} | 1086 | ············} |
1030 | ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault()))); | 1087 | ············return·this.createConversationActionResult(conversationActions$Request,·actionsImpl.suggestActionsWithIntents(new·ActionsSuggestionsModel$Conversation(nativeMessages),·(ActionsSuggestionsModel$ActionSuggestionOptions)null,·(Object)this.context,·this.getResourceLocalesString(),·this.getAnnotatorImpl(LocaleList.getDefault()))); |
1031 | ········} | 1088 | ········} |
1032 | ········finally·{ | 1089 | ········finally·{ |
1033 | ············final·Throwable·t; | 1090 | ············final·Throwable·t; |
Offset 1044, 21 lines modified | Offset 1101, 26 lines modified |
1044 | ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex(); | 1101 | ············final·int·n·=·textSelection$Request.getEndIndex()·-·textSelection$Request.getStartIndex(); |
1045 | ············final·String·string·=·textSelection$Request.getText().toString(); | 1102 | ············final·String·string·=·textSelection$Request.getText().toString(); |
1046 | ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{ | 1103 | ············if·(string.length()·>·0·&&·n·<=·this.settings.getSuggestSelectionMaxRangeLength())·{ |
1047 | ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales()); | 1104 | ················final·String·concatenateLocales·=·concatenateLocales(textSelection$Request.getDefaultLocales()); |
1048 | ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText())); | 1105 | ················final·String·join·=·String.join(",",·(Iterable<?·extends·CharSequence>)this.detectLanguageTags(this.getLangIdImpl(),·textSelection$Request.getText())); |
1049 | ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault()); | 1106 | ················final·ZonedDateTime·now·=·ZonedDateTime.now(ZoneId.systemDefault()); |
1050 | ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales()); | 1107 | ················final·AnnotatorModel·annotatorImpl·=·this.getAnnotatorImpl(textSelection$Request.getDefaultLocales()); |
1051 | ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·AnnotatorModel$SelectionOptions.builder().setLocales(concatenateLocales).setDetectedTextLanguageTags(join).build()); | 1108 | ················final·int[]·suggestSelection·=·annotatorImpl.suggestSelection(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex(),·new·AnnotatorModel$SelectionOptions(concatenateLocales,·join)); |
1052 | ················int·i·=·0; | 1109 | ················int·i·=·0; |
1053 | ················final·int·n2·=·suggestSelection[0]; | 1110 | ················final·int·n2·=·suggestSelection[0]; |
1054 | ················final·int·n3·=·suggestSelection[1]; | 1111 | ················final·int·n3·=·suggestSelection[1]; |
1055 | ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{ | 1112 | ················if·(n2·<·n3·&&·n2·>=·0·&&·n3·<=·string.length()·&&·n2·<=·textSelection$Request.getStartIndex()·&&·n3·>=·textSelection$Request.getEndIndex())·{ |
1056 | ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3); | 1113 | ····················final·TextSelection$Builder·textSelection$Builder·=·new·TextSelection$Builder(n2,·n3); |
1057 | ····················for·(AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·n2,·n3,·AnnotatorModel$ClassificationOptions.builder().setReferenceTimeMsUtc(now.toInstant().toEpochMilli()).setReferenceTimezone(now.getZone().getId()).setLocales(concatenateLocales).setDetectedTextLanguageTags(join).setUserFamiliarLanguageTags(LocaleList.getDefault().toLanguageTags()).build(),·(Object)null,·(String)null);·i·<·classifyText.length;·++i)·{ | 1114 | ····················final·long·epochMilli; |
| 1115 | ····················final·String·id; |
| 1116 | ····················final·AnnotatorModel$ClassificationOptions·annotatorModel$ClassificationOptions·=·new·AnnotatorModel$ClassificationOptions(epochMilli,·id,·concatenateLocales,·join); |
| 1117 | ····················epochMilli·=·now.toInstant().toEpochMilli(); |
| 1118 | ····················id·=·now.getZone().getId(); |
| 1119 | ····················for·(AnnotatorModel$ClassificationResult[]·classifyText·=·annotatorImpl.classifyText(string,·n2,·n3,·annotatorModel$ClassificationOptions,·(Object)null,·(String)null);·i·<·classifyText.length;·++i)·{ |
1058 | ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore()); | 1120 | ························textSelection$Builder.setEntityType(classifyText[i].getCollection(),·classifyText[i].getScore()); |
1059 | ····················} | 1121 | ····················} |
1060 | ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build(); | 1122 | ····················return·textSelection$Builder.setId(this.createAnnotatorId(string,·textSelection$Request.getStartIndex(),·textSelection$Request.getEndIndex())).build(); |
1061 | ················} | 1123 | ················} |
1062 | ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result."); | 1124 | ················TcLog.d(s,·"Got·bad·indices·for·input·text.·Ignoring·result."); |
1063 | ············} | 1125 | ············} |
1064 | ········} | 1126 | ········} |