该练习题来的很蹊跷,笔者在看entity embeddings的东西,于是看到了16年的这篇文章:Learning Query and Document Relevance from a Web-scale Click Graph,想试试效果,就搜到了qdr这个项目,然后试了试,虽然entity embeddings做的不好,但是好像可以依据里面的文本匹配搞搞问答,于是花了一点时间,因为是cython,速度还不错,可以做个简单的demo,于是有了该篇练习。
该项目qdr:Query-Document Relevance ranking functions,包含了以下几类文本权值表示方式:
- TF-IDF
- Okapi BM25
- Language Model
内嵌Cython 处理速度不错,有一些参数可以自行看着调整:
- For TF-IDF see Salton and Buckley, “Term-weighting approaches in automatic text retrieval” (“best fully weighted system tfc * nfx” (Table 2, first line))
- For Okapi BM25, see “An Introduction to Information Retrieval” by Manning et al. (Section 11.4.3 (page 233), eqn
11.32). - For the Language Model approach, see Zhai and Lafferty “A Study of Smoothing Methods for Language Models Applied to Ad Hoc Information Retrieval”
可能项目底层技术本身在热火朝天的QA中,各种高大上的embedding然后进行DSSM匹配比起来,很low,但很高效/简单,而且项目虽小,五脏俱全,入门极佳~