Skip to content

Added function ngram - #29738

Merged
kitaisreal merged 4 commits into
ClickHouse:masterfrom
kitaisreal:added-function-ngram
Oct 7, 2021
Merged

kitaisreal merged 4 commits into
ClickHouse:masterfrom
kitaisreal:added-function-ngram

Conversation

@kitaisreal

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added function ngram. Closes #29699.

@robot-clickhouse robot-clickhouse added doc-alert pr-feature Pull request with new product feature labels Oct 4, 2021
@kitaisreal
kitaisreal merged commit 4ec7311 into ClickHouse:master Oct 7, 2021
@alexey-milovidov

Copy link
Copy Markdown
Member

Maybe also add a function to extract tokens exactly as token bloom filter does?

@gyuton

gyuton commented Oct 12, 2021

Copy link
Copy Markdown
Contributor

Internal documentation ticket: DOCSUP-16362.

@alexey-milovidov

Copy link
Copy Markdown
Member

It does not work:

milovidov-desktop :) SELECT ngrams('I 💖 ClickHouse', 3);

SELECT ngrams('I 💖 ClickHouse', 3)

Query id: 73750a5d-3594-481b-8f64-561fab3d5ebb


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 21.12.1):
Code: 131. DB::Exception: Received from localhost:9000. DB::Exception: Too large string for FixedString column: While processing ngrams('I 💖 ClickHouse', 3). (TOO_LARGE_STRING_SIZE)

milovidov-desktop :) SELECT ngrams('Я/Мы ClickHouse', 3);

SELECT ngrams('Я/Мы ClickHouse', 3)

Query id: 199e9389-016e-492d-9051-4893128bc994


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 21.12.1):
Code: 131. DB::Exception: Received from localhost:9000. DB::Exception: Too large string for FixedString column: While processing ngrams('Я/Мы ClickHouse', 3). (TOO_LARGE_STRING_SIZE)

milovidov-desktop :) SELECT ngramsUTF8('I 💖 ClickHouse', 3);

SELECT ngramsUTF8('I 💖 ClickHouse', 3)

Query id: 7ad24086-b5de-41b4-85e2-a0c2a5222200


0 rows in set. Elapsed: 0.017 sec. 

Received exception from server (version 21.12.1):
Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Unknown function ngramsUTF8: While processing ngramsUTF8('I 💖 ClickHouse', 3). (UNKNOWN_FUNCTION)

Let's make two functions: ngrams and ngramsUTF8. ngrams is splitting by bytes. ngramsUTF8 is splitting by code points and always returns String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A function to extract ngrams from string

4 participants