@@ -1334,6 +1334,14 @@ TEST_F(UserHistoryPredictorTest, UserHistoryPredictorClearTest) {
1334
1334
predictor->ClearAllHistory ();
1335
1335
WaitForSyncer (predictor);
1336
1336
1337
+ {
1338
+ SegmentsProxy segments_proxy;
1339
+ const ConversionRequest convreq1 =
1340
+ SetUpInputForSuggestion (" t" , &composer_, &segments_proxy);
1341
+ results = predictor->Predict (convreq1);
1342
+ EXPECT_TRUE (results.empty ());
1343
+ }
1344
+
1337
1345
// input "testtest" 1 time
1338
1346
for (int i = 0 ; i < 1 ; ++i) {
1339
1347
SegmentsProxy segments_proxy;
@@ -1349,12 +1357,6 @@ TEST_F(UserHistoryPredictorTest, UserHistoryPredictorClearTest) {
1349
1357
const ConversionRequest convreq1 =
1350
1358
SetUpInputForSuggestion (" t" , &composer_, &segments_proxy);
1351
1359
results = predictor->Predict (convreq1);
1352
- EXPECT_TRUE (results.empty ());
1353
-
1354
- segments_proxy.Clear ();
1355
- const ConversionRequest convreq2 =
1356
- SetUpInputForSuggestion (" testte" , &composer_, &segments_proxy);
1357
- results = predictor->Predict (convreq2);
1358
1360
EXPECT_FALSE (results.empty ());
1359
1361
}
1360
1362
}
@@ -1752,7 +1754,7 @@ TEST_F(UserHistoryPredictorTest, MultiSegmentsMultiInput) {
1752
1754
const ConversionRequest convreq2 =
1753
1755
SetUpInputForSuggestion (" た" , &composer_, &segments_proxy);
1754
1756
results = predictor->Predict (convreq2);
1755
- EXPECT_TRUE (results.empty ());
1757
+ EXPECT_FALSE (results.empty ()); // "たろう"
1756
1758
1757
1759
segments_proxy.Clear ();
1758
1760
const ConversionRequest convreq3 =
@@ -1867,7 +1869,7 @@ TEST_F(UserHistoryPredictorTest, MultiSegmentsSingleInput) {
1867
1869
const ConversionRequest convreq3 =
1868
1870
SetUpInputForSuggestion (" た" , &composer_, &segments_proxy);
1869
1871
results = predictor->Predict (convreq3);
1870
- EXPECT_TRUE (results.empty ());
1872
+ EXPECT_FALSE (results.empty ()); // たろうは
1871
1873
1872
1874
segments_proxy.Clear ();
1873
1875
const ConversionRequest convreq4 =
@@ -2444,38 +2446,17 @@ TEST_F(UserHistoryPredictorTest, GetResultType) {
2444
2446
.SetRequestType (ConversionRequest::SUGGESTION)
2445
2447
.Build ();
2446
2448
2449
+ // Always return GOOD_RESULT
2447
2450
entry.set_bigram_boost (true );
2448
- EXPECT_EQ (
2449
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2450
- ResultType::GOOD_RESULT);
2451
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 1 , entry),
2452
+ ResultType::GOOD_RESULT);
2451
2453
2452
2454
entry.set_bigram_boost (false );
2453
-
2454
- // const uint32_t freq = entry.suggestion_freq();
2455
- // const uint32_t base_prefix_len = 3 - std::min<uint32_t>(2, freq);
2456
- // if (request_key_len >= base_prefix_len) {
2457
- // 3 >= 3 - min(2, 1) -> OK
2458
- entry.set_suggestion_freq (1 );
2459
- EXPECT_EQ (
2460
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 3 , entry),
2461
- ResultType::GOOD_RESULT);
2462
-
2463
- // 1 >= 3 - min(2, 1) -> NG
2464
- entry.set_suggestion_freq (1 );
2465
- EXPECT_EQ (
2466
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2467
- ResultType::BAD_RESULT);
2468
-
2469
- // 1 >= 3 - min(2, 2) -> OK
2470
2455
entry.set_suggestion_freq (1 );
2471
- EXPECT_EQ (
2472
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2473
- ResultType::BAD_RESULT);
2474
-
2475
- entry.set_suggestion_freq (1 );
2476
- EXPECT_EQ (
2477
- UserHistoryPredictorTestPeer::GetResultType (convreq, true , 1 , entry),
2478
- ResultType::STOP_ENUMERATION);
2456
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 3 , entry),
2457
+ ResultType::GOOD_RESULT);
2458
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 1 , entry),
2459
+ ResultType::GOOD_RESULT);
2479
2460
}
2480
2461
2481
2462
// mobile
@@ -2488,21 +2469,18 @@ TEST_F(UserHistoryPredictorTest, GetResultType) {
2488
2469
// entry.suggestion_freq() < 2 && Util::CharsLen(entry.value()) > 8
2489
2470
entry.set_suggestion_freq (1 );
2490
2471
entry.set_value (" よろしく" );
2491
- EXPECT_EQ (
2492
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2493
- ResultType::GOOD_RESULT);
2472
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 1 , entry),
2473
+ ResultType::GOOD_RESULT);
2494
2474
2495
2475
entry.set_suggestion_freq (2 ); // high freq
2496
2476
entry.set_value (" よろしくおねがいします。" ); // too long
2497
- EXPECT_EQ (
2498
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2499
- ResultType::GOOD_RESULT);
2477
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 1 , entry),
2478
+ ResultType::GOOD_RESULT);
2500
2479
2501
2480
entry.set_suggestion_freq (1 ); // low freq
2502
2481
entry.set_value (" よろしくおねがいします。" ); // too long
2503
- EXPECT_EQ (
2504
- UserHistoryPredictorTestPeer::GetResultType (convreq, false , 1 , entry),
2505
- ResultType::BAD_RESULT);
2482
+ EXPECT_EQ (UserHistoryPredictorTestPeer::GetResultType (convreq, 1 , entry),
2483
+ ResultType::BAD_RESULT);
2506
2484
}
2507
2485
}
2508
2486
0 commit comments