ranvijaykumar / typo Goto Github PK
View Code? Open in Web Editor NEWA python package to simulate typographical errors.
License: MIT License
A python package to simulate typographical errors.
License: MIT License
Hello,
I was wondering if there is a way to keep some characters fixed while applying a typo function to it?
For instance: Keeping the first and last characters in a word unchanged irrespective of what typo function you use.
Best,
Shalaka
I noticed that some non-English characters can trigger a KeyError
exception:
E.g. the (I think) Eastern Arabic numeral for 6, ٦
:
File "/.../python3.8/site-packages/typo/Errer.py", line 69, in extra_char
char_to_add = en_default.get_random_neighbor(trigger_char)
File "/.../python3.8/site-packages/typo/keyboardlayouts/en_default.py", line 118, in get_random_neighbor
return random.choice(NEIGHBORINGNUMPADDIGITS[char])
KeyError: '٦'
I think it is due to the use of instr.isdecimal()
instead of str.isdigit()
Edit: str.isdigit()
is also True for ٦
apparently, I didn't check properly.
typo/typo/keyboardlayouts/en_default.py
Lines 108 to 118 in 80eac33
Either using str.isdigit()
here orchar in NEIGHBORINGNUMPADDIGITS
would solve this.
Alternatively, you could use Edit: You'd change the language of the character, so I'd say this is not a good solution either.'{:d}'.format(int(char))
to reinterpret the numeral to 0-9 which I think for most arabic numerals, but for say ي
it won't work since that doesn't fit with the default base 10 and would raise a ValueError
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.