Re:Show HN: Detecting the Programming Language of Code Using...
by pprogrammer on Monday July 18, 2016 @03:06PM
(#12117373)
That would probably work OK, I guess, but some languages have the same keywords, so I don't think you'll get very high accuracy.
I also tried a word level n-grams with linear classifiers, I couldn't get very high accuracy out of it. Also n-grams with higher values for n improve accuracy a lot if you train it with a lot of data, both for word-level models as for character level.
The data would then really only be needed to guess the frequencies.
I am also not sure whether word bigrams would help a lot, but character level n-grams would be totally off my radar.
Any opinions on that?