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

text

The text containing the sentence to extract.

language

The language:

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

sentence

Integer value. The number of the sentence in the text .

filterlinks

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.

filterusermentions

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.

filterhashtags

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

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)

See Also