Dave Howorth has asked for the wisdom of the Perl Monks concerning the following question:
I started using Text::Context and after experiencing some performance oddities, started reading the code. I'm having some trouble understanding it, so I'm wondering whether either there's some other package that people recommend, or whether anybody uses it and can help me with how it works?
For example, I'm looking at score_para() and wondering about:
$word_score += 1 + ($content =~ tr/ / /) if $content =~ /\b\Q$word\E\b/i;It seems to be adding the number of words in the paragraph to the score, for a reason I don't understand, and it seems to be recalculating the number of words repeatedly, which seems completely unnecessary. (Similarly it recomputes permute_keywords())
Can any monks enlighten me?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text::Context or alternatives?
by davido (Cardinal) on Nov 08, 2011 at 17:12 UTC | |
by moritz (Cardinal) on Nov 09, 2011 at 08:41 UTC | |
by Dave Howorth (Scribe) on Nov 09, 2011 at 11:00 UTC | |
by Dave Howorth (Scribe) on Nov 10, 2011 at 11:03 UTC | |
by Dave Howorth (Scribe) on Nov 08, 2011 at 17:21 UTC | |
by davido (Cardinal) on Nov 08, 2011 at 22:37 UTC | |
by Dave Howorth (Scribe) on Nov 09, 2011 at 09:38 UTC |