Fel*_*ffa 11
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
Run Code Online (Sandbox Code Playgroud)
现在有一个新功能ML.NGRAMS()::
WITH data AS (
SELECT REGEXP_EXTRACT_ALL(LOWER(title), '[a-z]+') title_arr
FROM `fh-bigquery.reddit_posts.2019_08`
WHERE title LIKE '% %'
AND score>1
)
SELECT APPROX_TOP_COUNT(bigram, 10) top
FROM (
SELECT ML.NGRAMS(title_arr, [2,2]) x
FROM data
), UNNEST(x) bigram
WHERE LENGTH(bigram) > 10
Run Code Online (Sandbox Code Playgroud)
文件:
| 归档时间: |
|
| 查看次数: |
2611 次 |
| 最近记录: |