Skip to content

ADKATT/laravel8-string-metrics

Repository files navigation

About

With the help of this application you can calculate the Hamming distance (substitution values only) and Levenshtein distance of the given strings.

Screenshots

User Interface to calculate distance from Browser Home Page

Input Field Validation Error: Home Page with form error

Response Home Page with response

Installation

Here is how you can run the project locally:

  1. Clone this repo
     git clone {REPOSITORY_URL}
  2. Go into the project root directory
     cd /distance-calculator
  3. Copy .env.example file to .env file
     cp .env.example .env
  4. Run the following command to install the dependency
     composer install
  5. Run the command to serve the project
     php artisan serve
  6. Open this link in your browser http://127.0.0.1:8000

Run Calculation Using CLI

  1. Goto your project directory using the following command.
     cd ./distance-calculator
  2. Run this command
     php artisan app:calculate
  3. Input first string and hit enter.
  4. Input second string and hit enter.
  5. You should see the distance calculation of both the strings in the result.

CLI Output

Unit Tests

  1. Goto the project directory using the following command.
     cd ./distance-calculator
  2. Run this command
     php artisan test

Unit Test

Folder Structure

We are using the following files in this project.

  • Controllers
    • App\Http\Controllers\IndexController.php
  • Validation Requests
    • App\Http\Requests\Index.php
  • Routes
    • Routes\Web.php
  • View Templates
    • Resources\Views\layouts\app.blade.php
    • Resources\Views\index.blade.php
  • Console Commands
    • App\Console\Commands\CalculationCommand.php
  • Test Cases
    • Tests\Feature\IndexControllerTest.php
    • Tests\Unit\CalculationTest.php

About

Web for Calculating Hamming & Levenshtein Distance Between The Given Strings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors