Coder Social home page Coder Social logo

ashwin-dara / dehko Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.15 MB

NLP smart automation assistant to boost developer workflow. Make scripting and executing scripts effortless!

Python 97.55% Dockerfile 2.45%
nlp youtube-api python-3 javascript react-js keras discord-api rest-api sql data-structures nlp-parsing regex nodejs cnn-classification mongodb tensorflow distributed-systems

dehko's Introduction

DehkoπŸ’‘- The NLP Automation Assistant

Dehko Banner

Dependencies Version Tests

Dehko is a multi-OS NLP smart assistant tool built to easily automate non-developer and developer tasks. Dehko allows you to eliminate the baggage of inflexible syntax/semantics that are involved with the other usual forms of automation (scripts, macros, niche applications, settings, etc).

Dehko allows you to define custom sequences by defining a command and associated keyphrases that correspond to that command. Moreover, there’s no need to worry about remembering these keyphrases. Dehko uses NLP to parse, evaluate, and classify your input, ensuring that the process of converting natural, human language into understandable instructions is highly accurate.

Dehko is highly customizable yet simple to use. All modifications are handled by simply editing a single JSON configuration file, and relevant metadeta will be displayed everytime any scripts are run to help provide clarity in what's happening under the hood.

Installation

There are two forms of installations. The first option, which gives more persmissions to Dehko to make modifications to your computer (), would be using virtual environments. The second is through downloading the containerized version of Dehko by pulling the Docker image from Docker hub. The tradeoff between these two is that the first option allows for scripts that potentially involve opening applications on your host computer. Moreover, the first method is significantly less resource intensive on your computer.

Installation via "venv"

First clone this repository using the following command into your specified directory.

foobar@Foo:/home/$ git clone [email protected]:Ashwin-Dara/Dehko.git

Afterwards, cd into the directory "/Dehko/utils/venv/Scripts" through the following set of commands.

foobar@Foo:/home/$ cd Dehko/utils/venv/Scripts 

Before proceeding ensure that venv is installed on your system. For directions on how to install venv, please check this reference: https://pypi.org/project/virtualenv/.

After this, activate the virtual environment. For machines based on Windows, the command is activate.bat, which will execute the appropriate .bat script. For unix-based machines (all other machines), activate the virtual environment through the following command.

foobar@Foo:/home/Dehko/utils/venv/Scripts$ source activate

After this command you will notice a changed prefix in your current working directory displayed in the terminal. This means that the environment has been activated. For double measures, run the following command to ensure that all dependencies are successfully installed within your virtual environment.

(/home/Dehko/utils/Scriptsfoobarutils.1env) foobar@Foo:/home/Dehko/utils/venv/Scripts$ pip3 install -r ../requirements.txt

After doing this, Dehko is ready to use! For potentially making this process more streamlined, consider a single bash script with an activation command of your choice.

Installation via Docker Hub

First ensure that Docker is installed on your system. Afterwards, pull the Docker image for Dehko from Docker hub using the following command.

foobar@Foo:/home/$ docker pull 3415266/dehko

This will pull the Docker image of Dehko. Afterwards, build the image using the following command within the appropriate directory:

foobar@Foo:/home/$ docker build -t 3415266/dehko .

Dehko should be now ready to run! To ensure, run the container and Dehko's help flag using docker run 3415266/dehko "--help". For the sake of speed and convenience, the first installation method is strongly preferred.

Customization and Usage

To customize Dehko – such as defining a custom command and associated phrases – there are two steps to it.

The first step would be to modify the primary JSON configuration file. This is located under the the directory Dehko/utils would be to modify a JSON file "settings.json.” The purpose of this step is to inform Dehko what new commands are being added and the associated phrases for that command. Currently, Dehko comes with 3 default commands. Copy the layout of one of these and modify the fields appropriately.

The second step is to actually define the sequence for Dehko to execute once the command is matched. Dehko is primarily built on Python, which allows for powerful scripting capabilities. To define a new script associated with the entry just added within the JSON file, it’s recommended to create a new Python file with the code that should be executed for that command. Then within the file, β€œcommands to mapping” dictionary, add the function that you define within the dictionary.

Here’s a complete example of adding a new command named β€œWeb Workflow” that will open Google Chrome when Dehko classifies the command as such. Let’s begin by modifying the JSON file. Here is what the new entry would look like:

{
 {
  command: "Web-Workflow", 
  phrases: ["open web workflow", "open tabs", "web workflow", "workflow"]
 }
}

Then, we need to actually write the code to be executed whenever the β€œWeb Workflow” command is classified. First let’s create a new Python file with the name β€œweb-workflow-action.py.” Then within that file, let’s add the following content within that file:

import subprocess

def web-workflow(workflow_number):

	# If the workflow number is one, then we will Open firefox
	if workflow_number == 1: 
		subprocess.call(['C:\Program Files\Mozilla Firefox\\firefox.exe'])
		return 

	# If it is anything else, we will execute Google Chrome
	subprocess.call(['C:\Program Files\Google Chrome\\chrome.exe'])	

After making any modifications to Dehko, it needs to be retrained. To re-optimize Dehko and run the command just created, we would use the following code:

foo@bar:~$python3 ../../CLIParser.py train
Dehko (1.02)

Retraining Dehko to reflect updates made in settings.json & enhance classification accuracy!

Optimizing Neural Network: |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 50/50

Epoch 1/350
1/1 [==============================] - 4s 4s/step - loss: 3.2184 - accuracy: 0.0400
Epoch 2/350
1/1 [==============================] - 0s 14ms/step - loss: 3.2176 - accuracy: 0.0400
Epoch 3/350
1/1 [==============================] - 0s 10ms/step - loss: 3.2168 - accuracy: 0.0400
...
...
...
Epoch 348/350
1/1 [==============================] - 0s 12ms/step - loss: 0.3920 - accuracy: 1.0000
Epoch 349/350
1/1 [==============================] - 0s 11ms/step - loss: 0.3893 - accuracy: 1.0000
Epoch 350/350
1/1 [==============================] - 0s 12ms/step - loss: 0.3867 - accuracy: 1.0000

foo@bar:~$ python3 ../../CLIParser.py "open web workflow ~1"
Dehko 1.02
Executing Scripts |
1/1 [==============================] - 1s 522ms/step


Message Parser Details
Description of Command: `open web workflow ~1`. Argument[s] Detected: `1`
Task Completed! Executed the script associated with the procedure: web-workflow.

Directory Structure

Here is a overview of the directory structure, highlighting the most important directories and the most relevant files.

flowchart TD
id2(Dehko) ---> id3(/utils) & id4(/drafts) & id5(/pragma) & id6(/subrepo)
id3 ---> id7(settings.json)
id5 ---> idpublic(/public) & idsrc(/src)
id4 ---> idimgs(/images)
Loading

Folders

  • utils - contains all of the logic of Dehko, written in Python. Also contains the dependencies list in requirements.txt.
  • drafts - contains all images used within this project.
  • pragma - folder containing the react application
  • subrepo - any external utilities for particular functionality

Files

  • settings.json - this configuration file is what will be modified in order to customize the functionality of Dehko up to the client needs. This is one of the most important files in terms of ensuring that Dehko functions as intended.

Resources

dehko's People

Contributors

ashwin-dara avatar

Watchers

 avatar

dehko's Issues

Message Cycle Testing

Parsing through messages sent from the client must be robust. Currently, inaccuracies may be arising from regex patterns that may not be completely correct.

In order to ensure we are parsing through the client messages correctly and handling the appropriate test cases, we need to create a file dedicated to unit testing. We should have functions that generally test the following:

  1. Regex pattern matching (in particular, we want to ensure we always detect a ping)
  2. Arg pattern matching (the argument in addition to the command is always identified)
  3. Edge cases regarding messages

Vectorization Issue

Currently, when trying to process the inputs into the numerical format for the model, there is an issue with the data type most likely. "Invalid literal for int() with base 10." Need to debug what this means exactly and make changes without compromising the design of the model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.