question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stop auto-correcting Numbers and special characters

See original GitHub issue

Hi again,

If I have the following string: The support is 24/7, awesome!

It removes 24/7. Is there a way to avoid deleting numbers and other special characters such as"$£" etc.?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
mammothbcommented, Feb 28, 2019

I am able to preserve the number by using Python’s raw string notation for regular expression patterns, i.e.,

ignore_token=r"\d{2}\w*\b|\d+\W+\d+\b|\d\w*\b|[!@£#$%^&*();,.?:{}/|<>]"

instead of

ignore_token="\d{2}\w*\b|\d+\W+\d+\b|\d\w*\b|[!@£#$%^&*();,.?:{}/|<>]"

I think your backslashes \ were treated as escape characters since you did not use raw string notation.

2reactions
mammothbcommented, Mar 1, 2019

6 mths converted to 6mths because 6 matches \d\w*\b and is ignored. Then when two words are joined together to look for a possibly correct word (part of word_segmentation algorithm), 6mths matches \d\w*\b as well and is ignored.

solv is corrected sold instead of solve because the frequency of sold (42979181) is higher than that of solve (13452150) in the provided frequency dictionary.

I is correct to a while i is preserved because i is an exact match of i (gets returned as a result immediately) while I is not an exact match of i (different case) so it is corrected based the rest of the lookup algorithm and a (9081174698) has higher frequency than that of i (3086225277).

You could try to apply lower() to your input to prevent I from being corrected to a.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel AutoCorrect: how to customize or turn off - Ablebits
Insert a special symbol of interest in a cell (Insert tab > Symbols group > Symbols). · Select the inserted symbol and press...
Read more >
Turn off or on the special characters and symbols in MS Office ...
Special characters and symbols in MS Office Excel, Word, ... Autocorrection are an important part, you can also turn them off, on or...
Read more >
AutoCorrect features in Excel - Microsoft Support
To prevent all automatic changes and replacements that AutoCorrect would make, do the following in this dialog box: Clear all the check boxes...
Read more >
How to stop AutoCorrect and AutoFormat changes
How to stop AutoCorrect and AutoFormat changes ; 1. On the File tab, and then click Options: ; 2. In the Word Options...
Read more >
Too Many Autocorrect Fails? How to Tweak Your Keyboard ...
On your iPhone or iPad, go to Settings > General > Keyboard. Let's address the elephant in the room right off the bat....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found