Giter VIP home page Giter VIP logo

Comments (8)

mhsmith avatar mhsmith commented on September 16, 2024

See this section of the documentation.

from chaquopy.

MuneebAhmadMashwani avatar MuneebAhmadMashwani commented on September 16, 2024

I have read this and applied, but my problem is still there
i have used like:

python {
    extractPackages "jellyfish", "jellyfish.levenshtein_distance"
}

have also tried like:

readme = ssc.get_data(__name__, "README.txt")
ssc.load_dictionary(readme, term_index=0, count_index=1)

from chaquopy.

mhsmith avatar mhsmith commented on September 16, 2024

To help you I'll need to know:

  • Where within your source code is the README.txt, and where is the code fragment you quoted?
  • What were the actual errors?

from chaquopy.

MuneebAhmadMashwani avatar MuneebAhmadMashwani commented on September 16, 2024

Basically, I am trying spell correction of text based on a dictionary I loaded to it.
The code is as follows:

from sympound import sympound
distancefun = None 
from jellyfish import levenshtein_distance 
distancefun = levenshtein_distance
ssc = sympound(distancefun=distancefun, maxDictionaryEditDistance=3)
input_txt="Fr the begining of  new pragraph mark a chnge of tpic or a step in the developmnt of an argment or of a story."
input_text_s=input_txt.lower()
def test():
        print("cig")
        print(ssc.load_dictionary("corpus/dic/sorted/corp_hicrush.txt", term_index=0, count_index=1))
        a=ssc.lookup_compound(input_string=input_text_s , edit_distance_max=1)
        return a
test()

error:

from chaquopy.

mhsmith avatar mhsmith commented on September 16, 2024

Your error doesn't seem to correspond to your code, since get_data doesn't appear in your test function. Are you sure you've given the correct error? (Please include the whole stack trace: if you're using an emulator then you can copy and paste it, otherwise you can get it from the Logcat window in Android Studio.)

from chaquopy.

MuneebAhmadMashwani avatar MuneebAhmadMashwani commented on September 16, 2024

get_data is being used by the libarary "sympound" and the python code is working fine when i run in simple python envoirnment.

Here is the error i get in console:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "stdlib/threading.py", line 916, in bootstrap_inner
  File "stdlib/threading.py", line 864, in run
  File "/android_asset/chaquopy/app.zip/chaquopy/utils/console.py", line 14, in <lambda>
    threading.Thread(target=lambda: runnable.run()).start()
  File "class.pxi", line 696, in java.chaquopy.JavaMethod._get_.lambda2
  File "class.pxi", line 716, in java.chaquopy.JavaMethod._call__
  File "class.pxi", line 806, in java.chaquopy.JavaMethod.call_nonvirtual_method
  File "env.pxi", line 242, in java.chaquopy.CQPEnv.CallNonvirtualVoidMethodA
  File "env.pxi", line 484, in java.chaquopy.CQPEnv.check_exception
com.chaquo.python.PyException: AttributeError: 'sympound' object has no attribute 'get_data'
	at <python>.test(/android_asset/chaquopy/app.zip/main.py:21)
	at <python>.chaquopy_java.call(chaquopy_java.pyx:274)
	at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrows(chaquopy_java.pyx:246)
	at com.chaquo.python.PyObject.callAttrThrows(Native Method)
	at com.chaquo.python.PyObject.callAttr(PyObject.java:140)
	at com.chaquo.python.console.MainActivity$Task.run(MainActivity.java:21)
	at com.chaquo.python.utils.ConsoleActivity$Task$1.run(ConsoleActivity.java:333)

from chaquopy.

mhsmith avatar mhsmith commented on September 16, 2024

I'm sorry, but I think you're you're still giving either the wrong code or the wrong stack trace. The stack trace shows get_data is being called on main.py line 21, but the code in your previous comment doesn't include any reference to get_data.

I'm not familiar with sympound, but I was able to get your code to run with the following steps:

  • Create the following empty files in app/src/main/python:
    • muneeb/__init__.py
    • muneeb/test.txt
  • Add extractPackages "muneeb" to the python section of build.gradle.
  • Paste the code from your previous comment into the main function of the console app, and edit it as follows:
    print("cig")
    from os.path import dirname, join
    import muneeb
    print(ssc.load_dictionary(join(dirname(muneeb.__file__), "test.txt"), term_index=0, count_index=1))
    

I hope you can adapt that to your needs.

from chaquopy.

mhsmith avatar mhsmith commented on September 16, 2024

Feel free to comment if you have any more problems.

from chaquopy.

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.