Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Need to speed up many regex substitutions and somehow make them a here-doc list (MCE solution)

by marioroy (Prior)
on Oct 05, 2022 at 22:28 UTC ( [id://11147267]=note: print w/replies, xml ) Need Help??


in reply to Re: Need to speed up many regex substitutions and somehow make them a here-doc list (MCE solution)
in thread Need to speed up many regex substitutions and somehow make them a here-doc list

I ran with the following for comparing with the sed output. See complementary post for a version based on Marshall's implementation.

# Worker function. sub process_chunk { my ($chunk_ref) = @_; $$chunk_ref =~ s/[[:punct:]]//g; $$chunk_ref =~ s/[0-9]//g; $$chunk_ref =~ s/w(as|ere)/be/gi; $$chunk_ref =~ s/ need.* / need /gi; $$chunk_ref =~ s/ .*meant.* / mean /gi; $$chunk_ref =~ s/ .*work.* / work /gi; $$chunk_ref =~ s/ .*read.* / read /gi; $$chunk_ref =~ s/ .*allow.* / allow /gi; $$chunk_ref =~ s/ .*gave.* / give /gi; $$chunk_ref =~ s/ .*bought.* / buy /gi; $$chunk_ref =~ s/ .*want.* / want /gi; $$chunk_ref =~ s/ .*hear.* / hear /gi; $$chunk_ref =~ s/ .*came.* / come /gi; $$chunk_ref =~ s/ .*destr.* / destroy /gi; $$chunk_ref =~ s/ .*paid.* / pay /gi; $$chunk_ref =~ s/ .*selve.* / self /gi; $$chunk_ref =~ s/ .*self.* / self /gi; $$chunk_ref =~ s/ .*cities.* / city /gi; $$chunk_ref =~ s/ .*fight.* / fight /gi; $$chunk_ref =~ s/ .*creat.* / create /gi; $$chunk_ref =~ s/ .*makin.* / make /gi; $$chunk_ref =~ s/ .*includ.* / include /gi; $$chunk_ref =~ s/ .*mean.* / mean /gi; $$chunk_ref =~ s/ talk.* / talk /gi; $$chunk_ref =~ s/ going / go /gi; $$chunk_ref =~ s/ getting / get /gi; $$chunk_ref =~ s/ start.* / start /gi; $$chunk_ref =~ s/ goes / go /gi; $$chunk_ref =~ s/ knew / know /gi; $$chunk_ref =~ s/ trying / try /gi; $$chunk_ref =~ s/ tried / try /gi; $$chunk_ref =~ s/ told / tell /gi; $$chunk_ref =~ s/ coming / come /gi; $$chunk_ref =~ s/ saying / say /gi; $$chunk_ref =~ s/ men / man /gi; $$chunk_ref =~ s/ women / woman /gi; $$chunk_ref =~ s/ took / take /gi; $$chunk_ref =~ s/ tak.* / take /gi; $$chunk_ref =~ s/ lying / lie /gi; $$chunk_ref =~ s/ dying / die /gi; $$chunk_ref =~ s/ made /make /gi; $$chunk_ref =~ s/ used.* / use /gi; $$chunk_ref =~ s/ using.* / use /gi; # Output orderly and serially. MCE->relay_lock; print $OUT_FH $$chunk_ref; $OUT_FH->flush; MCE->relay_unlock; }
  • Comment on Re^2: Need to speed up many regex substitutions and somehow make them a here-doc list (MCE solution)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147267]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 06:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found