RecognitionResult.GetAlternatesFromSelection - метод (Int32, Int32, Int32)
Обновлен: Ноябрь 2007
Returns the RecognitionAlternates collection from a range within the best result string of the RecognitionResult object, so that each RecognitionAlternate object in the collection corresponds to only one segment of ink. The returned collection is limited to a specified size.
Пространство имен: Microsoft.Ink
Сборка: Microsoft.Ink (в Microsoft.Ink.dll)
Синтаксис
'Декларация
Public Function GetAlternatesFromSelection ( _
selectionStart As Integer, _
selectionLength As Integer, _
maximumAlternates As Integer _
) As RecognitionAlternates
'Применение
Dim instance As RecognitionResult
Dim selectionStart As Integer
Dim selectionLength As Integer
Dim maximumAlternates As Integer
Dim returnValue As RecognitionAlternates
returnValue = instance.GetAlternatesFromSelection(selectionStart, _
selectionLength, maximumAlternates)
public RecognitionAlternates GetAlternatesFromSelection(
int selectionStart,
int selectionLength,
int maximumAlternates
)
public:
RecognitionAlternates^ GetAlternatesFromSelection(
int selectionStart,
int selectionLength,
int maximumAlternates
)
public RecognitionAlternates GetAlternatesFromSelection(
int selectionStart,
int selectionLength,
int maximumAlternates
)
public function GetAlternatesFromSelection(
selectionStart : int,
selectionLength : int,
maximumAlternates : int
) : RecognitionAlternates
Параметры
- selectionStart
Тип: System.Int32
The start of the text selection from which the RecognitionAlternates collection is returned. The default value is 0 (zero).
- selectionLength
Тип: System.Int32
The length of the text selection from which the RecognitionAlternates collection is returned. The default value is –1, which specifies the text beginning from the start of the selection to the end of the string.
- maximumAlternates
Тип: System.Int32
The maximum number of alternates to return. The default value is 10. Recognizers that cannot compute the number of alternates, because of degree of difficulty or length of time, return an arbitrary number of alternates.
Возвращаемое значение
Тип: Microsoft.Ink.RecognitionAlternates
Returns the RecognitionAlternates collection from a selection within the best result string of the RecognitionResult object, so that each RecognitionAlternate object in the collection corresponds to only one segment of ink.
Заметки
Примечание. |
---|
The number of alternates increases exponentially for large ranges and for some languages. Applications should specify the number of alternates rather than query for the maximum number of alternates that the recognizer can return. |
A recognizer is likely to divide "how are you" into three segments—depending on the spacing between segments—one for each word. Call the GetAlternatesFromSelection method to return the alternates for only one segment of this selection.
Note the difference between the GetAlternatesFromSelection method and the AlternatesWithConstantPropertyValues, LineAlternates, and ConfidenceAlternates methods of the RecognitionAlternate object. Although the GetAlternatesFromSelection method returns a RecognitionAlternates collection in which each RecognitionAlternate object corresponds to only one segment of ink within a selection, the AlternatesWithConstantPropertyValues, LineAlternates, and ConfidenceAlternates methods return the RecognitionAlternates collection in which the RecognitionAlternate objects correspond to each segment of ink within a selection.
Примеры
This C# example returns up to five RecognitionAlternate objects for the user selection in a TextBox control, theTextBox, which has already been filled with the top result from the RecognitionResult object. The alternates are stored in the RecognitionAlternates collection, theRecognitionAlternates, by using the GetAlternatesFromSelection method. This is a useful way to enable a user to select text that has been recognized and search through the alternates for that text in order to insert a correction.
[C#]
using Microsoft.Ink;
// . . .
try
{
if (theTextBox.SelectionLength != 0)
{
RecognitionAlternates theRecognitionAlternates =
theRecognitionResult.GetAlternatesFromSelection(
theTextBox.SelectionStart, theTextBox.SelectionLength, 5);
// Do something with theRecognitionAlternates here.
}
}
catch
{
// handle exceptions here.
}
This Microsoft® Visual Basic® .NET example returns up to five RecognitionAlternate objects for the user selection in a TextBox control, theTextBox, which has already been filled with the top result from the RecognitionResult object. The alternates are stored in the RecognitionAlternates collection, theRecognitionAlternates, by using the GetAlternatesFromSelection method. This is a useful way to enable a user to select text that has been recognized and search through the alternates for that text in order to insert a correction.
[Visual Basic]
Imports Microsoft.Ink
' . . .
Try
If theTextBox.SelectionLength != 0 Then
Dim theRecognitionAlternates As RecognitionAlternates
theRecognitionAlternates = _
theRecognitionResult.GetAlternatesFromSelection( _
theTextBox.SelectionStart, _
theTextBox.SelectionLength, 5)
'Do something with theRecognitionAlternates here.
End If
Catch
'Handle exceptions here.
End Try
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0
См. также
Ссылки
GetAlternatesFromSelection - перегрузка