CommentAttributes
Retrieves the attributes (nouns) from a given piece of text.
Syntax
CommentAttributes(text [,language][ USING PARAMETERS
[ whitelistonly =boolean ]
[, filterlinks =boolean ]
[, filterusermentions =boolean ]
[, filterhashtags =boolean ]
[, filterpunctuation = boolean
[, filterretweets = boolean ] [, adjustcasing = boolean ] [, language = string ]])
])
Parameters
Argument | Description |
---|---|
|
The text from which to extract the attributes. |
language |
The language:
|
|
Optional. Default false. When set to true only attributes defined in the white_list user-dictionary are returned. |
|
Optional. Default false. When set to true, links are not set as attributes. |
|
Optional. Default false. When set to true, Twitter usernames (@username) are not set as attributes. |
|
Optional. Default false. When set to true, removes the following from tweets:
|
filterpunctuation
|
Optional. Default true. Filters any punctuation that occurs at the beginning of an attribute other than @ and #. |
filterretweets |
Optional. Defaults to false.Filters out the characters "RT" from re-tweets in attributes. |
adjustcasing | Optional. Defaults to false. When set to true, all letters in the sentence are converted to upper-case before sentence detection. After sentence detection all letters are converted to lower-case. This option is helpful if the original data is all in lower-case and Pulse is incorrectly identifying parts of speech in the sentence. |
Notes
- The text argument is limited to 65,000 bytes.
-
This function must be used with the
over()
clause. Use withOVER(PARTITION BEST)
for the best performance if the query does not require specific columns in theover()
clause. -
language can be specified as an argument and/or as a parameter where the argument value supersedes the parameter value.
Examples
select CommentAttributes('The quick brown fox jumped over the lazy dog. All good boys deserve fudge.') OVER(PARTITION BEST); sentence | attribute ----------+----------- 1 | fox 1 | dog 2 | boys 2 | fudge (4 rows)
select commentattributes('the quick brown fox jumped over the lazy dog. All good boys deserve fudge' ,'english') over(); sentence | attribute ----------+----------- 1 | fox 1 | dog 2 | boys 2 | fudge (4 rows) select commentattributes('the quick brown fox jumped over the lazy dog. All good boys deserve fudge' using parameters language='english') over(); sentence | attribute ----------+----------- 1 | fox 1 | dog 2 | boys 2 | fudge select commentattributes('el zorro rapido brinco sobre el perro flojo. Todos los chicos buenos merecen un premio' ,'spanish') over(); sentence | attribute ----------+----------- 1 | zorro 1 | perro 2 | chicos 2 | premio (4 rows) select commentattributes('el zorro rapido brinco sobre el perro flojo. Todos los chicos buenos merecen un premio' using PARAMETERS language='spanish') over(); sentence | attribute ----------+----------- 1 | zorro 1 | perro 2 | chicos 2 | premio (4 rows)
Filtering User-mentions
SELECT CommentAttributes('@user is always late. He kept me waiting 20 minutes last weekend.' USING PARAMETERS filterusermentions=true) OVER(PARTITION BEST); sentence | attribute ----------+----------- 2 | weekend (1 row)