IInkRecognitionResult::GetAlternatesFromSelection method

Returns the alternate collection from a selection within the best result string of the recognition result so that each alternate corresponds to only one segment of ink.

Syntax

HRESULT GetAlternatesFromSelection(
  [in, optional] long                      selectionStart,
  [in, optional] long                      selectionLength,
  [in, optional] long                      maximumAlternates,
  [out, retval]  IinkRecognitionAlternates **AlternatesFromSelection
);

Parameters

  • selectionStart [in, optional]
    Optional. The start of the text selection from which the collection of alternates is returned. The default value is IRAS_Start.

  • selectionLength [in, optional]
    Optional. The length of the text selection from which the collection of alternates is returned. The default value is IRAS_All, which specifies the text beginning from selectionStart to the end of the string.

  • maximumAlternates [in, optional]
    Optional. The maximum number of alternates to return. The default value is IRAS_DefaultCount. Recognizers that cannot compute the number of alternates, because of degree of difficulty or length of time, return an arbitrary number of alternates.

    Note  The number of alternates increases exponentially for large ranges and for some languages, so applications should specify the number of alternates rather than query for the maximum number of alternates that the recognizer can return.

     

  • AlternatesFromSelection [out, retval]
    When this method returns, contains a pointer to the IInkRecognitionAlternates collection of alternates from a selection within the best result string of the recognition result.

Return value

This method can return one of these values.

Return code Description
S_OK

Success.

E_INVALIDARG

The recognition range is invalid.

E_INK_EXCEPTION

An exception occurred while processing.

E_POINTER

A parameter contained an invalid pointer.

E_OUTOFMEMORY

Cannot allocate memory to complete the operation.

 

Remarks

The selection "how are you" is probably broken into three segments (depending on the spacing between segments), one for each word. Call AlternatesFromSelection to return the alternates for only one segment of this selection. Note that the selectionStart and selectionLength indices correspond to the character index, not a segment index. So to get the alternates from the word "are", call AlternatesFromSelection with the parameters of selectionStart = 4 and selectionLength = 3, since the word "are" starts at the 4th character (beginning at 0) and is 3 characters long.

Note the difference between this AlternatesFromSelection method and the AlternatesWithConstantPropertyValues, LineAlternates, and ConfidenceAlternates methods of the IInkRecognitionAlternate object. Although AlternatesFromSelection returns a collection of alternates in which each alternate corresponds to only one segment of ink within a selection, AlternatesWithConstantPropertyValues, LineAlternates, and ConfidenceAlternates return the collection of alternates in which the alternates correspond to each segment of ink within a selection.

Note  This method throws an invalid argument exception if the selectionLength is zero.

 

Requirements

Minimum supported client

Windows XP Tablet PC Edition [desktop apps only]

Minimum supported server

None supported

Header

Msinkaut.h (also requires Msinkaut_i.c)

Library

InkObj.dll

See also

IInkRecognitionResult Interface

IInkRecognitionAlternates Interface