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