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

expose 'interpreted' rawValue for numbers #637

Open
McFoggy opened this issue Jul 24, 2018 · 2 comments
Open

expose 'interpreted' rawValue for numbers #637

McFoggy opened this issue Jul 24, 2018 · 2 comments

Comments

@McFoggy
Copy link
Contributor

McFoggy commented Jul 24, 2018

as exposed in #636 sometime if you want to print back recognized values you need to have a raw representation of the float value in a slot.

When the input contains already a "string number" representation of the value like below with "rawValue": "12.7" it is possible to round the numerical value at the same number of expected decimals than the ones provided inside the input:

{
    "range": {
        "start": 16,
        "end": 20
    },
    "rawValue": "12.7",
    "value": {
        "kind": "Number",
        "value": 12.699999809265137
    },
    "entity": "snips/number",
    "slotName": "data"
}

But when the input is in the form "rawValue": "twelve dot seven", it becomes difficult to do the rounding correctly

{
    "range": {
        "start": 16,
        "end": 32
    },
    "rawValue": "twelve dot seven",
    "value": {
        "kind": "Number",
        "value": 12.699999809265137
    },
    "entity": "snips/number",
    "slotName": "data"
}

Would it be possible to extend the data model to introduce some kind of rawNumberValue or rawInterpretedValue either at the slot level or at the slot.value level like in the following example:

{
    "range": {
        "start": 16,
        "end": 32
    },
    "rawValue": "twelve dot seven",
    "value": {
        "kind": "Number",
        "rawNumberValue": "12.7",
        "value": 12.699999809265137
    },
    "entity": "snips/number",
    "slotName": "data"
}
@McFoggy McFoggy changed the title expose 'transformed' rawValue for numbers expose 'interpreted' rawValue for numbers Jul 24, 2018
@adrienball
Copy link
Contributor

Interesting indeed. In parallel, another idea would be to enrich the snips/number builtin entity by adding a precision attribute, so that you have something like:

{
    "range": {
        "start": 16,
        "end": 32
    },
    "rawValue": "twelve dot seven",
    "value": {
        "kind": "Number",
        "precision": 1,
        "value": 12.699999809265137
    },
    "entity": "snips/number",
    "slotName": "data"
}

@McFoggy
Copy link
Contributor Author

McFoggy commented Jul 24, 2018

@adrienball yes a precision field is also a perfect valid answer to the need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants