SimmerChan / KG-demo-for-movie

从无到有构建一个电影知识图谱,并基于该KG,开发一个简易的KBQA程序。
https://zhuanlan.zhihu.com/knowledgegraph
1.28k stars 424 forks source link

Logical error when sorting the query dictionary #6

Closed Terry1004 closed 6 years ago

Terry1004 commented 6 years ago

I looked through part of your source code, and I happened to notice the following at question2sparql.py line 47: sorted_dict = sorted(queries_dict.iteritems(), key=lambda item: item[1]), which would sort the iterator in the ascending order of the query strings. According to the comment above this line, I guess you might be thinking of the following instead: sorted_dict = sorted(queries_dict.iteritems(), key = lambda item: item[0], reverse = True), which would sort the iterator in the descending order of the number of key words matched.

SimmerChan commented 6 years ago

@Terry1004 Just like what you pointed out, I will fix it, thx!