mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
update unittest
This commit is contained in:
parent
4e72d4a06f
commit
2488738b55
@ -20,13 +20,13 @@ TEST(KeywordExtractorTest, Test1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
string s("我毕业于蓝翔,日薪一部iPhone6");
|
string s("一部iPhone6");
|
||||||
string res;
|
string res;
|
||||||
vector<pair<string, double> > wordweights;
|
vector<pair<string, double> > wordweights;
|
||||||
size_t topN = 5;
|
size_t topN = 5;
|
||||||
extractor.extract(s, wordweights, topN);
|
extractor.extract(s, wordweights, topN);
|
||||||
res << wordweights;
|
res << wordweights;
|
||||||
ASSERT_EQ(res, "[\"蓝翔:11.7392\", \"日薪:11.7392\", \"iPhone:11.7392\", \"一部:6.47592\", \"毕业:6.23165\"]");
|
ASSERT_EQ(res, "[\"iPhone:11.7392\", \"一部:6.47592\"]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ TEST(KeywordExtractorTest, Test2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
string s("我毕业于蓝翔,日薪一部iPhone6");
|
string s("一部iPhone6");
|
||||||
string res;
|
string res;
|
||||||
vector<pair<string, double> > wordweights;
|
vector<pair<string, double> > wordweights;
|
||||||
size_t topN = 5;
|
size_t topN = 5;
|
||||||
extractor.extract(s, wordweights, topN);
|
extractor.extract(s, wordweights, topN);
|
||||||
res << wordweights;
|
res << wordweights;
|
||||||
ASSERT_EQ(res, "[\"蓝翔:11.7392\", \"日薪:11.7392\", \"iPhone6:11.7392\", \"一部:6.47592\", \"毕业:6.23165\"]");
|
ASSERT_EQ(res, "[\"iPhone6:11.7392\", \"一部:6.47592\"]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user