1

我需要将单词分组为相似,然后找到频率。

所以喜欢的文字"moron and morons sat on moronic bench with mormons"会产生结果

Moron 3
Sat 1
Mormon 1

我需要能够在一个查询中推送文本或确切单词列表,并频繁接收通用单词。

从 C# 开始,可以使用 SQL Server。

4

2 回答 2

2

您可以使用sys.dm_fts_index_keywords_by_document

SELECT * 
FROM sys.dm_fts_index_keywords_by_document(DB_ID('db_name')‌​,OBJECT_ID('tab_name'))
于 2017-08-13T09:20:43.337 回答
0

在 C# 版本中,您可以Regex与 Linq 一起使用;像这样:

var txt = "moron and morons sat on moronic bench with mormons";
var words = Regex.Matches(txt, @"\w+").OfType<Match>().Select(c => c.Value).ToList();
var result = words.Select(c => new {Word = c, Count = words.Count(w => w.Contains(c))})
                  .OrderByDescending(o=> o.Count).ToList();

[ C# Fiddle Demo ]

于 2017-08-13T09:53:58.527 回答