Skip to main content

word ladder find path between two words, changing one letter each step

Project description

Find path from one word to another, changing one letter each step, and each intermediate word must be in the dictionary, the dictionary is a text file with words separated by a line break like the one found in /usr/share/dict/words

Prerequisites

  • Python 3.4 and Linux

  • List of words separated by newlines

  • Virtual environment is recommended

Documentation

Installing

Clone the repository (Pypi package comming soon)

$ git clone git@github.com:snebel29/word_ladder.git
$ cd word_ladder

Production

$ pip install .

Development

$ pip install -e .[dev]

Getting started

The word_ladder packges commes with both, a command line tool and a module that can be used to find word ladder paths

Command line tool

Once installed you can use the command line interface

$ word_ladder -h

Python module

You can import and use the module directly as well

>>> from word_ladder import WordLadder
>>> wl = WordLadder('tests/word_lists/linux_english_words')
>>> wl.find_path('fear', 'sail')
['fear', 'hear', 'heir', 'hair', 'hail', 'sail']
>>> wl.find_path('Abe', 'sail')
['Abe', 'be', 'bed', 'bid', 'aid', 'said', 'sail']
>>> wl.find_path('Am', 'sail')
['Am', 'am', 'aim', 'ail', 'sail']

Running the tests

You will have to use nose to run the tests

$ nosetests

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

word-ladder-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file word-ladder-1.0.0.tar.gz.

File metadata

  • Download URL: word-ladder-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for word-ladder-1.0.0.tar.gz
Algorithm Hash digest
SHA256 26883b031f56b4d5caf93fb2de8adc1b38688749fe5a8a74797f840459db3c71
MD5 67066e68465fa5d956f712d445c96fb3
BLAKE2b-256 e552e3e157982b2ce3ff3ab852c65b40817bcef897fb0b103f8e7d62e35d182d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page