Fixes datetime model overtriggering, sms shortcodes being linkified to
maps, not recognizing certain phone number formats, and incorrect date
jumps when the granularity of the date is less than a day, and incorrect
start of week for non-US locales.
(Developed in Google3, synced using export_to_aosp.sh script)
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Bug: 77799341
Bug: 76199334
Bug: 77800082
Change-Id: Ib23bc27c63ff69673532851254f2800108e74dda
diff --git a/feature-processor_test.cc b/feature-processor_test.cc
index 70ef0a7..58b3033 100644
--- a/feature-processor_test.cc
+++ b/feature-processor_test.cc
@@ -588,10 +588,6 @@
EXPECT_TRUE(feature_processor.IsCodepointInRanges(
25000, feature_processor.supported_codepoint_ranges_));
- std::unique_ptr<CachedFeatures> cached_features;
-
- FakeEmbeddingExecutor embedding_executor;
-
const std::vector<Token> tokens = {Token("ěěě", 0, 3), Token("řřř", 4, 7),
Token("eee", 8, 11)};
@@ -601,11 +597,8 @@
TestingFeatureProcessor feature_processor2(
flatbuffers::GetRoot<FeatureProcessorOptions>(options2_fb.data()),
&unilib);
- EXPECT_TRUE(feature_processor2.ExtractFeatures(
- tokens, /*token_span=*/{0, 3},
- /*selection_span_for_feature=*/{kInvalidIndex, kInvalidIndex},
- &embedding_executor, /*embedding_cache=*/nullptr,
- /*feature_vector_size=*/4, &cached_features));
+ EXPECT_TRUE(feature_processor2.HasEnoughSupportedCodepoints(
+ tokens, /*token_span=*/{0, 3}));
options.min_supported_codepoint_ratio = 0.2;
flatbuffers::DetachedBuffer options3_fb =
@@ -613,11 +606,8 @@
TestingFeatureProcessor feature_processor3(
flatbuffers::GetRoot<FeatureProcessorOptions>(options3_fb.data()),
&unilib);
- EXPECT_TRUE(feature_processor3.ExtractFeatures(
- tokens, /*token_span=*/{0, 3},
- /*selection_span_for_feature=*/{kInvalidIndex, kInvalidIndex},
- &embedding_executor, /*embedding_cache=*/nullptr,
- /*feature_vector_size=*/4, &cached_features));
+ EXPECT_TRUE(feature_processor3.HasEnoughSupportedCodepoints(
+ tokens, /*token_span=*/{0, 3}));
options.min_supported_codepoint_ratio = 0.5;
flatbuffers::DetachedBuffer options4_fb =
@@ -625,11 +615,8 @@
TestingFeatureProcessor feature_processor4(
flatbuffers::GetRoot<FeatureProcessorOptions>(options4_fb.data()),
&unilib);
- EXPECT_FALSE(feature_processor4.ExtractFeatures(
- tokens, /*token_span=*/{0, 3},
- /*selection_span_for_feature=*/{kInvalidIndex, kInvalidIndex},
- &embedding_executor, /*embedding_cache=*/nullptr,
- /*feature_vector_size=*/4, &cached_features));
+ EXPECT_FALSE(feature_processor4.HasEnoughSupportedCodepoints(
+ tokens, /*token_span=*/{0, 3}));
}
TEST(FeatureProcessorTest, InSpanFeature) {