|
| | |||||||
| Tablet PC Developers Show off your work while discussing with others how to create ink enabled applications. |
| | LinkBack | Thread Tools |
| |||
| Ink AnalysisHintNode does not consider Factoid Hi, I want to restrict the handwriting recognition result to only use digits. Passing the ink for a "5", sometimes the recognition engine reconizes an "S", even I set hintNode.Factoid = IS_DIGITS; hintNode.CoerceToFactoid = true; ----------- Here is the code snipplet: Form invisibleForm = new Form(); InkAnalyzer analyzer = new InkAnalyzer(tempInk,invisibleForm); AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); hintNode.Factoid = IS_DIGITS; hintNode.CoerceToFactoid = true; RecognizerGuide myGuide = new RecognizerGuide(); Rectangle rect = new Rectangle(new Point(tempInk.GetBoundingBox().X,tempInk.GetBoundi ngBox().Y),new Size(tempInk.GetBoundingBox().Width,tempInk.GetBou ndingBox().Height)); myGuide.Columns = request.getOptions().getColumns(); myGuide.Rows = request.getOptions().getRows(); myGuide.WritingBox = rect; rect.Inflate(10,10); myGuide.DrawnBox = rect; hintNode.Guide = myGuide; analyzer.AddStrokes(tempInk.Strokes); ----------- Did someone else already have a similar problem? How can I make the recognition engine to consider always 100% the hints passed to it? Best regards, Michael |
| |||
| Re: Ink AnalysisHintNode does not consider Factoid Hi Michael, first, let me recommend you download my InkAnalyzer Explorer at www.einsteintech.net so that you can "play around" with the Ink Analyzer a bit and understand how the various properties affect it. In your case, the guide property will not help you here. You actually have to set up the region that the analysis hint will occupy. So for example, if you wanted the hint to cover the entire "global" region you could do: AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); hintNode.Location.MakeInfinite(); Or if you knew the ink-space rectangle ahead of time you could do: AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(bounds); Then once you have the hint node, it's already in the tree. It's best to give it a name so set its Name property, then any properties that you want to give it. In your case, this would be a good setting: // don't bother calculating segmentation alternates hintNode.TopInkBreaksOnly = true; // forces everything into one segment hintNode.WordMode = true; // tells the recognizer to expect digits hintNode.Factoid = "(!IS_DIGITS)"; // tells the recognizer to expect ONLY digits hintNode.CoerceToFactoid = true; Then if there's already ink in the space where you want the region to apply, you would have to invalidate the dirty region of the analyzer like so: analyzer.DirtyRegion.Union(hintNode.Location); Hope this helps. -- Josh Einstein (Tablet PC MVP) Einstein Technologies Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com "Michael Resch" <joboe@gmx.de> wrote in message news:5ajekpF2pkhdoU1@mid.individual.net... > Hi, > > I want to restrict the handwriting recognition result to only use digits. > > Passing the ink for a "5", sometimes the recognition engine reconizes an > "S", even I set > > hintNode.Factoid = IS_DIGITS; > hintNode.CoerceToFactoid = true; > > ----------- > Here is the code snipplet: > > Form invisibleForm = new Form(); > > InkAnalyzer analyzer = new InkAnalyzer(tempInk,invisibleForm); > > AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); > > hintNode.Factoid = IS_DIGITS; > hintNode.CoerceToFactoid = true; > > RecognizerGuide myGuide = new RecognizerGuide(); > > Rectangle rect = new Rectangle(new > Point(tempInk.GetBoundingBox().X,tempInk.GetBoundi ngBox().Y),new > Size(tempInk.GetBoundingBox().Width,tempInk.GetBou ndingBox().Height)); > myGuide.Columns = request.getOptions().getColumns(); > myGuide.Rows = request.getOptions().getRows(); > myGuide.WritingBox = rect; > rect.Inflate(10,10); > myGuide.DrawnBox = rect; > > hintNode.Guide = myGuide; > > analyzer.AddStrokes(tempInk.Strokes); > ----------- > > Did someone else already have a similar problem? > > How can I make the recognition engine to consider always 100% the hints > passed to it? > > Best regards, > > Michael > > |
| |||
| Re: Ink AnalysisHintNode does not consider Factoid Hi Josh, thanks a lot for your help. It works fine, now :) I have 2 more questions: Can you give me a link to a documentation on how to use regular expressions as Factoid? Also, I would like to use the returned Confidence value, but the value is always "UNKOWN". Here is the code I am using: Result res = new Result(); ContextNodeCollection nodes = new ContextNodeCollection(new ContextNode[]{contextNode}); foreach (AnalysisAlternate recoAlternates in analyzer.GetAlternates(nodes)) { ... res.setConfidence(recoAlternates.InkRecognitionCon fidence.ToString(); ... } Thank you & Best regards, Michael "Josh Einstein" <josh@einsteintech.net> schrieb im Newsbeitrag news:53893ED1-179F-48FC-A2B9-7E772CF08C06@microsoft.com... > Hi Michael, first, let me recommend you download my InkAnalyzer Explorer > at www.einsteintech.net so that you can "play around" with the Ink > Analyzer a bit and understand how the various properties affect it. > > In your case, the guide property will not help you here. You actually have > to set up the region that the analysis hint will occupy. So for example, > if you wanted the hint to cover the entire "global" region you could do: > > AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); > hintNode.Location.MakeInfinite(); > > Or if you knew the ink-space rectangle ahead of time you could do: > > AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(bounds); > > Then once you have the hint node, it's already in the tree. It's best to > give it a name so set its Name property, then any properties that you want > to give it. In your case, this would be a good setting: > > // don't bother calculating segmentation alternates > hintNode.TopInkBreaksOnly = true; > // forces everything into one segment > hintNode.WordMode = true; > // tells the recognizer to expect digits > hintNode.Factoid = "(!IS_DIGITS)"; > // tells the recognizer to expect ONLY digits > hintNode.CoerceToFactoid = true; > > Then if there's already ink in the space where you want the region to > apply, you would have to invalidate the dirty region of the analyzer like > so: > > analyzer.DirtyRegion.Union(hintNode.Location); > > Hope this helps. > > -- > Josh Einstein (Tablet PC MVP) > Einstein Technologies > Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com > > > "Michael Resch" <joboe@gmx.de> wrote in message > news:5ajekpF2pkhdoU1@mid.individual.net... >> Hi, >> >> I want to restrict the handwriting recognition result to only use digits. >> >> Passing the ink for a "5", sometimes the recognition engine reconizes an >> "S", even I set >> >> hintNode.Factoid = IS_DIGITS; >> hintNode.CoerceToFactoid = true; >> >> ----------- >> Here is the code snipplet: >> >> Form invisibleForm = new Form(); >> >> InkAnalyzer analyzer = new InkAnalyzer(tempInk,invisibleForm); >> >> AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); >> >> hintNode.Factoid = IS_DIGITS; >> hintNode.CoerceToFactoid = true; >> >> RecognizerGuide myGuide = new RecognizerGuide(); >> >> Rectangle rect = new Rectangle(new >> Point(tempInk.GetBoundingBox().X,tempInk.GetBoundi ngBox().Y),new >> Size(tempInk.GetBoundingBox().Width,tempInk.GetBou ndingBox().Height)); >> myGuide.Columns = request.getOptions().getColumns(); >> myGuide.Rows = request.getOptions().getRows(); >> myGuide.WritingBox = rect; >> rect.Inflate(10,10); >> myGuide.DrawnBox = rect; >> >> hintNode.Guide = myGuide; >> >> analyzer.AddStrokes(tempInk.Strokes); >> ----------- >> >> Did someone else already have a similar problem? >> >> How can I make the recognition engine to consider always 100% the hints >> passed to it? >> >> Best regards, >> >> Michael >> >> > |
| |||
| Re: Ink AnalysisHintNode does not consider Factoid To the best of my knowledge, confidence is only supported with the US English recognizer so if you are using any other recognizer, it probably won't work. You can test this with the Ink Analyzer Explorer app. You can copy/paste the strokes from your app into IA Explorer and then select the strokes and drop down the language menu. Make sure it's set to "US English" and then check the node properties to see if the confidence property appears in the list. As for using regular expressions in factoids... Not to knock MS here because I love the ink API's but this piece totally totally sucks. Sucks doesn't even begin to describe it. It shouldn't even be called "regular expressions" because it doesn't support quantifiers, ranges, etc. There is a very short piece of documentation on this at the following URL. It's short because there's not much to talk about. http://msdn2.microsoft.com/en-us/library/ms840427.aspx However, having said that, you can sort of work around it by looping over the alternates and testing it with your own regex like: if ( Regex.IsMatch(alternate.RecognizedString) ) Two disadvantages to this approach are: 1) performance will not be as good presumably and 2) you are limited to the number of alternates returned. -- Josh Einstein (Tablet PC MVP) Einstein Technologies Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com "Michael Resch" <joboe@gmx.de> wrote in message news:5at7ufF2qelk4U1@mid.individual.net... > Hi Josh, > > thanks a lot for your help. It works fine, now :) > > I have 2 more questions: Can you give me a link to a documentation on how > to use regular expressions as Factoid? > > Also, I would like to use the returned Confidence value, but the value is > always "UNKOWN". > Here is the code I am using: > > Result res = new Result(); > ContextNodeCollection nodes = new ContextNodeCollection(new > ContextNode[]{contextNode}); > > foreach (AnalysisAlternate recoAlternates in > analyzer.GetAlternates(nodes)) > { > ... > res.setConfidence(recoAlternates.InkRecognitionCon fidence.ToString(); > ... > } > > Thank you & Best regards, > > Michael > > "Josh Einstein" <josh@einsteintech.net> schrieb im Newsbeitrag > news:53893ED1-179F-48FC-A2B9-7E772CF08C06@microsoft.com... >> Hi Michael, first, let me recommend you download my InkAnalyzer Explorer >> at www.einsteintech.net so that you can "play around" with the Ink >> Analyzer a bit and understand how the various properties affect it. >> >> In your case, the guide property will not help you here. You actually >> have to set up the region that the analysis hint will occupy. So for >> example, if you wanted the hint to cover the entire "global" region you >> could do: >> >> AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); >> hintNode.Location.MakeInfinite(); >> >> Or if you knew the ink-space rectangle ahead of time you could do: >> >> AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(bounds); >> >> Then once you have the hint node, it's already in the tree. It's best to >> give it a name so set its Name property, then any properties that you >> want to give it. In your case, this would be a good setting: >> >> // don't bother calculating segmentation alternates >> hintNode.TopInkBreaksOnly = true; >> // forces everything into one segment >> hintNode.WordMode = true; >> // tells the recognizer to expect digits >> hintNode.Factoid = "(!IS_DIGITS)"; >> // tells the recognizer to expect ONLY digits >> hintNode.CoerceToFactoid = true; >> >> Then if there's already ink in the space where you want the region to >> apply, you would have to invalidate the dirty region of the analyzer like >> so: >> >> analyzer.DirtyRegion.Union(hintNode.Location); >> >> Hope this helps. >> >> -- >> Josh Einstein (Tablet PC MVP) >> Einstein Technologies >> Tablet Enhancements for Outlook - Try it free: www.tabletoutlook.com >> >> >> "Michael Resch" <joboe@gmx.de> wrote in message >> news:5ajekpF2pkhdoU1@mid.individual.net... >>> Hi, >>> >>> I want to restrict the handwriting recognition result to only use >>> digits. >>> >>> Passing the ink for a "5", sometimes the recognition engine reconizes an >>> "S", even I set >>> >>> hintNode.Factoid = IS_DIGITS; >>> hintNode.CoerceToFactoid = true; >>> >>> ----------- >>> Here is the code snipplet: >>> >>> Form invisibleForm = new Form(); >>> >>> InkAnalyzer analyzer = new InkAnalyzer(tempInk,invisibleForm); >>> >>> AnalysisHintNode hintNode = analyzer.CreateAnalysisHint(); >>> >>> hintNode.Factoid = IS_DIGITS; >>> hintNode.CoerceToFactoid = true; >>> >>> RecognizerGuide myGuide = new RecognizerGuide(); >>> >>> Rectangle rect = new Rectangle(new >>> Point(tempInk.GetBoundingBox().X,tempInk.GetBoundi ngBox().Y),new >>> Size(tempInk.GetBoundingBox().Width,tempInk.GetBou ndingBox().Height)); >>> myGuide.Columns = request.getOptions().getColumns(); >>> myGuide.Rows = request.getOptions().getRows(); >>> myGuide.WritingBox = rect; >>> rect.Inflate(10,10); >>> myGuide.DrawnBox = rect; >>> >>> hintNode.Guide = myGuide; >>> >>> analyzer.AddStrokes(tempInk.Strokes); >>> ----------- >>> >>> Did someone else already have a similar problem? >>> >>> How can I make the recognition engine to consider always 100% the hints >>> passed to it? >>> >>> Best regards, >>> >>> Michael >>> >>> >> > > |
| Bookmarks |
| Thread Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Factoid: Robot Fly | Robert Heiny | Tablet PC - Education Articles | 0 | 08-06-2007 10:40 AM |
| Factoid: Compute at the Speed of a Petaflop | Robert Heiny | Tablet PC - Education Articles | 0 | 08-06-2007 10:40 AM |
| Factoid: Expenditures for U.S. K12 Schools | Robert Heiny | Tablet PC - Education Articles | 0 | 04-26-2007 02:50 PM |
| Factoid: Mixed Feelings | Robert Heiny | Tablet PC - Education Articles | 0 | 04-14-2007 07:00 PM |
| Factoid: Value of College Degree | Robert Heiny | Tablet PC - Education Articles | 0 | 10-30-2006 09:11 PM |
| New To Technology Questions? | Do You Need Help with Your Computer or Device? | Do You Need Help with this site? |