是否有可能从Google表格的不同列中的不同句子中找到尽可能多的匹配词?

问题描述 投票:1回答:1

[A和B列中有句子。我正在尝试找出哪些单词具有最匹配的句子,并从B列中返回该句子。

+-----------------------+-----------------------+----------------------+
|Column A               |Column B               |Return most matched   |
+-----------------------+-----------------------+----------------------+
|this is a black car    |Twinkle little star    |that is a black couch |
+-----------------------+-----------------------+----------------------+
|there is a red cat     |London Bridge is Fallin|red cat is in the hat |
+-----------------------+-----------------------+----------------------+
|I see a twinkle star   |red cat is in the hat  |Twinkle little star   | 
+-----------------------+-----------------------+----------------------+
|London tower is standin|that is a black couch  |London Bridge is Fallin
+-----------------------+-----------------------+----------------------+

这里是初学者电子表格程序员。不知道这是否可能?有人可以指出正确的方向吗?

我用Google搜索了很多匹配单个单词但不匹配句子中最匹配的单词。

regex google-sheets google-sheets-formula array-formulas google-sheets-query
1个回答
1
投票
粘贴

C2并向下拖动:

=ARRAYFORMULA(QUERY({B$2:B, MMULT(IFERROR(--REGEXMATCH(SPLIT(LOWER(B$2:B), " "), "^"&SUBSTITUTE(LOWER(A2), " ", "$|^")&"$"), 0), ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(B$2:B, " "))))^0)}, "select Col1 order by Col2 desc limit 1", 0))
0
© www.soinside.com 2019 - 2024. All rights reserved.