在语义数据库中想要得到conatins表中每个单词的等级 [英] in semantic database want to get rank of every word in conatins table
本文介绍了在语义数据库中想要得到conatins表中每个单词的等级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在semanctic数据库中:
In semanctic database:
set @str='java and sql and unix devloper or php and fox devloper'
SELECT K.RANK, AddressLine1, City
FROM Person.Address AS A
INNER JOIN
CONTAINSTABLE(Person.Address, AddressLine1,@str) AS K
ON A.AddressID = K.[KEY]
以上代码在字符串str传递给函数 CONTAINSTABLE
时获取完整字符串的等级。
但我需要它将所有单词分开并取出所有单词的等级。分隔符应为' AND
'或'或
'。
输出格式应为格式像这样的每个单词的等级等级
above code fetches the rank of complete string when string str is passed to function CONTAINSTABLE
.
but I need it separates all the words and fetches the rank of all the words. Separator should be 'AND
' or 'OR
'.
Output should be in format of commseperated rank with every word like this
word rank
java 23
sql 21
unix devloper 20
php 30
fox devloper 23
我想获得每个单词的排名。请帮助我。
I want to get rank of every word. Please help me.
推荐答案
我几乎可以肯定,使用CONTAINSTABLE
语句是不可能实现的。实现这一目标的唯一方法是编写自定义函数,它将获得逗号分隔的单词列表,并返回一个记录中每个单词出现的总和。
I发现这个: c# - SQL Server的最佳方法匹配单词短语和顺序相关 - Stack Overflow [ ^ ]。最有价值答案的作者(4个upvotes)显示了如何从搜索表的特定列中的句子中获取每个单词的出现次数的方法。
这个可能也会有所帮助:
量化TSQL中的文本差异 [ ^ ]
模式匹配:格式塔方法| Dobb博士 [ ^ ]
使用RANK限制搜索结果 [ ^ ] - 搜索查询结果如何排名部分。
I'm almost sure it's impossible to achieve by usingCONTAINSTABLE
statement. The only way to achieve that is to write custom function which will get comma-separated list of words and return the sum of occurrences of each word in one record.
I found this: c# - SQL Server best method to match word phrases and order relevence - Stack Overflow[^]. An author of most valuable answer (4 upvotes) shows a way how to get the number of occurrences of each word from sentence in a specific column of searched table.
This might be helpful too:
Quantifying Text differences in TSQL[^]
Pattern Matching: the Gestalt Approach | Dr Dobb's[^]
Limit Search Results with RANK[^] - How Search Query Results Are Ranked section.
这篇关于在语义数据库中想要得到conatins表中每个单词的等级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文