2017 © Pedro Peláez
 

library lang-detect

Classify source code using a Naive Bayes text classifier

image

nlp-tools/lang-detect

Classify source code using a Naive Bayes text classifier

  • Wednesday, November 13, 2013
  • by katharas
  • Repository
  • 3 Watchers
  • 8 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

LanguageDetector

LanguageDetector is an implementation of sourceclassifier in PHP using NlpTools., (*1)

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., (*2)

You can read a blog post about it., (*3)

Usage

``` php include ("vendor/autoload.php");, (*4)

$detector = LanguageDetector::loadFromFile("model");, (*5)

$lang = $detector->classify(<<<CODE, (*6)

include stdio.h

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

echo $lang; // C, (*8)

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

echo $lang; // Python ```, (*10)

The Versions

13/11 2013

dev-master

9999999-dev

Classify source code using a Naive Bayes text classifier

  Sources   Download

WTFPL

The Requires

 

by Angelos Katharopoulos