Comments (7)
Hi @sony-au,
Thank you for bringing this to our notice. We are looking into this. Will get back to you.
Regards,
Practical NLP Team
from practical-nlp-code.
@sony-au @varunp2k - I just ran this with Duckling 1.8.0, but with old Python version (3.6), on Ubuntu and with Jupyter Notebook. I was able to run it without errors. I found out the issue. It is with JPype, which is required for Duckling to run. I have JPype version 0.7.4, and it shows the following deprecation warning when I instantiate a ducklingwrapper object:
""/usr/local/lib/python3.6/dist-packages/jpype/_core.py:209: UserWarning:
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False. The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.""")"
If you install Duckling now, it installs JPype 1.0.
So, what you can do is - install JPype first and then install duckling, like this:
pip3 install JPype1==0.7.4
pip3 install duckling==1.8.0
- this should fix your issue.
from practical-nlp-code.
@sony-au The seems to be happening because of openjdk. This does not work for openjdk version 11 (which is the version with recent Ubuntu distributions) but works for openjdk version 8. We have opened an issue in the git repo of Duckling package too regarding this issue.
from practical-nlp-code.
@varunp2k @nishkalavallabhi I installed JPype 0.7.4 and it resolved the issue. it did show the deprecation warning, but it works. thanks guys
from practical-nlp-code.
This issue is because the library in question is depending on the deprecated JPype automatic conversion for Java strings to Python strings. Simply adding a call to str()
prior to getting the slice will correct the issue as it will transfer the string from Java to Python where slightly different operators are supported. Slicing is not supported on a Java string but is on a Python string.
ie. Before
a = callSomething()[1:5] # worked on old because callSomething returned a Python string.
After
a = str(callSomething())[1:5] # works on both old and new JPype
If the code has way too many of these to fix add "convertStrings=True" to the startJVM command. It will give the old behavior. ConvertStrings will make the code incompatible with other JPype libraries but should also fix the issue. There has been a deprecated warning on this for the last year (so you can't say you weren't warned). The warning was supposed to tell you to either add convertStrings=True
and force the old behavior or convertStrings=False
which would lead to fixing the bad code.
If possible please correct the error rather than rolling back the JPype version. I work to fix leaks and improve code quality and freezing the version to something old just makes it so people are getting older bugger code.
from practical-nlp-code.
We are not interacting directly with the JPype library. Duckling is doing that. The reason we recommend rolling back the version is because Duckling has not been updated since a few years. It has been inactive.
Plus the greater goal at hand here is people being able to run the duckling notebook and understand how it implements Temporal IE. We understand that the way which we recommend is not optimal, but again as mentioned Duckling is not actively maintained and hence we need to use a JPype version which is compatible with it.
We understand the importance of code quality, using the latest and improved versions of the code. But this repository serves as a aid/tutorial for the readers of the book. It is a bit hard from our end to keep updating the code for every version change from packages. That is the reason we are freezing the versions of packages.
from practical-nlp-code.
I attempted to address the issue with jpype-project/jpype#833 which will add slicing support for the string wrapper. After all it much easier to the active project to address the issue that the inactive one. Unfortunately, as I don't run ducking I don't know what other issues are lurking here. You would need to test with the software and see if addresses all the issues.
As a book i understand the desire to pin rather than tracking the latest software. though if I can help get this up to date rather than pin at a potentially old version it would be best. It is much worse when it is a library such as JayDeBeAPI which people are intended to build code on which is pinning to an ancient version. That generates a poor experience for both my users and results in me having to answer questions from times before I joined JPype on problems long since fixed.
from practical-nlp-code.
Related Issues (20)
- [BUG] for Ch4/08_LimeDemo.ipynb HOT 2
- Refactor the repo for compatibility with latest ubuntu & ML libraries
- Handle remaining issues in the pnlp-refactor-ubuntu23
- Fix notebook dying due to inactivity on Google Colab (ch 4, nb 6)
- Address DeepExplainer issue. Shap interface internals seem to have changed (ch 4, nb 10)
- Address Fast AI response issue. Fast AI return type seems to have changed (ch 4, nb 10)
- Fix notebook dying due to inactivity on Google Colab (ch 4, nb 7)
- Address LexNLP Library issue. Installing newer version of LexNLP give error (Ch10, nb 2)
- Address Autosklearn Library issue. Installing newer version of Autosklearn give error (Ch11, nb1)
- Fix Dependency Issues and Update code with latest versions of python libraries for Notebooks of Chapter 4
- Fix and Update Ch4/08_LimeDemo.ipynb to support latest version of Ubuntu and Python
- Fix and Update Ch4/09_Lime_RNN.ipynb to support latest version of Ubuntu and Python
- Fix Dependency Issues and Update code with latest versions of python libraries for Notebooks of Chapter 5
- [BUG] Chapter 2 Notebook 6 - 'utils' module not found
- macOS 'Buggy Accelerate Backend when using numpy 1.19'
- Issue with code sample in book from chapter 3 "PRE-TRAINED WORD EMBEDDINGS"
- [BUG] Mistakes in Ch4/01_OnePipeline_ManyClassifiers.ipynb HOT 5
- [BUG] Ch4/01_OnePipeline_ManyClassifiers.ipynb missing sklearn import HOT 4
- Update for current versions of spaCy, gensim, etc.? HOT 1
- [BUG]
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 practical-nlp-code.