IWordBreaker::BreakText Method
Parses text to identify words and phrases and provides the results to the WordSink and PhraseSink objects.
Syntax
HRESULT BreakText( TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink );
Parameters
- pTextSource
[in] Pointer to a TEXT_SOURCE structure that contains Unicode text.- pWordSink
[in] Pointer to the WordSink object that receives and handles words generated by this method. NULL indicates that this method identifies phrases only.- pPhraseSink
[in] Pointer to the PhraseSink object that receives and handles phrases generated by this method. NULL indicates that this method identifies individual words, not phrases.
Return Value
Returns one of the following values.
S_OK Operation was successful. No more text is available to refill the pTextSource buffer. E_INVALIDARG Invalid argument. The pTextSource parameter is NULL.
Remarks
This method should be optimized for pPhraseSink = 0 because word breakers more commonly parse for individual words than phrases. Either pWordSink or pPhraseSink may be NULL, but not both.
Use pfnFillTextBuffer, the function pointer element in the TEXT_SOURCE structure, to replenish the source text. The IWordBreaker::BreakText method must handle all pfnFillTextBuffer return values. If an error occurs, finish processing the text in the buffer before handling the error.
See Also
Implementing a Word Breaker, Language Resource Samples, PhraseSink, Secure Code Practices, TEXT_SOURCE, WordSink