Coder Social home page Coder Social logo

adrienperonnet / typos Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 29 KB

Compute shortest edit-distance path between two words

License: MIT License

Rust 100.00%
astar-pathfinding shortest-paths shortest-pathfinding-algorithm edit-distance-algorithm

typos's Introduction

Build Status

Context

This tweet made me build this tool.

Description

Compute the shortest distance between two words of a given set. The result will be the path minimizing edit distance between each word in the path. Result could be used to perform the social engineering idea of the tweet.

Example

$wget https://raw.githubusercontent.com/smashew/NameDatabases/master/NamesDatabases/first%20names/all.txt

$./typos all.txt adrien pierre
Using input file: all.txt with astar algorithm to compute shortest path between adrien and pierre
19950 words loaded into memory
Shortest path found in 546.55645ms: adrien->adrian->adria->aria->iria->ira->iera->piera->piere->pierre (achieved in 9 1-letter mutation)

$./typos all.txt adrien maximilien
Using input file: all.txt with astar algorithm to compute shortest path between adrien and maximilien
19950 words loaded into memory
Shortest path found in 121.622294335s: adrien->adriel->ariel->mariel->marie->maxie->maxime->maxima->maximina->maximilia->maximilian->maximilien (achieved in 9 1-letter mutation + 2 2-letter mutation)

So, in practice, if you want to change a plane ticket from:

  • Adrien to Pierre you'll have to make 9 phone calls to claim for a typo in your first name
  • Adrien to Maxime you'll have to make 11 phone calls to claim for a typo. 2 of those phone calls might be harder because they required a 2-letters change.

Usage

$typos --help
Find a short path between two input words

USAGE:
    typos <INPUT> <START> <END> [ALGORITHM]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <INPUT>        Sets the input file to use
    <START>        starting word
    <END>          ending word
    <ALGORITHM>    algorithm to use to compute shortest path [default: astar]  [possible values: astar, idastar,
                   dijkstra, fringe]

Disclaimer

This is a project done for fun, in order to learn Rust :) Of course this is not intended for real-life use and should not be used to perform illegal activities.

typos's People

Watchers

 avatar

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.