|
NAMELingua::EN::Summarize - A simple tool for summarizing bodies of English text.SYNOPSISuse Lingua::EN::Summarize; my $summary = summarize( $text ); # Easy, no? :-) my $summary = summarize( $text, maxlength => 500 ); # 500-byte summary my $summary = summarize( $text, filter => 'html' ); # Strip HTML formatting my $summary = summarize( $text, wrap => 75 ); # Wrap output to 75 col. DESCRIPTIONThis is a simple module which makes an unscientific effort at summarizing English text. It recognizes simple patterns which look like statements, abridges them, and concatenates them into something vaguely resembling a summary. It needs more work on large bodies of text, but it seems to have a decent effect on small inputs at the moment.Lingua::EN::Summarize exports one function, "summarize()", which takes the text to summarize as its first argument, and any number of optional directives in "name => value" form. The options it'll take are:
Unlike the HTML::Summarize module (which is quite interesting, and worth a look), this module considers its input to be plain English text, and doesn't try to gather any information from the formatting. Thus, without any cues from the document's format, the scheme that HTML::Summarize uses isn't applicable here. The current scheme goes something like this: "Filter the text according to the user's "filter" option. Split the text into discrete sentences with the Text::Sentence module, then further split them into clauses on commas and semicolons. Keep only the ones that have a (subject very-simple-verb object) structure. Construct the summary out of the first sentences in the list, staying within the "maxlength" limit, or under 30% of the size of the original text, whichever is smaller." Needless to say, this is a very simple and not terribly universally effective scheme, but it's good enough for a first draft, and I'll bang on it more later. Like I said, it's not a scientific approach to the problem, but it's better than nothing (and often better than HTML::Summarize!), and I don't really need A.I. quality output from it. AUTHORDennis Taylor, <dennis@funkplanet.com>SEE ALSOHTML::Summarize, Text::Sentence, http://www.vancouvertoday.com/city_guide/dining/reviews/barbers_modern_club.html
Visit the GSP FreeBSD Man Page Interface. |