Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 24 more languages, including JSON, Kotlin, XML, YAML etc... #33

Merged
merged 23 commits into from
Jul 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
83b6309
Support 14 more languages, including JSON, Kotlin, XML, YAML etc...
dzrcopilot Jun 29, 2021
5338087
Update model to support even more languages
dzrcopilot Jul 20, 2021
db7378c
Update to a better trained model
dzrcopilot Jul 24, 2021
3044b1b
Update documentation
dzrcopilot Jul 24, 2021
1aad0f1
Update README and version
dzrcopilot Jul 24, 2021
e4d7901
Fix languages list
dzrcopilot Jul 24, 2021
41c7caf
Improve doc
dzrcopilot Jul 24, 2021
2808795
Increase Python minimal supported version to 3.7 because of Tensorflo…
dzrcopilot Jul 24, 2021
54601b1
Remove references to Travis CI
dzrcopilot Jul 24, 2021
e3567e3
Try default doc theme
dzrcopilot Jul 24, 2021
c7dd91f
Remove duplicated Python example
dzrcopilot Jul 24, 2021
d89500b
Update documentation
dzrcopilot Jul 25, 2021
b934a59
Update documentation, part 2
dzrcopilot Jul 25, 2021
00e1c39
Improve doc
dzrcopilot Jul 25, 2021
198352a
Update to a more performant model
dzrcopilot Jul 25, 2021
3f8d34a
Update doc
dzrcopilot Jul 25, 2021
3921f1a
Update the probabilities to match the last version of the model
dzrcopilot Jul 25, 2021
d752d2b
Update the probabilities to match the last version of the model, part 2
dzrcopilot Jul 25, 2021
2898136
Remove extra line before import
dzrcopilot Jul 25, 2021
b3ed317
Fix Python style issues
dzrcopilot Jul 25, 2021
4b526fa
Update the probabilities to match the last version of the model, part 3
dzrcopilot Jul 25, 2021
f67e7b1
Add a trailing newline to the language JSON file
dzrcopilot Jul 25, 2021
0fa9dd0
Reorganise the accuracy limitation parts of the doc
dzrcopilot Jul 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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