Comments (8)
See this section of the documentation.
from chaquopy.
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.
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.
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()
from chaquopy.
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.
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.
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 thepython
section ofbuild.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.
Feel free to comment if you have any more problems.
from chaquopy.
Related Issues (20)
- How can I cache python library with Chaquopy and Github Actions? HOT 4
- OSError: Can't get source for <function swish_jit at 0x72d59118b0>. TorchScript requires source access in order to carry out compilation, make sure original .py files are available. HOT 2
- Could not resolve all artifacts for configuration ':classpath'. HOT 1
- Add support for Android Gradle plugin 8.6 HOT 1
- Remove support for buildPython version 3.8
- will u please to add duckdb,netcdf4,xarray packages? HOT 1
- Install of openai is failing with some issues related to jiter HOT 4
- Unable to install opencv-contrib-python HOT 1
- TomlError when building with pybase64 HOT 1
- jpype HOT 4
- Hope to support the following libraries HOT 7
- Compile Err when installing prophet HOT 2
- Failed to install pyzstd HOT 1
- Can't upgrade numpy library from 1.19 to 1.23.3 HOT 1
- Starting a web server causes the application to close itself HOT 1
- Build is not getting successful while installing pyramid-arima HOT 1
- SciPy for Python 3.11 or later
- [FR] com.chaquo.python should support com.android.dynamic-feature plugin HOT 2
- We need Ctranslate2 plz HOT 1
- Import the cantools library Failed 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 chaquopy.