" return [alist[i] for i in top_idxs] # 返回相似度最高的问题对应的答案,作为TOP5答案 "
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": 567,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[['in the late 1990s'], ['Dangerously in Love Tour'], ['Particularly since the 1950s, pro wrestling events have frequently been responsible for sellout crowds at large arenas'], ['her mother'], ['Germany, the Netherlands, Switzerland, Latvia, Estonia and Hungary']]\n",
"[['in the later 19th century'], ['Tags'], ['Ashoka'], ['economic, social, and cultural'], ['water buffalo']]\n"
]
}
],
"source": [
"source": [
"# TODO: 编写几个测试用例,并输出结果\n",
"# TODO: 编写几个测试用例,并输出结果\n",
"print (get_top_results_tfidf_noindex(\"\"))\n",
"print(get_top_results_tfidf_noindex(\"when beyonce start become popular?\"))\n",
"print (get_top_results_tfidf_noindex(\"\"))"
"print(get_top_results_tfidf_noindex(\"where jordge come from\"))"