Skip to content

Anrighe/SMILE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Mistake Identifier Lookup Engine

This is a simple C++ software used to identify spelling mistakes of binaries typed in the bash shell, and correct them by suggesting a similar binary currently installed in the operative system.


External Dependencies


Installing Dependencies

On Debian-based systems:

sudo apt-get install nlohmann-json3-dev libspdlog-dev libboost-all-dev libsqlitecpp-dev

Steps of the algorithm:

  1. An incorrect command is executed on the shell.
  2. The system cannot find the binary in the directories listed in the $PATH and triggers the command_not_found_handle() function.
  3. The SMILE program is executed, passing the not-found command as an argument.
  4. SMILE scans the system for installed binaries by examining directories specified in its configuration file
  5. If enabled on the settings file, the program uses an heuristic approach to filter those binaries of which length and individual characters mismatches exceed a specified threshold.
  6. For each resulting found binary, SMILE calculates the Damerau-Leveshtein distance.
  7. Binaries with a Damerau-Levenshtein distance within the defined threshold are suggested to the user as potential corrections.

Configuration

SMILE uses a settings.json file to define its behavior. Below is an example configuration:

{
  "databaseHistoryStorageEnabled": false,   // WIP
  "ignoreMntFromSystemPathVariables": true, // Ignores paths that starts with /mnt/ from the lookup of binaries
  "lengthConditionHeuristic": 2,            // Heuristic length condition to apply prior to the Damerau-Leveshtein distance calculation
  "lengthConditionHeuristicEnabled": true,
  "systemBinariesPath": [                   // List of path for the binaries lookup
    "/usr/local/sbin",
    "/usr/local/bin",
    "/usr/sbin",
    "/usr/bin",
    "/sbin",
    "/bin",
    "/usr/games",
    "/usr/local/games"
  ]
}

About

Simple Mistake Identifier Lookup Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published