Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add japanese character filter #88

Closed
wants to merge 1 commit into from
Closed

Add japanese character filter #88

wants to merge 1 commit into from

Conversation

liqht-me
Copy link

This commit adds a filter, which uses japanese hiraganas to display the pixels. (Add japanese.py)
See #69

This commit adds a filter, which uses japanese hiraganas to display the pixels. (Add japanese.py)
See #69
Copy link
Owner

@Davidy22 Davidy22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick checkout, code doesn't work. List index out of range, check your symbols indexing carefully and test your code to make sure it works before submitting.

def filter(
self, image: List[List[Tuple[int, int, int, int]]]) -> List[List[Tuple[int, int, int, int]]]:
"""Process an ASCII image and return an image of the same format and dims"""
symbols = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len() and indexing also work on strings, and I think you'll find that doing this on a single string performs a bit faster.

symbols = ['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', 'た', 'ち', 'つ', 'て', 'と',
'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', 'み', 'む', 'め', 'も', 'や', 'ゆ', 'よ', 'ら', 'り',
'る', 'れ', 'ろ', 'わ', 'を']
return [[(symbols[randint(0, len(symbols))], j[1], j[2], 0) for j in i] for i in image]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know a lot of the existing filters are context free character substitutions, I probably didn't set the best precedent by approving all those filters that only replace the whole screen with one character, but it'd be kinda nice if newer ones pushed the boundaries a little and did some sort of shade thing like I did with the newer shovels filter

"""
self.textOp = True
self.name = "Japanese"
self.description = "Fill the image with random japanese letters"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think letters is a european alphabet name, think these are characters.

@Davidy22 Davidy22 added the invalid This doesn't seem right label Nov 2, 2021
@Davidy22
Copy link
Owner

Davidy22 commented Nov 2, 2021

Closing because doesn't work and doesn't look like this is going to get fixed

@Davidy22 Davidy22 closed this Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants