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

Replace words in a sentence #58

Open
Gunni opened this issue Feb 7, 2021 · 3 comments
Open

Replace words in a sentence #58

Gunni opened this issue Feb 7, 2021 · 3 comments

Comments

@Gunni
Copy link

Gunni commented Feb 7, 2021

Hey, i would like to be able to feed this library a string, such as:

  • Example title - Chapter One Hundred Fifteen
  • Example title - Ninety-Eight

and get back, in those examples:

  • Example title - Chapter 115
  • Example title - 98

Is that possible?

@bastie
Copy link

bastie commented Feb 7, 2021

First this module is very nice but also long time not update and so I'm sorry to recommend take a fork; over Insights => network you find working forks. The https://github.com/frootbirb fork may be interesting but I don't tested it ("-" problem perhaps).

Second the answer is: not with this module alone in generic way. You get only this numbers as return.

  • Example title - Chapter One Hundred Fifteen => 115
  • Example title - Ninety-Eight => 98

But if ever the number is last in your sentences try it.

The module is not a NLP library but nice to work at result from NLP. As result of NLP you have a good chance to get a right tagging as num for "One" "Hundred" "Fifteen" "Ninety-Eight" and can the result send to word_to_number. Only a chance in result often numbers are tagged as noun for example https://parts-of-speech.info and insert your text without some NLP steps before.

@Gunni
Copy link
Author

Gunni commented Feb 7, 2021

Hey,

You were right, I got it working at last, after much work https://gist.github.com/Gunni/7d2e14b49d3f0483666843e31b2b358f .

The biggest problem was the normal tokenizer refused to tag random numbers, so I had to make my own tagger, and feed it tagged "number words".

I did it for all numbers from 10k to 0.

That works for my usecase, maybe it can help someone else out there...

@akshaynagpal
Copy link
Owner

Hi @Gunni , I have been super busy with other commitments and plan on updating the package as soon as I get some free time. Thanks for understanding.

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

3 participants