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

feat: add dimension kelvin #692

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ofhope
Copy link

@ofhope ofhope commented May 19, 2022

Adding the dimension kelvin to temperature rules. Its a SI (International System of Units) base unit, so eventually it could be included in all languages.

Typically it's expressed without the degree key word. Also its lowercase except when expressed as a single character K. You wouldn't say 44 degrees Kelvin rather 44 kelvins

It's 283 kelvins outside

Duckling/Temperature/EN/Rules.hs Outdated Show resolved Hide resolved
@@ -52,6 +53,13 @@ allExamples = concat
, "2 degrees below zero"
, "2 below zero"
]
, examples (simple Kelvin 44)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these examples look good, classifiers need to be regenerated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run
stack build :duckling-regen-exe && stack exec duckling-regen-exe && stack test

And I can parse out kelvins.

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_GB&text=44 kelvin'        
[{"body":"44 kelvin","start":0,"value":{"value":44,"type":"value","unit":"kelvin"},"end":9,"dim":"temperature","latent":false}]
curl -XPOST http://0.0.0.0:8000/parse --data 'locale=en_GB&text=11 kelvins'
[{"body":"11 kelvins","start":0,"value":{"value":11,"type":"value","unit":"kelvin"},"end":10,"dim":"temperature","latent":false}]

The only classifier that updated was IT_XX.hs 🤷🏽 I was expecting EN_XX.hs to update.

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

Successfully merging this pull request may close these issues.

3 participants