I'm kind of working on string operation, here is what i want to do
- i created a functions gettext(request) for getting text from *.txt files, this is the code
def gettext(request):
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
f = request.FILES['file']
for chunk in f.chunks():
text = chunk
return render(request, 'ecs/index.html', {'text': text, 'form': form})
else:
form = UploadFileForm()
return render_to_response('ecs/index.html', {'form': form})
and then i want to get the data that i stored on text variable to a functions, called preprocessing
def preprocessing(text):
pp = Preprocess()
wordTokenize = pp.tokenizing(text)
return wordTokenize
how can i use the preprocessing(text) method to handle data from text variable on gettext method.
i tried some tricks, but still no progress.