Skip to main content

Detect the programming language of a source code

Project description

Guesslang detects the programming language of a given source code.

It supports 30 programming languages and detects the correct programming language with more than 90% accuracy.

Guesslang is an open source deep learning software that have been trained with over a million source code files.

You can use Guesslang as a command line interface tool or as a Python module:

from guesslang import Guess

guess = Guess()

# Guess the language from code
language = guess.language_name("""
    % Quick sort

    -module (recursion).
    -export ([qsort/1]).

    qsort([]) -> [];
    qsort([Pivot|T]) ->
           qsort([X || X <- T, X < Pivot])
           ++ [Pivot] ++
           qsort([X || X <- T, X >= Pivot]).
    """)

print(language)  # --> Erlang

Guesslang supports 30 of the most popular programming languages:

Batchfile

C

C#

C++

CSS

CoffeeScript

Erlang

Go

HTML

Haskell

Java

JavaScript

Jupyter Notebook

Lua

Markdown

Matlab

Objective-C

PHP

Perl

PowerShell

Python

R

Ruby

Rust

SQL

Scala

Shell

Swift

TeX

TypeScript

Full documentation at https://guesslang.readthedocs.io/en/latest/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guesslang-2.0.0a1.tar.gz (13.0 MB view hashes)

Uploaded Source

Built Distribution

guesslang-2.0.0a1-py3-none-any.whl (13.0 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page