![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Create a dictionary from wikipediaby cavac (Vicar) |
on Jul 31, 2012 at 18:06 UTC ( #984638=note: print w/replies, xml ) | Need Help?? |
Wikipedia ... meaningful content Uhm, i'm not sure that is a problem that actually can be solved by using Perl.... scnr. Back on topic, since you have the "raw" articles, you have to do multiple things. First, you have to remove all the markup. That alone does not seem trivial, since the MediaWiki format is a big mess to begin with. It's actually messy enough that more and more editors quit and the MediaWiki developers don't seem to be able to come up with a working visual editor. A quick and dirty solution for this would be to try to use one of the MediaWiki-to-HTML converters like Text::Markup::Mediawiki and then scrape the text by using something like HTML::Extract. Then, you can split resulting text on whitespaces. For each word then increment the counter in the hash. since sometimes words are also used as double words (like "flying dutchman"), you might want to count them as well and see where it leads you. For this, consider 774421.
"I know what i'm doing! Look, what could possibly go wrong? All i have to pull this lever like so, and then press this button here like ArghhhhhaaAaAAAaaagraaaAAaa!!!"
In Section
Seekers of Perl Wisdom
|
|