in reply to newbies, <code> tags and recognizing perl

++ for thinking about ways to improve our Monastery!

As our Monastery-site has always been on the limit of what is still considered acceptable responsiveness, adding such a check will be quite a heavy burden on the servers, I think.

Still, from a theoretical point of view, a module such as Algorithm::NaiveBayes could form its basis. Feeding it a significant number of nodes, both with and without code tags will quickly make it distinguish between nodes containing Perl-code and those without.

I recently used it to categorize database-records and had a successrate of about 85%. It could easily have been higher but the field which was the basis of the categorization was at the most 70 characters long, contained many "stopwords" and I had 6 categories to choose from.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re: newbies, <code> tags and recognizing perl

Replies are listed 'Best First'.
Re^2: newbies, <code> tags and recognizing perl
by apl (Monsignor) on Mar 24, 2008 at 14:11 UTC
    Might detecting the presence of ^\s*my\s+\$.+; without <code> having been encountered first be enough to send up a flare?
      Could be, but if the newbie does not use strict; he is unlikely to have lexical variables and your regex will not trigger.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James