wordle-aid


Namewordle-aid JSON
Version 2.7 PyPI version JSON
download
home_page
SummaryCLI program to filter word choices to aid solving Wordle game problems
upload_time2023-11-19 23:53:06
maintainer
docs_urlNone
author
requires_python>=3.6
licenseGPLv3
keywords wordle
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## WORDLE-AID
[![PyPi](https://img.shields.io/pypi/v/wordle-aid)](https://pypi.org/project/wordle-aid/)
[![AUR](https://img.shields.io/aur/version/wordle-aid)](https://aur.archlinux.org/packages/wordle-aid/)

[wordle-aid](http://github.com/bulletmark/wordle-aid) is a Linux command
line program to filter word choices to aid solving
[Wordle](https://www.powerlanguage.co.uk/wordle/) problems. You run this
program specifying your previous guesses and results, and then the
program outputs a list of candidate words in English frequency usage
order to your terminal. Wordle-aid uses the
[pyspellchecker](https://pyspellchecker.readthedocs.io/en/latest/#)
package for its source of English dictionary words and frequencies.

The following example Wordle (#21) solution illustrates how to use it.

![wordle solution](https://github.com/bulletmark/wordle-aid/raw/main/wordle-example.png)

1. Choose any starting word as normal. You can even use `wordle-aid` to
   help with this, e.g.

    ```
    # print all 5 letter words, in reverse frequency order to screen:
    $ wordle-aid .....

    # Or, print all 5 letter words with at least 3 vowels:
    $ wordle-aid -v3 .....

    # Or, print all 5 letter words with at least 3 vowels and all unique letters:
    $ wordle-aid -v3 -u .....
    ```

2. We choose our favorite starting word **TRACE** as the first guess,
   which gives the result shown on the first line of the image above.
   Based on this result, run:

    ```
    $ wordle-aid TracE ..a..
    neath 55
    keats 57
    yeats 148
    beaut 168
    exalt 352
    leant 380
    heath 467
    meaty 726
    meats 1028
    feats 1189
    heats 1539
    yeast 1587
    leapt 1884
    feast 12436
    seats 18355
    dealt 19971
    beast 22995
    beats 31332
    meant 212776
    death 285290
    least 456376
    ```

   The output above is the list of possible candidate words, given the
   command line word arguments you have specified.

   Note: Specify the 1st guess word you used and set each yellow (i.e.
   correct but incorrect position) letter to upper-case, and other
   letters to lower-case. Specify all green (i.e. correct and in
   position) letters you have found so far in the right (wildcard) field
   in their correct position.

3. Choose a word from the suggestion list output from above command. We
   choose to enter the highest frequency candidate **LEAST** from the
   list, which gives the result shown on the second line in the
   image above. Then run:

    ```
    $ wordle-aid TracE leasT .ea..
    neath 55
    heath 467
    meaty 726
    death 285290
    ```

4. Choose a word from the suggestion list output from the above command.
   We choose to enter the highest frequency result **DEATH**, which
   gives us the final correct answer.

In summary, specify `.....` (all wildcards) as your starting result and
insert characters to it as your find them, i.e. all green letters from
each guess. Note that the number of wildcard characters determines the
Wordle game word size (e.g. `wordle-aid bundle ......` for a 6 letter
game). Specify your previous word guesses earlier on the command line.
They don't actually have to be in the order that you guessed them
although likely you will be re-editing from your command history so they
will be. Yellow letter guesses (i.e. letter valid but in incorrect
place) are entered as upper case, and dark/grey letter guesses (i.e.
letter not present anywhere) are entered as lower case. Green letters
(i.e. letter valid and in correct place) can be lower or upper case in
the earlier word arguments, but **must** be specified in the final
wildcard word (as either lower or upper case) .

## Example Minimal Solver

Wordle-aid also includes an example solver, invoked by the `-s/--solve`
option to solve in the mininum number of steps assuming the most
frequent candidate word is chosen each step. E.g to see an example
solution for the above word **DEATH**:

```
$ wordle-aid -s death
1 about [AbouT .....]
2 thank [THank ..a..]
3 death [death death] SOLVED
```

You can also specify 1 or more starting words, e.g if we start with the
same word **TRACE** as we chose for the opening example above then we
get the same sequence of word candidates as the example (because
wordle-aid selects the highest frequency candidate each step as we
manually did in the example).

```
$ wordle-aid -s trace death
1 trace [TracE ..a..]
2 least [leasT .ea..]
3 death [death death] SOLVED
```

Or, use a different second word for the example:

```
$ wordle-aid -s trace stamp death
1 trace [TracE ..a..]
2 stamp [sTamp ..a..]
3 death [death death] SOLVED
```

But default, unless you have specified a word for a step, wordle-aid
selects the highest frequency word candidate each solver iteration. To
introduce some randomness, you can instead tell wordle-aid to randomly
choose a candidate from within the top N candidates by including the
`-r/--random` option, e.g:

```
$ wordle-aid -s -r20 death
1 right [rigHT .....]
2 hates [HATEs .....]
3 teach [Teach .ea.h]
4 neath [neath .eath]
5 death [death death] SOLVED
```

Or from the top N percentage of candidates:

```
$ wordle-aid -s -r20% death
1 bonus [bonus .....]
2 cigar [cigAr .....]
3 taped [TApED .....]
4 death [death death] SOLVED
```

## Simple Python API

This program takes command line options and arguments and then writes to
standard output. If you instead want to run it programmatically from
another calling python program (e.g. for a simulation/test) then you can
import and run it as a module. The main code is wrapped within a
function signature:

```python
def run(args: List[str], fp: TextIO = sys.stdout, *, read_start_options: bool = False) -> None
```

So you provide a list of option/argument strings and pass in a string
buffer which the program will write to instead of standard output. E.g,
as a simple example:

```python
#!/usr/bin/python3
import io
import wordle_aid

buf = io.StringIO()
wordle_aid.run('-v4 .....'.split(), buf)
topword = buf.getvalue().splitlines()[-1]

# Output top frequency 5 letter word which has 4 vowels:
print(topword.split()[0])
```

## Installation or Upgrade

Wordle-aid runs on pure Python and requires the
[pyspellchecker](https://pyspellchecker.readthedocs.io/en/latest/#) 3rd
party package.

Arch users can install [wordle-aid from the
AUR](https://aur.archlinux.org/packages/wordle-aid/).

Python 3.6 or later is required. Note [wordle-aid is on
PyPI](https://pypi.org/project/wordle-aid/) so just ensure that
[`pipx`](https://pypa.github.io/pipx/) is installed then type the
following:

```
$ pipx install wordle-aid
```

To upgrade:

```
$ pipx upgrade wordle-aid
```

## Command Line Options

Type `wordle-aid -h` to view the usage summary:

```
usage: wordle-aid [-h] [-l LANGUAGE] [-v VOWELS] [-u] [-w WORDS_FILE]
                     [-e EXCLUDE_WORDS_FILE] [-s] [-r RANDOM] [-c] [-V]
                     [words ...]

CLI program to filter word choices to aid solving Wordle game problems.

positional arguments:
  words                 list of attempted words. Upper case letter is right
                        letter but wrong place. Lower case letter is wrong
                        letter anywhere. Last word is wildcards for current
                        matches.

options:
  -h, --help            show this help message and exit
  -l LANGUAGE, --language LANGUAGE
                        pyspellchecker language dictionary to use,
                        default="en"
  -v VOWELS, --vowels VOWELS
                        exclude words with less than this number of unique
                        vowels
  -u, --unique          exclude words with non-unique letters
  -w WORDS_FILE, --words-file WORDS_FILE
                        filter dictionary to words in given text file. Use
                        multiple times to specify multiple files.
  -e EXCLUDE_WORDS_FILE, --exclude-words-file EXCLUDE_WORDS_FILE
                        exclude words in given text file. Use multiple times
                        to specify multiple files.
  -s, --solve           solve to final given word, starting with earlier given
                        words (if any)
  -r RANDOM, --random RANDOM
                        choose word for solver at each step randomly from
                        given number (or %) of top candidates, default=1
  -c, --no-colors       don't show colors in solver output
  -V, --version         show wordle-aid version

Note you can set default starting options in "~/.config/wordle-aid-
flags.conf".
```

## License

Copyright (C) 2022 Mark Blakeney. This program is distributed under the
terms of the GNU General Public License.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License at <http://www.gnu.org/licenses/> for more details.

<!-- vim: se ai syn=markdown: -->

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "wordle-aid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "wordle",
    "author": "",
    "author_email": "Mark Blakeney <mark.blakeney@bullet-systems.net>",
    "download_url": "https://files.pythonhosted.org/packages/83/ac/962e41f25cbbb16f6d85420dd471d3c6f63f5b05f8ed8ae0e702cfe57b2f/wordle-aid-2.7.tar.gz",
    "platform": null,
    "description": "## WORDLE-AID\n[![PyPi](https://img.shields.io/pypi/v/wordle-aid)](https://pypi.org/project/wordle-aid/)\n[![AUR](https://img.shields.io/aur/version/wordle-aid)](https://aur.archlinux.org/packages/wordle-aid/)\n\n[wordle-aid](http://github.com/bulletmark/wordle-aid) is a Linux command\nline program to filter word choices to aid solving\n[Wordle](https://www.powerlanguage.co.uk/wordle/) problems. You run this\nprogram specifying your previous guesses and results, and then the\nprogram outputs a list of candidate words in English frequency usage\norder to your terminal. Wordle-aid uses the\n[pyspellchecker](https://pyspellchecker.readthedocs.io/en/latest/#)\npackage for its source of English dictionary words and frequencies.\n\nThe following example Wordle (#21) solution illustrates how to use it.\n\n![wordle solution](https://github.com/bulletmark/wordle-aid/raw/main/wordle-example.png)\n\n1. Choose any starting word as normal. You can even use `wordle-aid` to\n   help with this, e.g.\n\n    ```\n    # print all 5 letter words, in reverse frequency order to screen:\n    $ wordle-aid .....\n\n    # Or, print all 5 letter words with at least 3 vowels:\n    $ wordle-aid -v3 .....\n\n    # Or, print all 5 letter words with at least 3 vowels and all unique letters:\n    $ wordle-aid -v3 -u .....\n    ```\n\n2. We choose our favorite starting word **TRACE** as the first guess,\n   which gives the result shown on the first line of the image above.\n   Based on this result, run:\n\n    ```\n    $ wordle-aid TracE ..a..\n    neath 55\n    keats 57\n    yeats 148\n    beaut 168\n    exalt 352\n    leant 380\n    heath 467\n    meaty 726\n    meats 1028\n    feats 1189\n    heats 1539\n    yeast 1587\n    leapt 1884\n    feast 12436\n    seats 18355\n    dealt 19971\n    beast 22995\n    beats 31332\n    meant 212776\n    death 285290\n    least 456376\n    ```\n\n   The output above is the list of possible candidate words, given the\n   command line word arguments you have specified.\n\n   Note: Specify the 1st guess word you used and set each yellow (i.e.\n   correct but incorrect position) letter to upper-case, and other\n   letters to lower-case. Specify all green (i.e. correct and in\n   position) letters you have found so far in the right (wildcard) field\n   in their correct position.\n\n3. Choose a word from the suggestion list output from above command. We\n   choose to enter the highest frequency candidate **LEAST** from the\n   list, which gives the result shown on the second line in the\n   image above. Then run:\n\n    ```\n    $ wordle-aid TracE leasT .ea..\n    neath 55\n    heath 467\n    meaty 726\n    death 285290\n    ```\n\n4. Choose a word from the suggestion list output from the above command.\n   We choose to enter the highest frequency result **DEATH**, which\n   gives us the final correct answer.\n\nIn summary, specify `.....` (all wildcards) as your starting result and\ninsert characters to it as your find them, i.e. all green letters from\neach guess. Note that the number of wildcard characters determines the\nWordle game word size (e.g. `wordle-aid bundle ......` for a 6 letter\ngame). Specify your previous word guesses earlier on the command line.\nThey don't actually have to be in the order that you guessed them\nalthough likely you will be re-editing from your command history so they\nwill be. Yellow letter guesses (i.e. letter valid but in incorrect\nplace) are entered as upper case, and dark/grey letter guesses (i.e.\nletter not present anywhere) are entered as lower case. Green letters\n(i.e. letter valid and in correct place) can be lower or upper case in\nthe earlier word arguments, but **must** be specified in the final\nwildcard word (as either lower or upper case) .\n\n## Example Minimal Solver\n\nWordle-aid also includes an example solver, invoked by the `-s/--solve`\noption to solve in the mininum number of steps assuming the most\nfrequent candidate word is chosen each step. E.g to see an example\nsolution for the above word **DEATH**:\n\n```\n$ wordle-aid -s death\n1 about [AbouT .....]\n2 thank [THank ..a..]\n3 death [death death] SOLVED\n```\n\nYou can also specify 1 or more starting words, e.g if we start with the\nsame word **TRACE** as we chose for the opening example above then we\nget the same sequence of word candidates as the example (because\nwordle-aid selects the highest frequency candidate each step as we\nmanually did in the example).\n\n```\n$ wordle-aid -s trace death\n1 trace [TracE ..a..]\n2 least [leasT .ea..]\n3 death [death death] SOLVED\n```\n\nOr, use a different second word for the example:\n\n```\n$ wordle-aid -s trace stamp death\n1 trace [TracE ..a..]\n2 stamp [sTamp ..a..]\n3 death [death death] SOLVED\n```\n\nBut default, unless you have specified a word for a step, wordle-aid\nselects the highest frequency word candidate each solver iteration. To\nintroduce some randomness, you can instead tell wordle-aid to randomly\nchoose a candidate from within the top N candidates by including the\n`-r/--random` option, e.g:\n\n```\n$ wordle-aid -s -r20 death\n1 right [rigHT .....]\n2 hates [HATEs .....]\n3 teach [Teach .ea.h]\n4 neath [neath .eath]\n5 death [death death] SOLVED\n```\n\nOr from the top N percentage of candidates:\n\n```\n$ wordle-aid -s -r20% death\n1 bonus [bonus .....]\n2 cigar [cigAr .....]\n3 taped [TApED .....]\n4 death [death death] SOLVED\n```\n\n## Simple Python API\n\nThis program takes command line options and arguments and then writes to\nstandard output. If you instead want to run it programmatically from\nanother calling python program (e.g. for a simulation/test) then you can\nimport and run it as a module. The main code is wrapped within a\nfunction signature:\n\n```python\ndef run(args: List[str], fp: TextIO = sys.stdout, *, read_start_options: bool = False) -> None\n```\n\nSo you provide a list of option/argument strings and pass in a string\nbuffer which the program will write to instead of standard output. E.g,\nas a simple example:\n\n```python\n#!/usr/bin/python3\nimport io\nimport wordle_aid\n\nbuf = io.StringIO()\nwordle_aid.run('-v4 .....'.split(), buf)\ntopword = buf.getvalue().splitlines()[-1]\n\n# Output top frequency 5 letter word which has 4 vowels:\nprint(topword.split()[0])\n```\n\n## Installation or Upgrade\n\nWordle-aid runs on pure Python and requires the\n[pyspellchecker](https://pyspellchecker.readthedocs.io/en/latest/#) 3rd\nparty package.\n\nArch users can install [wordle-aid from the\nAUR](https://aur.archlinux.org/packages/wordle-aid/).\n\nPython 3.6 or later is required. Note [wordle-aid is on\nPyPI](https://pypi.org/project/wordle-aid/) so just ensure that\n[`pipx`](https://pypa.github.io/pipx/) is installed then type the\nfollowing:\n\n```\n$ pipx install wordle-aid\n```\n\nTo upgrade:\n\n```\n$ pipx upgrade wordle-aid\n```\n\n## Command Line Options\n\nType `wordle-aid -h` to view the usage summary:\n\n```\nusage: wordle-aid [-h] [-l LANGUAGE] [-v VOWELS] [-u] [-w WORDS_FILE]\n                     [-e EXCLUDE_WORDS_FILE] [-s] [-r RANDOM] [-c] [-V]\n                     [words ...]\n\nCLI program to filter word choices to aid solving Wordle game problems.\n\npositional arguments:\n  words                 list of attempted words. Upper case letter is right\n                        letter but wrong place. Lower case letter is wrong\n                        letter anywhere. Last word is wildcards for current\n                        matches.\n\noptions:\n  -h, --help            show this help message and exit\n  -l LANGUAGE, --language LANGUAGE\n                        pyspellchecker language dictionary to use,\n                        default=\"en\"\n  -v VOWELS, --vowels VOWELS\n                        exclude words with less than this number of unique\n                        vowels\n  -u, --unique          exclude words with non-unique letters\n  -w WORDS_FILE, --words-file WORDS_FILE\n                        filter dictionary to words in given text file. Use\n                        multiple times to specify multiple files.\n  -e EXCLUDE_WORDS_FILE, --exclude-words-file EXCLUDE_WORDS_FILE\n                        exclude words in given text file. Use multiple times\n                        to specify multiple files.\n  -s, --solve           solve to final given word, starting with earlier given\n                        words (if any)\n  -r RANDOM, --random RANDOM\n                        choose word for solver at each step randomly from\n                        given number (or %) of top candidates, default=1\n  -c, --no-colors       don't show colors in solver output\n  -V, --version         show wordle-aid version\n\nNote you can set default starting options in \"~/.config/wordle-aid-\nflags.conf\".\n```\n\n## License\n\nCopyright (C) 2022 Mark Blakeney. This program is distributed under the\nterms of the GNU General Public License.\nThis program is free software: you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation, either version 3 of the License, or any later\nversion.\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License at <http://www.gnu.org/licenses/> for more details.\n\n<!-- vim: se ai syn=markdown: -->\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "CLI program to filter word choices to aid solving Wordle game problems",
    "version": "2.7",
    "project_urls": {
        "Homepage": "https://github.com/bulletmark/wordle-aid"
    },
    "split_keywords": [
        "wordle"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e057ed282a51acc8b66b71c6eb316213f64385965e9b4ee3623aa79b9244d2e0",
                "md5": "4f61328d20d1d044b5af1d2761d1aac4",
                "sha256": "5a1a476f8853658287f79dcd7abdfc6215466fa38b85cecbff2ba3eec25f22a4"
            },
            "downloads": -1,
            "filename": "wordle_aid-2.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4f61328d20d1d044b5af1d2761d1aac4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8977,
            "upload_time": "2023-11-19T23:53:04",
            "upload_time_iso_8601": "2023-11-19T23:53:04.233113Z",
            "url": "https://files.pythonhosted.org/packages/e0/57/ed282a51acc8b66b71c6eb316213f64385965e9b4ee3623aa79b9244d2e0/wordle_aid-2.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83ac962e41f25cbbb16f6d85420dd471d3c6f63f5b05f8ed8ae0e702cfe57b2f",
                "md5": "9a17d92c7abbc781c8c97d88a8f98033",
                "sha256": "26bca96f2bc6810d5c230aabf8a72ee0515a5e79a011a58ab44f2639569a1944"
            },
            "downloads": -1,
            "filename": "wordle-aid-2.7.tar.gz",
            "has_sig": false,
            "md5_digest": "9a17d92c7abbc781c8c97d88a8f98033",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 45035,
            "upload_time": "2023-11-19T23:53:06",
            "upload_time_iso_8601": "2023-11-19T23:53:06.378932Z",
            "url": "https://files.pythonhosted.org/packages/83/ac/962e41f25cbbb16f6d85420dd471d3c6f63f5b05f8ed8ae0e702cfe57b2f/wordle-aid-2.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-19 23:53:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bulletmark",
    "github_project": "wordle-aid",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "wordle-aid"
}
        
Elapsed time: 2.20233s