Git Product home page Git Product logo

Comments (7)

varunp2k avatar varunp2k commented on August 29, 2024

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.

nishkalavallabhi avatar nishkalavallabhi commented on August 29, 2024

@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.

varunp2k avatar varunp2k commented on August 29, 2024

@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.

sony-au avatar sony-au commented on August 29, 2024

@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.

Thrameos avatar Thrameos commented on August 29, 2024

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.

varunp2k avatar varunp2k commented on August 29, 2024

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.

Thrameos avatar Thrameos commented on August 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.