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
- Host: GitHub
- URL: https://github.com/glaslos/langdog
- Owner: glaslos
- Created: 2011-09-26T08:48:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-09-26T09:32:58.000Z (over 13 years ago)
- Last Synced: 2025-01-30T10:16:16.599Z (5 months ago)
- Language: Python
- Homepage:
- Size: 93.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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())