Python - 计算文本搜索相关性评分的库

1 投票
1 回答
1610 浏览
提问于 2025-04-16 02:13

我的想法是实现一个和MySQL中的MATCH / AGAINST关键词类似的功能。

你知道有没有什么Python库可以用来计算文本搜索的相关性得分吗?

如果没有让我满意的答案,我打算使用一个Python连接器来连接MySQL。

1 个回答

1

看看 PyLucene 这个东西,地址是 http://lucene.apache.org/pylucene/

import os, sys, unittest, lucene
lucene.initVM()

baseDir = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(baseDir)

import lia.searching.ScoreTest
from lucene import System

System.setProperty("index.dir", os.path.join(baseDir, 'index'))
unittest.main(lia.searching.ScoreTest)

你可以在这里找到更多的例子和资料:http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/

撰写回答