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

From PyPi

$ pip install word-ladder

Manually

Clone the repository (Pypi package comming soon)

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

to install development dependencies as well

$ 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

Contributing

Clone development branch then create pull requests against it

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.1.0.tar.gz (5.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for word-ladder-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6c025b7ac8f4b80578cdf675442226fd7be192f1ddf80e959fc8758fb8548d3a
MD5 cdee0b2fcb39a121b472292f391544ab
BLAKE2b-256 4904f4655ad1ce25bb34743c7c441949d63459510dc6e842ff75872177c204af

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