leocharre has asked for the wisdom of the Perl Monks concerning the following question:
Is there an already existing system, or modules to detect the kind of code a text chunk is (if any)??
for example, I read in a file, and I want to check it's syntax and figure out if it's html, javascript, perl, c, etc etc.
The thing I saw somehow close on cpan was : HTML::CGIChecker, it detects certain tags in text. Seems like a grat app I wanna use sometime(?).. But... It's not what I am thinking of.
The ideal program would take a chunk of text, and guess what it is.
Also, this program would.. be able to be fed different languages, so you could detect for english, or french, really it would be exactly the same procedures.
It seems to me ann endless set of heuristics are needed. That is.. The program has to be fed tons of code, told what it is. Then with that data, it can determine that the text analized is... say .. 15% perl, 10% javascript and 75% unknown. (therefore clearly simple text)
Reminds me lot of spam assasin. Perhaps it does something similar.
Is this already made? Would it have more then academic value? Is the task much more hairy then my little mind can glimpse?
|
|---|