http://www.perlmonks.org?node_id=763853


in reply to Keywords and keyphrases extraction from text

Hi vit,
  Funnily enough I just updating a script that does something like this. The code I use is:-
### Clean up the text to make it easier to search $bodytext =~ s/\n/ /gis; $bodytext =~ s/\r//gis; $bodytext =~ s/\t/ /gis; $bodytext =~ s/ - / /gis; while ($bodytext =~ / /) { $bodytext =~ s/ / /gis; }#while ### match 2 word groups while ($bodytext =~ /\b([A-Za-z'\-]+ [A-Za-z'\-]+)\b/g) { print "$1\n"; }#while
It's a bit hacky, but works. Although there is a nasty bug with it, I'm hoping someone will have the answer here


Lyle