News for hackers. Stuff that matters.
Re:Show HN: Detecting the Programming Language of Code Using... by dmichulke on Monday July 18, 2016 @02:38PM (#12117171)
Shouldn't one just use a naive bayesian classifier on top of the frequency-weighted language keywords?

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?

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.