Skip to main content

This is NOT A TYPOSQUATTING PACKAGE

It's a fork of the original https://github.com/yoeo/guesslang / pypi package guesslang

Reason of fork - abandoned project. I need a specific patch. Fixing tensorflow dependency myself until https://github.com/yoeo/guesslang/pull/62 is merged

Install:

pip install guesslang-experimental

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

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 <- args) yield a.toUpperCase
    println("Arguments: " + res.toString)
  }
}
' | guesslang

# ⟶ Programming language: Scala
  • 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([]) -> [];
    qsort([Pivot|T]) ->
          qsort([X || X <- T, X < Pivot])
          ++ [Pivot] ++
          qsort([X || X <- T, X >= Pivot]).
""")

print(name)  # ⟶ Erlang

License and credits

Metadata

Release files for guesslang-experimental 2.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guesslang-experimental 2.2.3
File Size Uploaded Provenance Actions
guesslang-experimental-2.2.3.tar.gz 2.6 MB Without provenance Details for guesslang-experimental-2.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for guesslang-experimental 2.2.3
File Interpreter ABI Platform Actions
guesslang_experimental-2.2.3-py3-none-any.whl Python 3 none any Details for guesslang_experimental-2.2.3-py3-none-any.whl

Total release size: 5.1 MB

Release files / guesslang-experimental-2.2.3.tar.gz

Download URL guesslang-experimental-2.2.3.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
cc358f409617dad7a39fd9a4d22e3b7b94af359479d07ae7145395a2b1ca2b13
BLAKE2b-256 checksum
How to use checksums
87ebaded702be20b6c12273995c1e22cbe3d134203425a5f7df17a7cd50b1534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / guesslang_experimental-2.2.3-py3-none-any.whl

Download URL guesslang_experimental-2.2.3-py3-none-any.whl
Size 2.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1cd7a451f735e966eb294900c2054bb9bf113f930a564128db46181964a523f9
BLAKE2b-256 checksum
How to use checksums
f84293d02f5d6c64fd2a68f95276f0383a8da1b580533113ef55f9bdfb8de654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Security for guesslang-experimental 2.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.2.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page