{"id":19874186,"url":"https://github.com/pythoninthegrass/haiku_generator","last_synced_at":"2025-03-01T01:23:18.271Z","repository":{"id":200084601,"uuid":"704791439","full_name":"pythoninthegrass/haiku_generator","owner":"pythoninthegrass","description":"Generate a haiku based on user input","archived":false,"fork":false,"pushed_at":"2024-01-13T16:38:52.000Z","size":188,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T16:50:29.187Z","etag":null,"topics":["nltk","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythoninthegrass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["pythoninthegrass"]}},"created_at":"2023-10-14T05:27:04.000Z","updated_at":"2023-10-16T22:26:46.000Z","dependencies_parsed_at":"2023-10-15T17:30:37.665Z","dependency_job_id":"c35c7bf3-44bf-4e4d-974c-e1746b4ed2f5","html_url":"https://github.com/pythoninthegrass/haiku_generator","commit_stats":null,"previous_names":["pythoninthegrass/haiku_generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fhaiku_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fhaiku_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fhaiku_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythoninthegrass%2Fhaiku_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythoninthegrass","download_url":"https://codeload.github.com/pythoninthegrass/haiku_generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241301887,"owners_count":19940727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nltk","python"],"created_at":"2024-11-12T16:22:10.630Z","updated_at":"2025-03-01T01:23:18.252Z","avatar_url":"https://github.com/pythoninthegrass.png","language":"Python","readme":"# haiku_generator\n\nSimple haiku generator written in Python. Validates haiku syllable count and generates random haikus from a corpus of words.\n\n## Favorite randomly generated haiku\n**This**\n\u003e overestimates  \n\u003e mouths incontrovertible  \n\u003e equivalency  \n\n**or this**\n\u003e edna liturgy  \n\u003e afterlives abdicated  \n\u003e taunts justifying  \n\n**okay, last one**\n\u003e inexperienced  \n\u003e felucca tarts remarriage  \n\u003e prescribed bengali  \n\n## Setup\n* Minimum requirements\n  * [Python 3.11](https://www.python.org/downloads/)\n* Recommended\n  * [asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf)\n  * [poetry](https://python-poetry.org/docs/)\n  * [docker-compose](https://docs.docker.com/compose/install/)\n\n## Quickstart\n```bash\n# vanilla python\npython3 -m venv .venv\nsource .venv/bin/activate\npython -m pip install -r requirements.txt\npython haiku_generator.py\n\n# asdf\nasdf install python 3.11.5\nasdf install poetry latest\n\n# poetry\npoetry install\npoetry run python haiku_generator.py\n```\n\n## Docker\n* Use the Docker image instead of installing locally\n```bash\n# by default, entrypoint is the script, command (option) is `--help`\nλ docker run -it --rm ghcr.io/pythoninthegrass/haiku_generator:main\n\n Usage: haiku_generator.py [OPTIONS]\n\n╭─ Options ────────────────────────────────────────────────────────────╮\n│ --validate  -v        Validate a haiku                               │\n│ --generate  -g        Generate a haiku                               │\n│ --help                Show this message and exit.                    │\n╰──────────────────────────────────────────────────────────────────────╯\n\n# override command (option) with `--validate` or `-v`\nλ docker run -it --rm ghcr.io/pythoninthegrass/haiku_generator:main -v\nDownloading words_dictionary.json...\nDownloading cmudict...\n[nltk_data] Downloading package cmudict to /app/nltk_data...\n[nltk_data]   Unzipping corpora/cmudict.zip.\nValidating haiku...\nEnter the first line: \u003cctrl-c\u003e\n\n# override command (option) with `--generate` or `-g`\nλ docker run -it --rm ghcr.io/pythoninthegrass/haiku_generator:main -g\nDownloading words_dictionary.json...\nDownloading cmudict...\n[nltk_data] Downloading package cmudict to /app/nltk_data...\n[nltk_data]   Unzipping corpora/cmudict.zip.\nGenerating haiku...\nextenuating\nanesthesiologists\ninsubordinate\n\n# override entrypoint with `bash` and run the script from within the container\nλ docker run -it --rm --entrypoint=bash ghcr.io/pythoninthegrass/haiku_generator:main\nappuser@1d5cc39be76d:/app$ ll\ntotal 80\ndrwxr-xr-x 1 appuser appuser   126 Oct 17 01:58 .\ndrwxr-xr-x 1 root    root        0 Oct 17 02:06 ..\n-rwxr-xr-x 1 appuser appuser  6536 Oct 17 01:57 haiku_generator.py\n-rw-r--r-- 1 appuser appuser 64245 Oct 17 01:57 poetry.lock\n-rw-r--r-- 1 appuser appuser  2030 Oct 17 01:57 pyproject.toml\n-rw-r--r-- 1 appuser appuser  2302 Oct 17 01:57 requirements.txt\ndrwxr-xr-x 1 appuser appuser   230 Oct 17 01:57 test\nappuser@1d5cc39be76d:/app$ ./haiku_generator.py --help\n\n Usage: haiku_generator.py [OPTIONS]\n\n╭─ Options ────────────────────────────────────────────────────────────╮\n│ --validate  -v        Validate a haiku                               │\n│ --generate  -g        Generate a haiku                               │\n│ --help                Show this message and exit.                    │\n╰──────────────────────────────────────────────────────────────────────╯\n\n# run without any options\nλ docker run -it --rm --entrypoint=bash ghcr.io/pythoninthegrass/haiku_generator:main\nappuser@b1aff86b728f:/app$ ./haiku_generator.py\nDownloading words_dictionary.json...\nDownloading cmudict...\n[nltk_data] Downloading package cmudict to /app/nltk_data...\n[nltk_data]   Unzipping corpora/cmudict.zip.\nWelcome to the Haiku Generator!\n\nWould you like to validate or generate a haiku?\n\n1. validate\n2. generate\n3. exit\n\nPlease enter a number: 3\nGoodbye!\n\n# exit the container\nappuser@1d5cc39be76d:/app$ exit\nexit\n```\n\n## Development\n* Testing\n    ```bash\n    # activate virtual environment\n    poetry shell\n    \n    # generate tests\n    hypothesis write haiku_generator.validate_haiku \u003e test_validate_haiku.py\n\n    # run specific test\n    pytest -k test_validate_haiku\n    ```\n\n## TODO\n* [Open Issues](https://github.com/pythoninthegrass/haiku_generator/issues)\n* Generate more human-esque poems lmao\n* CI\n  * Auto format (e.g., pep8)\n  * Re-add devcontainer\n    * Use `docker.yml` to build image\n* Write more tests\n  * properties based ([hypothesis](https://youtu.be/mkgd9iOiICc?si=3Fpk7s7RvZZQtWB0\u0026t=1120))\n  * unit\n  * integration\n* QA\n  * 479K word json file\n    * json vs. sqlite vs. something else (parquet?)\n* GUI\n\n## Further Reading\n[How to Write a Haiku, With Examples | Grammarly Blog](https://www.grammarly.com/blog/how-to-write-haiku/)\n\n[NLTK :: nltk.corpus.reader.cmudict](https://www.nltk.org/_modules/nltk/corpus/reader/cmudict.html)\n\n[dwyl/english-words: :memo: A text file containing 479k English words for all your dictionary/word-based projects e.g: auto-completion / autosuggestion](https://github.com/dwyl/english-words)\n\n[Typer](https://typer.tiangolo.com)\n\n[What you can generate and how — Hypothesis documentation](https://hypothesis.readthedocs.io/en/latest/data.html#)\n\n[Publishing Docker images - GitHub Docs](https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages)\n","funding_links":["https://github.com/sponsors/pythoninthegrass"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fhaiku_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythoninthegrass%2Fhaiku_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythoninthegrass%2Fhaiku_generator/lists"}