文章相關度匹配的一些思路---"壓縮"預料庫,即提取用特征詞或詞頻,量化後以“列向量”形式保存到數據庫;按前N組詞拼為向量組供查詢使用,即組合為1到N字的組合,量化後以“行向量”形式保存到數據庫(目前是用MYSQL),計算和查詢相似度的時候先提取特征,然後量化,再查詢各Long型數值字段,速度應該會較一般查詢要快一些。
應用舉例:[這些都是推測,實際希望會有比較好的結果]
假設查詢以下特征
Dictionary<string, int> words = new Dictionary<string, int>(); words.Add("五筆", 1); words.Add("拼音", 1); words.Add("筆畫", 1); words.Add("其它", 1); words.Add("英盤", 1); words.Add("美盤", 1); words.Add("法盤", 1); //List<Dictionary<int, long>> WordList = new List<Dictionary<int, long>>(); //for (int i = 0; i < 15; i++) //{ // WordList.Add(GetWordSecurity(words, i + 1)); //} //直觀看數據 Dictionary<int, long> R1 = GetWordSecurity(words, 1); Dictionary<int, long> R2 = GetWordSecurity(words, 2); Dictionary<int, long> R3 = GetWordSecurity(words, 3); Dictionary<int, long> R4 = GetWordSecurity(words, 4); Dictionary<int, long> R5 = GetWordSecurity(words, 5); Dictionary<int, long> R6 = GetWordSecurity(words, 6); Dictionary<int, long> R7 = GetWordSecurity(words, 7); Dictionary<int, long> R8 = GetWordSecurity(words, 8); Dictionary<int, long> R9 = GetWordSecurity(words, 9); Dictionary<int, long> R10 = GetWordSecurity(words, 10); Dictionary<int, long> R11 = GetWordSecurity(words, 11); Dictionary<int, long> R12 = GetWordSecurity(words, 12); Dictionary<int, long> R13 = GetWordSecurity(words, 13); Dictionary<int, long> R14 = GetWordSecurity(words, 14);
量化數據,可以任選一種方式處理
五筆 -8683246507546018072 拼音 5720075168044685354 筆畫 6444854990336207024 其它 -4797408270696495584 英盤 -1741849883950345011 美盤 4116094244106799890 法盤 5071717547464226258
查詢以下數值:
二字詞 Dictionary<int, long> R1 = GetWordSecurity(words, 1); + [0] {[1, -2963171339501332718]} System.Collections.Generic.KeyValuePair<int,long> + [1] {[2, -2238391517209811048]} System.Collections.Generic.KeyValuePair<int,long> + [2] {[3, 4966089295467037960]} System.Collections.Generic.KeyValuePair<int,long> + [3] {[4, -6281813915328659238]} System.Collections.Generic.KeyValuePair<int,long> + [4] {[5, 922666897348189770]} System.Collections.Generic.KeyValuePair<int,long> + [5] {[6, 3978225284094340343]} System.Collections.Generic.KeyValuePair<int,long> + [6] {[7, -8610574661558066372]} System.Collections.Generic.KeyValuePair<int,long> Dictionary<int, long> R2 = GetWordSecurity(words, 2);