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

text

The text from which to extract the attributes.

language

The language:

  • 'english' or 'en'
  • 'spanish' or 'es'

whitelistonly

Optional. Default false. When set to true only attributes defined in the white_list user-dictionary are returned.

filterlinks

Optional. Default false. When set to true, links are not set as attributes.

filterusermentions

Optional. Default false. When set to true, Twitter usernames (@username) are not set as attributes.

filterhashtags

Optional. Default false. When set to true, removes the following from tweets:

  • hashtag symbols - For example, #pizza becomes pizza.
  • @mentions - For example, Vertica would remove @NewYorkCity from a tweet.
  • Link URLs
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

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)

See Also