NLTK not working in Buildozer Android KivyMD app

19 views
Skip to first unread message

Tanish Gupta

unread,
Nov 5, 2021, 1:17:04 PM11/5/21
to nltk-users
I am making a basic app with KivyMD, which uses NLTK. The program works well in Pycharm IDE, but while compiling with Buildozer, the Android App crashes after opening up. JSON works well importing the json file dataset; so, I suppose..NLTK has some issues. 


This is the main.py file:
import kivymd 
from kivymd.app import MDApp 
from kivymd.uix.screen import Screen
from kivymd.uix.label import MDLabel 
import nltk 
import json 
with open("intents.json") as file: 
    data = json.load(file) 
words = str(nltk.word_tokenize(str([data["intents"][0]["patterns"][0]]))) 
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer() 
stemmertest = stemmer.stem('addition') 
class MainApp(MDApp): 
     def build(self): 
         screen = Screen() 
          label = MDLabel(text=words, pos_hint={'center_x': 0.7, 'center_y': 0.3}) 
         label2 = MDLabel(text=stemmertest, pos_hint={'center_x': 0.7, 'center_y': 0.5})
         screen.add_widget(label) 
         screen.add_widget(label2) 
         return screen 
MainApp().run()

I am writing the requirements in the Buildozer.spec as:

requirements = python3,kivy==2.0.0,kivymd==0.104.1,nltk==3.2.5,goslate,chardet,idna

Please help me in this.

Reply all
Reply to author
Forward
0 new messages