Need help with guesslang?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

yoeo
455 Stars 52 Forks MIT License 141 Commits 13 Opened issues

Description

Detect the programming language of a source code

Services available

!
?

Need anything else?

Contributors list

# 434,255
Python
deep-ne...
Deep le...
Tensorf...
3 commits
# 30,194
abap
coffees...
git-cli...
React
1 commit

Guesslang Build Status Documentation Status Pypi version

Guesslang

Guesslang detects the programming language of a given source code:

echo '
package main
import "fmt"

func main() { fmt.Println("My mascot is a gopher and Google loves me. Who am I?") }

' | guesslang

⟶ Programming language: Go

Guesslang supports

54 programming languages
:

| Languages | | | | | |------------|----------------|---------------|----------------|--------------| |

Assembly
|
Batchfile
|
C
|
C#
|
C++
| |
Clojure
|
CMake
|
COBOL
|
CoffeeScript
|
CSS
| |
CSV
|
Dart
|
DM
|
Dockerfile
|
Elixir
| |
Erlang
|
Fortran
|
Go
|
Groovy
|
Haskell
| |
HTML
|
INI
|
Java
|
JavaScript
|
JSON
| |
Julia
|
Kotlin
|
Lisp
|
Lua
|
Makefile
| |
Markdown
|
Matlab
|
Objective-C
|
OCaml
|
Pascal
| |
Perl
|
PHP
|
PowerShell
|
Prolog
|
Python
| |
R
|
Ruby
|
Rust
|
Scala
|
Shell
| |
SQL
|
Swift
|
TeX
|
TOML
|
TypeScript
| |
Verilog
|
Visual Basic
|
XML
|
YAML
| |

With a guessing accuracy higher than 90%.

Apps powered by Guesslang

Microsoft Visual Studio Code, automatic language detection

Visual Studio Code detects the programming language of the source code that you paste into the editor using Guesslang machine learning model.

Chameledit

Chameledit is a simple web-editor that automatically highlights your code.

Other projects...
  • Pasta, the Slack bot that pretty-pastes source code.
  • GG, a silly guessing game.

Documentation

  • Guesslang documentation is available at https://guesslang.readthedocs.io/en/latest/

  • Guesslang language detection explained here https://guesslang.readthedocs.io/en/latest/contents.html#how-does-guesslang-guess

  • Guesslang is based on Tensorflow machine learning framework

Installation

  • Python 3.7+ is required

  • Install the latest stable version:

pip3 install guesslang
  • or install Guesslang from source code:
pip3 install .
  • Windows specific

To run Tensorflow on Microsoft Windows you need to install Visual C++ runtime libraries, available on Microsoft website

Guesslang command line

  • Show all available options
guesslang --help
  • Detect the programming language of
    /etc/bashrc
    configuration file:
guesslang /etc/bashrc

⟶ Programming language: Shell

  • Detect the programming language of a given text:
echo '
/** Turn command line arguments to uppercase */
object Main {
  def main(args: Array[String]) {
    val res = for (a 
  • Show the detection probabilities for a given source code:
echo "
def qsort(items):
    if not items:
        return []
    else:
        pivot = items[0]
        less = [x for x in items if x <  pivot]
        more = [x for x in items[1:] if x >= pivot]
        return qsort(less) + [pivot] + qsort(more)


if name == 'main': items = [1, 4, 2, 7, 9, 3] print(f'Sorted: {qsort(items)}')

" | guesslang --probabilities

Language name Probability

Python 74.80%

Haskell 6.73%

CoffeeScript 5.32%

Groovy 1.95%

Markdown 0.93%

...

Guesslang Python package

from guesslang import Guess


guess = Guess()

name = guess.language_name(""" % Quick sort

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

qsort([]) -&gt; [];
qsort([Pivot|T]) -&gt;
      qsort([X || X = Pivot]).

""")

print(name) # ⟶ Erlang

License and credits

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.