Coder Social home page Coder Social logo

charlesreid1 / five-letter-words Goto Github PK

View Code? Open in Web Editor NEW
79.0 5.0 316.0 64 KB

Experiments with Knuth's 5,757 five letter words.

Home Page: https://charlesreid1.com/wiki/Five_Letter_Words

License: MIT License

Python 100.00%
knuth dynamic-programming algorithms art-of-computer-programming python graph-theory

five-letter-words's Introduction

five-letter-words

This repository contains Donald Knuth's GraphBase list of five-letter words, as well as scripts to run various combinatoric experiments, graph algorithms, and other algorithms to explore the relationships among these words.

The list of words comes from [1] and is in the public domain.

Get Words

A Python program that contains a method for getting all of the five letter words from a file, and that's about it.

Warm Up Exercises

Exercises 26-37 of Knuth's Volume 4 Fascile 0 are intended as a warm up to get to know the SGB five letter word list. Solutions to these exercises are listed below.

distinct.py- computes the number of SGB words containing exactly k distinct letters.

diff_by_one_fixed.py - (fixed 2019-03-09) computes the number of words in the SGB that are off by a single letter in each position. An example is rover and spuds. Each corresponding letter is only different by one: r -> s, o->p, and so on. This uses recursive backtracking to generate possible matches for each word, and uses a hash table to check for their existence in the original word set.

There are 38 such pairs in the SGB.

Also see Five Letter Words on the charlesreid1.com wiki.

diff_by_n_fixed.py - (added 2019-03-10.) using the corrected approach (above) to computing differences by 1, this generalizes the calculation to words that are different by a distance d for each letter position.

Also see Five Letter Words: Part 4: Revisiting Diff by One (blog post) on charlesreid1.github.io.

euclidean_distance.py - computes the euclidean distance between two words. This uses the traditional Euclidean distance definition but reinterprets distance to mean edit distance.

lexico.py - find words that are sorted by lexicographic order (front to back, a-z).

palindromes.py - look for five letter words that are either a palindrome, or a palindrome pair.

Variations

diff_by_n.py - computes words in SGB that have an edit distance of n.

reverse_lexico.py - variation on lexico.py that finds words whose letters are in reverse lexicographic order.

Letter Coverage

letter_coverage.py - computes coverage of the alphabet (minimum number of words required to provide X letters of the alphabet)

Knuth mentions, in the text, a couple of facts about how many words cover how much of the alphabet. We authored a dynamic program to compute precisely this - given a number of letters N from the alphabet, this program computes the minimum number of words it takes to cover all N letters.

Also see Letter Coverage page on the charlesreid1.com wiki.

Sources

  1. Knuth, Donald. The Stanford GraphBase: A Platform for Combinatorial Computing. New York: ACM Press, 1994. <http://www-cs-faculty.stanford.edu/~knuth/sgb.html>

five-letter-words's People

Contributors

charlesreid1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.