Comments (5)
Hey guys, I will look into this, an update will follow shortly!
Edit: Ok, as mentioned by @hilaryp, the product
dimension/value is missing in the Python wrapper. I will also look into exposing the recognized product to the result.
from python-duckling.
FYI I'm able to reproduce this outside of rasa_nlu. duckling == 1.7.3
Python 3.6.4 | packaged by conda-forge | (default, Dec 23 2017, 16:54:01)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import duckling
>>> d = DucklingWrapper()
# duration works fine:
>>> d.parse('5 days')
[{'dim': 'number', 'text': '5', 'start': 0, 'end': 1, 'value': {'value': 5.0}}, {'dim': 'duration', 'text': '5 days', 'start': 0, 'end': 6, 'value': {'value': 5.0, 'unit': 'day', 'year': None, 'month': None, 'day': 5, 'hour': None, 'minute': None, 'second': None}}, {'dim': 'distance', 'text': '5', 'start': 0, 'end': 1, 'value': {'value': 5.0, 'unit': None}}, {'dim': 'volume', 'text': '5', 'start': 0, 'end': 1, 'value': {'value': 5.0, 'unit': None, 'latent': True}}, {'dim': 'temperature', 'text': '5', 'start': 0, 'end': 1, 'value': {'value': 5.0, 'unit': None}}, {'dim': 'time', 'text': '5', 'start': 0, 'end': 1, 'value': {'value': '2018-04-10T05:00:00.000-04:00', 'grain': 'hour', 'others': [{'grain': 'hour', 'value': '2018-04-10T05:00:00.000-04:00'}, {'grain': 'hour', 'value': '2018-04-10T17:00:00.000-04:00'}, {'grain': 'hour', 'value': '2018-04-11T05:00:00.000-04:00'}]}}]
# this does not:
>>> d.parse('5 cups of sugar')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/hilary/anaconda3/lib/python3.6/site-packages/duckling/wrapper.py", line 237, in parse
return self._parse(input_str, reference_time=reference_time)
File "/Users/hilary/anaconda3/lib/python3.6/site-packages/duckling/wrapper.py", line 56, in _parse
reference_time=reference_time)
File "/Users/hilary/anaconda3/lib/python3.6/site-packages/duckling/duckling.py", line 161, in parse
return self._parse_result(duckling_result)
File "/Users/hilary/anaconda3/lib/python3.6/site-packages/duckling/duckling.py", line 187, in _parse_result
field.getValue(), entry[u'dim'])
File "/Users/hilary/anaconda3/lib/python3.6/site-packages/duckling/duckling.py", line 222, in _parse_dict
result[key] = _functions[key](field.getValue())
KeyError: 'product'
Poking around in the old wit.ai duckling code, I found a "quantity" dimension which returns a "product" key: https://github.com/wit-ai/duckling_old/blob/a4bc34e3e945d403a9417df50c1fb2172d56de3e/src/duckling/corpus.clj#L111
Perhaps this is the source of this error? Haven't come up with a workaround yet.
from python-duckling.
It should be fixed now with duckling v1.8.0
.
from python-duckling.
Any update on this? We are also facing this issue. Same versions of all the dependencies as above
from python-duckling.
We are having the same KeyError: 'product' but our magic word that raises the exception is "sugar"
Dependency Packages:
duckling==1.7.3
spacy==1.9.0
scikit-learn==0.19.0
rasa-nlu==0.10.1
Rasa Configuration:
{
"project": "detector",
"language": "en",
"pipeline": ["nlp_spacy", "tokenizer_spacy", "intent_entity_featurizer_regex", "intent_featurizer_spacy", "ner_crf",
"ner_duckling", "ner_spacy", "ner_synonyms", "intent_classifier_sklearn"],
"path" : "models/",
"data" : "data/train.json",
"response_log": "logs/",
"duckling_dimensions": ["duration", "time"],
"intent_classifier_sklearn": {
"C": [1, 2, 5, 10, 20, 100],
"kernel": "linear"
}
}
Partial Stacktrace
File ".../lib/python3.6/site-packages/duckling/duckling.py", line 222, in _parse_dict
result[key] = _functions[key](field.getValue())
KeyError: 'product'
Example Sentences
- Maltitol is an alcohol sugar and can be undigestible in the body.
- The brown sugar and chocolate mask any bean taste that other reviews have mentioned.
- Substitute this to sugar and you'll be doing your body a great favor.
from python-duckling.
Related Issues (20)
- Installation error with Docker HOT 1
- incorrect year HOT 1
- Problem in Django multi threaded environment HOT 2
- Problems after update to JPype1 0.6.3 HOT 3
- Dependency of Jre not mentioned HOT 3
- parse_time issue HOT 2
- Extremely slow library HOT 1
- currency recognition problem
- Duckling throws nullpointerexception
- jpype dependency not listed
- jpype._jexception.RuntimeExceptionPyRaisable HOT 4
- Does not recognise dd/mm/yyyy format
- clojure issue HOT 2
- Language Support
- basic numbers in German Language not working
- Does not recognise "after 15 days"
- Fatal Error on Os X
- Incompatibility with recent versions of JPype HOT 1
- problem when parsing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-duckling.