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

Case sensitivig #12

Open
tomron opened this issue Feb 19, 2015 · 5 comments
Open

Case sensitivig #12

tomron opened this issue Feb 19, 2015 · 5 comments

Comments

@tomron
Copy link

tomron commented Feb 19, 2015

Add an option to run it case insensitive

@intgr
Copy link
Owner

intgr commented Feb 19, 2015

Unfortunately it's not as easy as it sounds. The rules from Wikipedia generally can deal with capitalized initial letters, but the replacements are case-sensitive, they cannot deal with allcaps words or mixed capitalization. For example this rule:

<Typo word="Activity" find="\b([Aa])c(?:itivit|tivt|tvit)(y|ies)\b" replace="$1ctivit$2"/>

In case-insensitive mode the word "ACTIVTY" would turn into "ActivitY"

What's the use case for this? How do you imagine this working?

@tomron
Copy link
Author

tomron commented Feb 19, 2015

My use case is that users' texts which don't really care about capitalization, I believe it is very common. Specially when you read data from social networks.

Another example - German native speakers which write in English and are not used to non capitalizing nouns.

@tomron
Copy link
Author

tomron commented Feb 19, 2015

BTW a possible way to implement it is to take it as an argument (say -i) and when loading the rules do -
r = regex.compile(find, regex.IGNORECASE)
It will replace it with case sensitive string but it will also identify strings with different capitalization.

@intgr
Copy link
Owner

intgr commented Feb 19, 2015

I'm not convinced yet. Implementing it like that, it would be easily misunderstood by users and I suspect I would get bug reports of it doing the Wrong Thing with allcaps words, turning them to "ActivitIES" for example.

@tomron
Copy link
Author

tomron commented Feb 19, 2015

Ok, I'll fork it then.

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