Hi, All. I've implemented some sample code using NSLinguisticTagger class and i've found some weird behavior. I'me using the following code to analyze a simple english phrase:
NSRange textrange = NSMakeRange(0, [phrase length]); [tagger enumerateTagsInRange:textrange scheme:NSLinguisticTagSchemeLexicalClass options:0 usingBlock: ^(NSString *wordType, NSRange wordRange, NSRange sentenceRange, BOOL *stop) { if(wordType == NSLinguisticTagNoun) { // Show tag } if(wordType == NSLinguisticTagPronoun) { // Show tag } if(wordType == NSLinguisticTagDeterminer) { // Show tag } …etc for each NSLinguisticSomething constant. }]; If I analyze the phrase: "I am a woman" I got the correct result : I --> pronoun am --> verb A --> determiner woman --> noun but if i analyze the phrase: "I am a man" I got the result: I --> otherword am --> otherword a --> otherword man --> otherword. I've initialized the NSLinguisticTagger class as follow: NSArray *tagScheme = [NSArray arrayWithObjects:NSLinguisticTagSchemeLexicalClass, NSLinguisticTagSchemeNameType, NSLinguisticTagSchemeLanguage, nil]; tagger = [[NSLinguisticTagger alloc] initWithTagSchemes:tagScheme options:0]; So where is my mistake? Why I get an error if I try to analyze a simple phrase like "I am a man"? The behavior is the same on the device (iOS 5.0.1) and on the simulator. I'm using MaOS X 10.7.2 with Xcode 4.2. Thanks for any answer. Luca. On Nov 14, 2011, at 5:56 PM, Douglas Davidson wrote: > There is also some documentation available in the Foundation release notes > for Lion > <http://developer.apple.com/library/mac/#releasenotes/Cocoa/Foundation.html> > and the NSLinguisticTagger class reference > <http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSLinguisticTagger_Class/Reference/Reference.html>. > If you have specific questions, you can send them to the list. > > Douglas Davidson > > On Nov 14, 2011, at 7:02 AM, Luca Ciciriello wrote: > >> Yes, indeed!!! >> >> On Nov 14, 2011, at 2:56 PM, Eric E. Dolecki wrote: >> >>> Just started watching this video - it's awesome. >>> >>> - Eric >>> >>> On Mon, Nov 14, 2011 at 3:32 AM, Luca Ciciriello >>> <luca_cicirie...@hotmail.com> wrote: >>> >>> Thanks Vincent, that should solve my problems. >>> Luca. >>> >>>> Subject: Re: Natural language >>>> From: mailingli...@satsumac.com >>>> Date: Sun, 13 Nov 2011 21:37:01 +0100 >>>> CC: cocoa-dev@lists.apple.com >>>> To: luca_cicirie...@hotmail.com >>>> >>>> The "Advanced Text Processing" session from WWDC '11 should be of help. >>>> https://developer.apple.com/videos/wwdc/2011/ >>>> >>>> On Nov 13, 2011, at 4:31 PM, Luca Ciciriello wrote: >>>> >>>>> Hi All. >>>>> Any one knows how to use the class NSLinguisticTagger in order to >>>>> decompose a phrase in its grammar components (name, adjective, verb, >>>>> etc.)? >>>>> >>>>> Thanks for any answer. >>>>> >>>>> Luca >>> >>> _______________________________________________ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com >>> >>> This email sent to edole...@gmail.com >>> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/ddavidso%40apple.com >> >> This email sent to ddavi...@apple.com > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/luca_ciciriello%40hotmail.com > > This email sent to luca_cicirie...@hotmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com