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.

Fractions miss-behaving when next to other numbers

See original GitHub issue

This works as expected (I think): nlp('10 1/2').numbers().json() or nlp('10 1/2').fractions().json()

[{
    "text": "1 1/2",
    "normal": "1 1/2",
    ...
    "prefix": "",
    "number": 1.5,
    "suffix": "",
    "cardinal": "1.5",
    "ordinal": "1.5th",
}]

But this doesn’t nlp('1/2 10').numbers().json() or nlp('1/2 10').fractions().json()

[
  {
    "text": "1/2 10",
    "normal": "1/2 10",
    ...
    "prefix": "",
    "number": 10.5,
    "suffix": "",
    "cardinal": "10.5",
    "ordinal": "10.5th"
  }
]

or this weirdness: nlp('2 1/2 30').numbers().json()

[
  {
    "text": "10 1/2 10",
    "normal": "10 1/2 10",
    ...
    "prefix": "",
    "number": 10.5,
    "suffix": "",
    "cardinal": "10.5",
    "ordinal": "10.5th",
  }
]

A real world example where I’m trying to use this is for something like 2 1/2 30 gram packets of food

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Nov 11, 2020

will ping you when this is released - hopefully this week. thanks

0reactions
spencermountaincommented, Dec 18, 2020

released as 13.8.0 thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-cancellation and How To Do It - Bubbly Primes
It's a way to make multiplying and dividing fractions easier. ... we usually cross out numbers across a diagonal and write replacement numbers...
Read more >
Negative signs in fractions (video) - Khan Academy
Yes, in multiplying/dividing positive and negative numbers, count number of - signs. ... the negative number may end up in different spots.
Read more >
Fraction facts.pdf
Definition: A fraction is a numerical representation for part of a whole. ... number to a fraction with the same denominator as the...
Read more >
Overview of Fractions - NumberNut.com: Fractions and Decimals
Let's look at the basics of fractions. A fraction is made of two numbers (integers), one on top of the other and separated...
Read more >
Fractions and the Number Line
We can use a number line model to illustrate fraction order for values between 0 and 1.
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