Re: Natural language
Thanks for your answer. This solve my problem :-) Luca. On Nov 17, 2011, at 5:39 PM, Douglas Davidson wrote: > > On Nov 17, 2011, at 7:51 AM, Luca Ciciriello wrote: > >> 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. > > Those are the results you will get if you don't specify the language of the > text, and the system concludes that there is insufficient text to confidently > identify the language. If there were additional text in the string you > passed in, it would be used to help identify the language. Alternatively, if > you know the language of the text, you can specify it using > setOrthography:range:. That was shown in the final example in the WWDC > presentation, in the following form: > > [tagger setOrthography:[NSOrthography > orthographyWithDominantScript:@"Latn" languageMap:[NSDictionary > dictionaryWithObject:[NSArray arrayWithObject:@"en"] forKey:@"Latn"]] > range:NSMakeRange(0, length)]; > > which specifies that the text is to be treated as being entirely in English. > > Douglas Davidson > ___ 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
Re: Natural language
On Nov 17, 2011, at 7:51 AM, Luca Ciciriello wrote: > 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. Those are the results you will get if you don't specify the language of the text, and the system concludes that there is insufficient text to confidently identify the language. If there were additional text in the string you passed in, it would be used to help identify the language. Alternatively, if you know the language of the text, you can specify it using setOrthography:range:. That was shown in the final example in the WWDC presentation, in the following form: [tagger setOrthography:[NSOrthography orthographyWithDominantScript:@"Latn" languageMap:[NSDictionary dictionaryWithObject:[NSArray arrayWithObject:@"en"] forKey:@"Latn"]] range:NSMakeRange(0, length)]; which specifies that the text is to be treated as being entirely in English. Douglas Davidson ___ 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
Re: Natural language
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 >>> 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 >>> >> >>
Re: Natural language
Thanks. These references are very useful and Your video (session 128) with Jennifer Moore has been really illuminating. Thanks again. 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 >>> 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
Re: Natural language
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 >> 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Natural language
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 > 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Natural language
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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: Natural language
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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Natural language
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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Natural language
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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
displaying natural language time intervals
I feel like this has been asked on cocoa-dev before, but I haven't found it. I want to be able to display a date as "3 seconds ago", "1 hour ago", etc. I could roll my own solution but I wonder if someone has already made some classes available to do this? It would be nice if there is a built-in solution that takes care of internationalization, but the only remotely related thing I've found is the *NaturalLanguage* methods in NSDateFormatter, and the docs fall just short of advising us to avoid them like the plague. --Andy ___ 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
Re: NSDates and natural language ...
Hi Laurent, I don't think I can achieve what I'm looking for with NSDateFormatter unless I subclass it and implement my own mehtods, which is what I'm looking to avoid if there's already an existing project out there. Thanks for your response though. -Mic 2009/3/30 Laurent Demaret : > Hello, > > > Mic Pringle wrote: > >> any frameworks/classes that have been released that >> allow you to return natural language from a date ? > NSDateFormatter ? > > My firs answer on this list, l hope it's a good one... > ___ 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
Re: NSDates and natural language ...
Hello, Mic Pringle wrote: > any frameworks/classes that have been released that > allow you to return natural language from a date ? NSDateFormatter ? My firs answer on this list, l hope it's a good one... ___ 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
NSDates and natural language ...
Hi, Is anyone aware of any frameworks/classes that have been released that allow you to return natural language from a date ? What I mean by this is if, for example, I pass todays date it would return 'Today', yesterdays date would return 'Yesterday', 25th March 08 would return 'Last week' etc I know I can work this out manually using NSTimeInterval, some calculations and plenty of if statements but I was hoping there was already something out there. Thanks, -Mic ___ 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