Python "contractions" package does not work for some contractions

288 Views Asked by At

I tried fixing contractions in a large number of text files using contractions package. It works good for most of cases, but fails in handling contraction like 's. Here is an example:

text = "I'll give two examples. Lets have the first example: let's say someone's name. Second example: My name's Sam"

import contractions
contractions.fix(text)

Output:

"I will give two examples. Let Us have the first example: let us say someone is name. Second example: My name's Sam"

The first 's is fixed but it is failed in properly fixing the second and the third ones. Any workable solutions (or packages) to fix this problem?

An ideal output would be the below (or at least closer to the main string):

"I will give two examples. Let us have the first example: let us say someone's name. Second example: My name is Sam"
0

There are 0 best solutions below