Sorry but it was not really equivalent, here is an equivalent one: f=: 4 : 0 i=.I.y. e.punc y.=.' ',' 'i}y. x.=.' ',each x. x. +/@E.every <y. )
(6!:2)'pref f txt' 0.0405228 Paul Gauthier APL Software Developer - Senior [EMAIL PROTECTED] Phone: 312-739-3467 Fax: 312-739-3496 CheckFree. The Company that Powers Payment on the WebSM. http://www.checkfree.com/paybillsonline [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 03/30/2006 02:17 PM Please respond to Programming forum <[email protected]> To Programming forum <[email protected]> cc Subject Re: [Jprogramming] counting all occurrences of static list ofprefixesin string Another (faster) way to eliminate punctuation would be to keep only those characters you care for as in: punc=:a.-.' ',(,(a.i.'Aa')+/i.26){a. txt=:1e6$'apples, beer and oranges (and not beef) ' (6!:2)'('' '',each pref) +/@E.every < ;:^:_1 ;: txt' 0.364503 (6!:2)'('' '',each pref) +/@E.every <txt-.punc' 0.0349807 Paul Gauthier APL Software Developer - Senior [EMAIL PROTECTED] Phone: 312-739-3467 Fax: 312-739-3496 CheckFree. The Company that Powers Payment on the WebSM. http://www.checkfree.com/paybillsonline Mike Day <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 03/30/2006 02:24 AM Please respond to Programming forum <[email protected]> To Programming forum <[email protected]> cc Subject Re: [Jprogramming] counting all occurrences of static list ofprefixesin string Is this of concern? text =: 'we grappled with apples,beer,oranges, not beef or alsorans' pref +/@E.every < text NB. confused by grappled & alsorans 2 2 2 ... or are you happy with an approximate count? Since your prefix list is static you could prepend a blank to each, and remove punctuation in the text by, for example, ;:^:_1 ;: text yielding the longer-winded (' ',each pref) +/@E.every < ;:^:_1 ;: text 1 2 1 Mike Jacobs, Jan wrote: >Yes, thanks! > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of Miller, Raul D >Sent: donderdag 30 maart 2006 7:32 >To: Programming forum; [email protected] >Subject: RE: [Jprogramming] counting all occurrences of static list >ofprefixesin string > >Jacobs, Jan wrote: > > >>pref=:'appl';'bee';'oran' which have to be looked up in e.g. >>txt=:'apples, beer and oranges (and not beef)'. >>I tried +/"1 >pref E.&.> <txt but this is too slow. Can somebody >> >> >hint > > >>me in a good direction? >> >> > >Is pref +/@E.&> <txt fast enough for you? > >-- >Raul > >---------------------------------------------------------------------- >For information about J forums see http://www.jsoftware.com/forums.htm > > >This message and attachment(s) are intended solely for the use of the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. >If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. >If you have received this communication in error, please notify the sender immediately by telephone and with a "reply" message. >Thank you for your cooperation. > > >---------------------------------------------------------------------- >For information about J forums see http://www.jsoftware.com/forums.htm > > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
