Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Detect the programming language of a source code

Project description

Guesslang detects the programming language of a given source code:

from guesslang import Guess


name = 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(name)  # >>> Erlang

Guesslang supports 20 programming languages:

C C# C++ CSS Erlang
Go HTML Java Javascript Markdown
Objective-C PHP Perl Python Ruby
Rust SQL Scala Shell Swift

The current guessing accuracy is higher than 90%.

You can contribute to Guesslang on Github https://github.com/yoeo/guesslang.

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

Project details


Release history Release notifications

This version
History Node

0.9.3

History Node

0.9.3.dev3

History Node

0.9.1

History Node

0.9.0rc5

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
guesslang-0.9.3-py3-none-any.whl (3.2 MB) Copy SHA256 hash SHA256 Wheel py3 Mar 25, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page