Skip to content

Commit

Permalink
Merge pull request #33 from yoeo/more_languages
Browse files Browse the repository at this point in the history
Support 24 more languages, including JSON, Kotlin, XML, YAML etc...
  • Loading branch information
yoeo authored Jul 25, 2021
2 parents a316ddf + 0fa9dd0 commit fb26de4
Show file tree
Hide file tree
Showing 23 changed files with 234 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ build:
image: latest

python:
version: 3.6
version: 3.7
setup_py_install: false

requirements_file: requirements-dev.txt
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Y. SOMDA
Copyright (c) 2021 Y. SOMDA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
46 changes: 25 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Guesslang [![Build Status](https://travis-ci.org/yoeo/guesslang.svg?branch=master)](https://travis-ci.org/yoeo/guesslang) [![Documentation Status](https://readthedocs.org/projects/guesslang/badge/?version=latest)](http://guesslang.readthedocs.io/en/latest/?badge=latest)
# Guesslang [![Build Status](https://github.com/yoeo/guesslang/actions/workflows/python-package.yml/badge.svg)](https://github.com/yoeo/guesslang/actions) [![Documentation Status](https://readthedocs.org/projects/guesslang/badge/?version=latest)](http://guesslang.readthedocs.io/en/latest/?badge=latest) [![Pypi version](https://img.shields.io/pypi/v/guesslang.svg)](https://pypi.python.org/pypi/guesslang)


![Guesslang](docs/_static/images/guesslang-small.png)
![Guesslang](docs/_static/images/guesslang-readme.png)

Guesslang detects the programming language of a given source code:

Expand All @@ -21,14 +20,19 @@ func main() {

Guesslang supports `30 programming languages`:

| 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` |
| 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%**.

Expand Down Expand Up @@ -65,7 +69,7 @@ that pretty pastes source code.

## Installation

* Python 3.6+ is required
* Python 3.7+ is required

* Install the latest stable version:

Expand Down Expand Up @@ -93,10 +97,10 @@ available on [Microsoft website](https://www.microsoft.com/en-us/download/detail
guesslang --help
```

* Detect the programming language of ``/bin/which``:
* Detect the programming language of ``/etc/bashrc`` configuration file:

```bash
guesslang /bin/which
guesslang /etc/bashrc

# ⟶ Programming language: Shell
```
Expand Down Expand Up @@ -138,12 +142,12 @@ if __name__ == '__main__':
" | guesslang --probabilities

# Language name Probability
# Python 80.53%
# Batchfile 6.16%
# CoffeeScript 2.18%
# Markdown 1.66%
# JavaScript 1.47%
# ...
# Python 74.80%
# Haskell 6.73%
# CoffeeScript 5.32%
# Groovy 1.95%
# Markdown 0.93%
# ...
```

## Guesslang Python package
Expand Down Expand Up @@ -191,4 +195,4 @@ print(name) # ⟶ Erlang
* Example source codes used here retrieved from
[Rosetta Code](https://rosettacode.org/wiki/Sorting_algorithms/Quicksort)

* Guesslang — Copyright (c) 2020 Y. SOMDA, [MIT License](LICENSE)
* Guesslang — Copyright (c) 2021 Y. SOMDA, [MIT License](LICENSE)
15 changes: 0 additions & 15 deletions continious-integration.sh

This file was deleted.

13 changes: 13 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
h1 {
margin-top: 50px;
}
h2 {
font-size: 125% !important;
}
.gl-confusion {
display: inline-block;
font-style: italic;
}
.gl-confusion::first-letter {
font-style: normal;
}
3 changes: 0 additions & 3 deletions docs/_static/custom.css

This file was deleted.

Binary file modified docs/_static/images/confusion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file modified docs/_static/images/guesslang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_static/images/loss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 12 additions & 11 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import re
import sys

import sphinx_rtd_theme


# Add Guesslang path for autodoc
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
Expand All @@ -34,7 +36,7 @@ def read_version(base_module):


project = 'Guesslang'
copyright = '2020, Y. SOMDA'
copyright = '2021, Y. SOMDA'
author = 'Y. SOMDA'

# The full version, including alpha/beta/rc tags
Expand All @@ -46,7 +48,7 @@ def read_version(base_module):
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.autodoc', 'sphinx_rtd_theme']
autodoc_mock_imports = ['tensorflow']
master_doc = 'index'

Expand All @@ -64,20 +66,19 @@ def read_version(base_module):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


html_theme_options = {
'logo': 'images/guesslang.png',
html_logo = '_static/images/guesslang.png'
html_favicon = '_static/images/favicon.png'
html_css_files = ['css/custom.css']
html_context = {
'display_github': True,
'github_user': 'yoeo',
'github_repo': 'guesslang',
'description': 'A programming language detection tool',
'logo_name': True,
'travis_button': True,
'sidebar_collapse': False,
'github_version': 'master/docs/',
}
html_theme_options = {'collapse_navigation': False}
Loading

0 comments on commit fb26de4

Please sign in to comment.