gpt4 book ai didi

google-bigquery - 如何使用 BigQuery 查找最常见的二元组?

转载 作者:行者123 更新时间:2023-12-01 18:12:49 25 4
gpt4 key购买 nike

我想在我的表格中找到最常见的二元组(单词对)。如何使用 BigQuery 执行此操作?

最佳答案

BigQuery 现在支持 SPLIT():

SELECT word, nextword, COUNT(*) c 
FROM (
SELECT pos, title, word, LEAD(word) OVER(PARTITION BY created_utc,title ORDER BY pos) nextword FROM (
SELECT created_utc, title, word, pos FROM FLATTEN(
(SELECT created_utc, title, word, POSITION(word) pos FROM
(SELECT created_utc, title, SPLIT(title, ' ') word FROM [bigquery-samples:reddit.full])
), word)
))
WHERE nextword IS NOT null
GROUP EACH BY 1, 2
ORDER BY c DESC
LIMIT 100

关于google-bigquery - 如何使用 BigQuery 查找最常见的二元组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24172994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com