I have an AnalyzerHintNode setup as follows:
hint = analyzer.CreateAnalysisHint(new Rect(0, 0, 50, 50));
hint.Guide = new InkRecognizerGuideBase(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0);
hint.PrefixText = ...
hint.SuffixText = ...
hint.Factoid = "HIRAGANA";
hint.CoerceToFactoid = true;
However the hint does not force the InkAnalyzer to recognise all strokes
in the range as writing, so I do the following when adding new strokes:
foreach (Stroke stroke in e.Added)
{
analyzer.SetStrokeType(stroke, StrokeType.Writing);
}
Now all strokes are treated as writing, however the hint still doesn't seem
to have enough influence.
* Not all recognised characters in the area are coerced to the factoid (ie,
I get characters which are not Hiragana).
* I can get results containing more than one character (despite the fact
that the hint defines a 1x1 grid).
I guess I want more concrete constraints instead of hints.
Is there a better way to do this currently?
or Will this be better supported in the final release?
- Doug
Thanks for taking the time to try out the beta InkAnalysis APIs. I have a
couple of suggestions for you to try out:
1. There are four versions of the InkAnalysis API.
a. Windows Forms – uses the Microsoft.Ink namespace, classes found in the
Microsoft.Ink.Analysis.dll assembly and is bound with stroke types found in
the Microsoft.Ink namespace.
b.WPF – uses the System.Windows.Ink namespace, classes found in the
IAWinFX.dll assembly and is bound with stroke types found in the
System.Windows.Ink namespace.
c. Base stroke agnostic – uses the System.Windows.Ink namespace, classes
found in the IACore.dll assembly and is not bound to any stroke type.
Individual strokes must be managed by you the user and be passed into the
InkAnalyzerBase object in the form of arrays of Packet Data.
d. COM – uses interfaces found in the IACom.dll, and is not bound to any
stroke type. Individual strokes must be managed by you the user and be passed
into the InkAnalyzerBase object in the form of arrays of Packet Data.
As you use the InkAnalysis API, try not to intermix classes that have “Base”
in their name with those that don’t if you are calling the Windows Forms or
WPF layer. In the second line of your sample code below (assuming you’ve
instantiated a Microsoft.Ink.InkAnalyzer class as “analyzer”), you should be
creating a new “Guide” class not an InkReocgnizerGuideBase class.
2.When you create the AnalysisHint or Guide object, be sure to set valid
rectangles. The ink captured must fall within those rectangles and if it
does not, the values set on the AnalysisHint will not be applied to those
strokes. If you want to apply a generic AnalysisHint to the entire document,
create a new AnalysisHint object without a location specified in the
constructor (hint = analyzer.CreateAnalysisHint();), then set it’s location
of the AnalysisHint ContextNode to infinite (hint.Location.MakeInfinite(););
Hope this helps.
Thanks,
Jamie Wakeam
Program Manager, Tablet PC Platform Team
Microsoft Corporation
-----
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Where does the Guide class live?
In IAWinFX and IACore I cant find any subclasses of InkReocgnizerGuideBase.
Just a sanity check, but am I still using the latest version?
IAWinFX, Version=6.0.5070.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Thanks,
- Doug
> Hi Doug,
>
> Thanks for taking the time to try out the beta InkAnalysis APIs. I
> have a
> couple of suggestions for you to try out:
> 1. There are four versions of the InkAnalysis API.
> a. Windows Forms - uses the Microsoft.Ink namespace, classes found in
> the
> Microsoft.Ink.Analysis.dll assembly and is bound with stroke types
> found in
> the Microsoft.Ink namespace.
> b.WPF - uses the System.Windows.Ink namespace, classes found in the
> IAWinFX.dll assembly and is bound with stroke types found in the
> System.Windows.Ink namespace.
> c. Base stroke agnostic - uses the System.Windows.Ink namespace,
> classes
> found in the IACore.dll assembly and is not bound to any stroke type.
> Individual strokes must be managed by you the user and be passed into
> the
> InkAnalyzerBase object in the form of arrays of Packet Data.
> d. COM - uses interfaces found in the IACom.dll, and is not bound to
It sounds like you are using the WFP version of InkAnalysis. The beta
version of InkAnalysis released in September did not have a
System.Windows.Ink.InkRecognizerGuide class for use in WPF. We have fixed
this in newer builds. In the mean time you can use
System.Windows.Ink.InkRecognzierGuideBase.
Thanks,
Jamie Wakeam
Program Manager, Tablet PC Platform Team
Microsoft Corporation
-----
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Yes, I am using IAWinFX.
But my real question is: Is the behaviour I'm getting now a bug, or are there
fundamental differences to IA?
I notice two key differences between using Hints in Ink Analysis and making
similar settings on a RecognizerContext in the 1.7 SDK.
1) Even if I take the Guide out of the picture and create an infinite sized
hint, the hint can still be ignored. I'm setting Factoid="HIRAGANA" and CoerceToFactoid=true,
but I can still end up with results which are outside the scope of the factoid.
In the past, if I set Factoid="HIRAGANA" and RecognitionFlags = Microsoft.Ink.RecognitionModes.Coerce;
using a RecognizerContext from the 1.7 SDK I only recieved results matching
the factoid.
2) In the 1.7 SDK if I set a Guide on a RecognizerContext with Rows = 1,
Columns = 1 my results always contain only a single character. Using InkAnalysis
and setting a similar Guide on a Hint does not produce the same results.
- Doug