ExtractSentence
Returns the specified sentence from a body of text.
Syntax
ExtractSentence(text ,sentence [, language] [USING PARAMETERS [ filterlinks =boolean ] [, filterusermentions =boolean ] [, filterhashtags =boolean ] [, adjustcasing = boolean ] [, language = string ] ])
Parameters
Argument | Description |
---|---|
|
The text containing the sentence to extract. |
language |
The language:
|
|
Integer value. The number of the sentence in the |
|
Optional. Default false. When set to true, sentences that are only links are skipped over and ignored. Any links in a sentence are not included in the extracted sentence. |
|
Optional. Default false. When set to true, sentences that are only Twitter user mentions (@username) are skipped over and ignored. Any user-mentions in a sentence are not included in the extracted sentence. |
|
Optional. Default false. When set to true, sentences that are only Twitter hashtags (#hashtag) are skipped over and ignored. Any hashtags in a sentence are not included in the extracted sentence. |
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 ExtractSentence('The quick brown fox jumped. Every good boy deserves fudge', 2) OVER(PARTITION BEST); sentence -------------------------------- Every good boy deserves fudge. (1 row) select extractSentence('the quick brown fox jumped over the lazy dog. All good boys deserve fudge' , 2, 'english') over(); sentence ----------------------------- All good boys deserve fudge (1 row) select extractSentence('the quick brown fox jumped over the lazy dog. All good boys deserve fudge' ,2 using parameters language='english') over(); sentence ----------------------------- All good boys deserve fudge (1 row) select extractSentence('el zorro rapido brinco sobre el perro flojo. Todos los chicos buenos merecen un premio' , 2, 'spanish') over(); sentence ------------------------------------------- Todos los chicos buenos merecen un premio (1 row) select extractSentence('el zorro rapido brinco sobre el perro flojo. Todos los chicos buenos merecen un premio' ,2 using parameters language='spanish') over(); sentence ------------------------------------------- Todos los chicos buenos merecen un premio (1 row)
Filtering Links
SELECT ExtractSentence('HP - http://hp.com is a useful website. I
like HP.', 1 USING PARAMETERS filterlinks=true) OVER(PARTITION BEST); sentence ---------------------------- hp - is a useful website. (1 row)