sql - n-grams from text in PostgreSQL -


I am looking to create anagram from text column in PostgreSQL. I currently split the (white-space) data (sentence) into an array in a text column.

Enter the code here from the regexp_split_to_array (syntax, e '\ s +'), the name of the table

Once I have this array, How do I want to go about this:

  • Create a loop to find anagram, and write in another table in each table

Unnest Use I can get all the elements of all arrays on different arrays, and maybe I can think of a way to get an N-gram from a column I am, but I opened it to the sentence limitations which are wise to preserve me.

Sample SQL code for PostgreSQL to emulate the above scenario

  Create table table (syntax text); Insert table (syntax) value ('this is a long sentence'); Include the tablename (syntax) values ​​('I'm currently grammatical, I'm killing this monster book BTW!'); Insert in the table (syntax) value ('Just tons of grammar, the problem I bought in Taiwan, and therefore there is no engine, just Chinese and Japanese'); Select regexp_split_to_array (sentenceData, E '\\ s +') from tableName; Select unnest (regexp_split_to_array (syntax, e '\\ s +') from the template name;  

check out: "pg_trgm module to determine the likelihood of text work and The operator provides Trigram based on Milan, as well as the index operator class which supports faster searching for similar strings. "


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -