Compare commits
3 Commits
d64e1004d6
...
d4cfefac7c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4cfefac7c | ||
|
|
932dcac87f | ||
|
|
3789bd415d |
@@ -11,7 +11,7 @@
|
||||
"A [***portmanteau***](https://en.wikipedia.org/wiki/Portmanteau) is a word that squishes together two words, like ***mathlete*** = ***math*** + ***athlete***. Inspired by [**Darius Bacon**](http://wry.me/), I covered this as a programming exercise in my 2012 [**Udacity course**](https://www.udacity.com/course/design-of-computer-programs--cs212). In 2018 I was re-inspired by [**Tom Murphy VII**](http://tom7.org/), who added a new twist: [***portmantout words***](http://www.cs.cmu.edu/~tom7/portmantout/) ([***tout***](https://www.duolingo.com/dictionary/French/tout/fd4dc453d9be9f32b7efe838ebc87599) from the French for *all*).\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Informally, **portmantout** means that you take all the words in a set and mush them together in some order such that each word overlaps the next. More formally. a partmantout of a set of words *W* is a string *S* constructed as follows:\n",
|
||||
"Informally, **portmantout** means that you take all the words in a set and mush them together in some order such that each word overlaps the next. More formally, a partmantout of a set of words *W* is a string *S* constructed as follows:\n",
|
||||
"- Make an ordered list *L* that contains all the words in *W*.\n",
|
||||
"- It is allowable for a word to appear more than once in *L*.\n",
|
||||
"- Every word in *L* (except the first) must *overlap*: it must begin with a prefix that is the same as a suffix of the previous word.\n",
|
||||
@@ -71,7 +71,7 @@
|
||||
"| ajar|arbitrary|ar||*unused word* |-2|\n",
|
||||
"| ajar|rabbits|r||*unused word*|-1|\n",
|
||||
"| ajar|argot|ar|goths|*one-step bridge* |0|\n",
|
||||
"| ajar|arrow|ar|owlets| *one-step bridge*|1 (r)\n",
|
||||
"| ajar|arrow|ar|owlets| *one-step bridge*|1 (r)|\n",
|
||||
"| ajar|rani, iraq|r|quizzed| *two-step bridge*|5 (anira) | \n",
|
||||
"\n",
|
||||
"Let's go over the examples:\n",
|
||||
@@ -719,7 +719,9 @@
|
||||
"\n",
|
||||
"def missing_bridges(W: Wordset) -> list[str]:\n",
|
||||
" \"\"\"What 1-letter-suffix to 1-letter-prefix bridges are missing from W.bridges?\"\"\"\n",
|
||||
" return [A + B for (A, B) in letter_pairs if B not in W.bridges[A]]"
|
||||
" return [A + B for (A, B) in letter_pairs if B not in W.bridges[A]]\n",
|
||||
"\n",
|
||||
"assert not missing_bridges(W)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -919,7 +921,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Yes, there is a problem: there are many more words that start with `b`, `f`, `p`, `u`, `u` and `v` than that end with those letters. In the other direction 45% of all words end in `s`, but only a quarter of that number start with `s`. The start:end ratio for `y` is 1:39."
|
||||
"Yes, there is a problem: there are many more words that start with `b`, `f`, `p`, `u`, and `v` than that end with those letters. In the other direction 45% of all words end in `s`, but only a quarter of that number start with `s`. The start:end ratio for `y` is 1:39."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user