Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bsoyka/advent-of-code-ocr
Convert Advent of Code ASCII art
https://github.com/bsoyka/advent-of-code-ocr
advent-of-code advent-of-code-2016 advent-of-code-2019 hacktoberfest ocr
Last synced: 7 days ago
JSON representation
Convert Advent of Code ASCII art
- Host: GitHub
- URL: https://github.com/bsoyka/advent-of-code-ocr
- Owner: bsoyka
- License: mit
- Created: 2020-12-13T17:24:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T19:19:32.000Z (over 1 year ago)
- Last Synced: 2024-06-04T20:16:48.504Z (about 1 month ago)
- Topics: advent-of-code, advent-of-code-2016, advent-of-code-2019, hacktoberfest, ocr
- Language: Python
- Homepage:
- Size: 46.9 KB
- Stars: 12
- Watchers: 2
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Lists
- awesome-advent-of-code - advent-of-code-ocr - - Python module for parsing AoC ascii art words *(Python)* (Tools and Utilities)
README
# Advent of Code® OCR
This Python module converts [Advent of Code](https://adventofcode.com/) ASCII
art letters to plain characters.At the moment, it supports 6-pixel-tall characters as seen in 2016 Day 8, 2019
Days 8 and 11, and 2021 Day 13. (Support for 10-pixel-tall characters, as seen
in 2018 Day 10, is coming soon.)Put simply, it converts something like this to plain text:
```txt
██ ███ ██
█ █ █ █ █ █
█ █ ███ █
████ █ █ █
█ █ █ █ █ █
█ █ ███ ██
```[![Downloads](https://pepy.tech/badge/advent-of-code-ocr)](https://pepy.tech/project/advent-of-code-ocr)
[![Supported Versions](https://img.shields.io/pypi/pyversions/advent-of-code-ocr.svg)](https://pypi.org/project/advent-of-code-ocr)
[![Testing](https://img.shields.io/github/workflow/status/bsoyka/advent-of-code-ocr/Test%20with%20pytest?label=tests)](https://github.com/bsoyka/advent-of-code-ocr/actions?query=workflow%3A%22Test+with+pytest%22)
[![License](https://img.shields.io/pypi/l/advent-of-code-ocr)](https://github.com/bsoyka/advent-of-code-ocr/blob/master/LICENSE)
[![Version](https://img.shields.io/pypi/v/advent-of-code-ocr?label=latest)](https://pypi.org/project/advent-of-code-ocr)## Installation
Advent of Code OCR is available on PyPI:
```sh
$ pip install advent-of-code-ocr
```Advent of Code OCR officially supports Python 3.7+.
## API Reference
By default, this module recognizes `#` as a filled pixel and `.` as an empty
pixel. However, you can change this using the `fill_pixel` and `empty_pixel`
keywork arguments respectively.```py
from advent_of_code_ocr import convert_6print(convert_6(".##.\n#..#\n#..#\n####\n#..#\n#..#"))
# Aprint(convert_6(" $$ \n$ $\n$ $\n$$$$\n$ $\n$ $", fill_pixel="$", empty_pixel=" "))
# A
```You can also convert data that you have in a NumPy array or a nested list:
```py
from advent_of_code_ocr import convert_array_6array = [
[0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
[1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
]
print(convert_array_6(array, fill_pixel=1, empty_pixel=0))
# AOC
```---
Advent of Code is a registered trademark of Eric K Wastl in the United States.