An open API service indexing awesome lists of open source software.

https://github.com/glaslos/langdog

Trainable Python programming language detection module based on a naive Bayes classifier and Bayesian inference
https://github.com/glaslos/langdog

Last synced: 3 months ago
JSON representation

Trainable Python programming language detection module based on a naive Bayes classifier and Bayesian inference

Awesome Lists containing this project

README

        

langdog
=============
Trainable Python programming language detection module based on Bayesian probability. Langdog is inspired by http://stackoverflow.com/questions/475033/detecting-programming-language-from-a-snippet

## Getting started

Some sample code on how to use langdog.

import langdog

lang_classifier = langdog.LangClassifier()
lang_classifier.train(open("code.pl").read(), "perl")
lang_classifier.train(open("code.php").read(), "php")
lang_classifier.classify(open(sys.argv[1]).read())