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.

Number parsing exceptions

See original GitHub issue

So far I’ve had pretty good results using this library to parse numbers. Unfortunately, I’ve started to see some odd edge cases with verbose pronunciations like:

const nlp = require('compromise')

// works
nlp('fifty five').values().toNumber().out() // 55

// doesn't work
nlp('forty eight').values().toNumber().out() // 40 8

Preventing me from using this in production… 😭

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hboylancommented, Mar 9, 2018

Confirmed! You’re the man! 💯

nlp('forty two').values().toNumber().out() // 42
1reaction
spencermountaincommented, Mar 8, 2018

hahaha image oops!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ParseException for number java [closed] - Stack Overflow
Hi and welcome to StackOverflow! Unfortunately, as it stands, your question is not clear. What do you want to achieve? – Adrian Panasiuk....
Read more >
Understanding the NumberFormatException in Java - Baeldung
Java throws NumberFormatException – an unchecked exception – when it cannot convert a String to a number type.
Read more >
Fast number parsing in Scala - SoftwareMill
Avoid exceptions in number parsing, they slow you down — see how Scala 2.13's .toIntOption method can make the process faster.
Read more >
String parsing exceptions
String parsing exceptions. The Integer.parseInt() and Double.parseDouble() class methods both take a String parameter and converts it into a number.
Read more >
Parse numbers from string without exception #660 - GitHub
If people use tryParse to avoid NumberFormatException, it is outside IHM. In IHM I can understand that it is difficult to replace the...
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