Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
src
 
 
 
 
 
 
 
 

README.md

LanguageDetector

LanguageDetector is an implementation of sourceclassifier in PHP using NlpTools.

LanguageDetector detects the programming language of a source code using a Naive Bayes model. The pre trained provided model recognizes C, C#, C++, Clojure, Go, Haskell, Java, Javascript, MATLAB, Pascal, Perl, PHP, Python, Ruby, Scala, Visual Basic.

You can read a blog post about it.

Usage

include ("vendor/autoload.php");

$detector = LanguageDetector::loadFromFile("model");

$lang = $detector->classify(<<<CODE
#include <stdio.h>

int main() {
	printf("Hello world");
}
CODE
);

echo $lang; // C

$lang = $detector->classify(<<<CODE
def hello():
	print "Hello world"
hello()
CODE
);

echo $lang; // Python

About

Classify source code using a Naive Bayes text classifier

Resources

Releases

No releases published

Languages

You can’t perform that action at this time.