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 Custom Dictionary of OCR-Augment #241

Closed
Olivia-fsm opened this issue Sep 15, 2021 · 2 comments
Closed

Add Custom Dictionary of OCR-Augment #241

Olivia-fsm opened this issue Sep 15, 2021 · 2 comments

Comments

@Olivia-fsm
Copy link

Hi, nlpaug team! I am using your tool to do a OCR shape-alike data augmentation. Could I specify our own Dict {'o'->0, 'd'->'cl'} when doing the augmentation?

@makcedward
Copy link
Owner

makcedward commented Oct 5, 2021

Enhanced to support this scenario. You may download the dev version (pip install git+https:/makcedward/nlpaug.git) for trail.

You may either pass dict or json file path when initializing OCRAug augmenter. The format should be key and a list of possible alternatives. As your example, it should be
{'o'->0, 'd'->'cl'}

Here is the example of pass dict

mapping = {'o': ['0'], 'd': 'cl'}
aug = OcrAug(dict_of_path=mapping)

You can also pass json file path as parameter.
aug = OcrAug(dict_of_path='sample.json')

@makcedward
Copy link
Owner

Supported in 1.1.8 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants