gingerit icon indicating copy to clipboard operation
gingerit copied to clipboard

JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Open IvyTan29 opened this issue 4 years ago • 14 comments

Hi.

Sorry, I know that there is a similar issue raised like the one here.

I saw your reply:

"Try it again. It seems there were no response data."

However, I kept trying it (rerunning the code) and the same error appears. I even tried reinstalling gingerit.

This is the error:

File "file_path", line 11, in process_grammar
    result = self.parser.parse(text)['result']
  File "file_path/venv/lib/python3.7/site-packages/gingerit/gingerit.py", line 27, in parse
    data = request.json()
  File "file_path/venv/lib/python3.7/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/anaconda3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/opt/anaconda3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

And this is the source code:

from gingerit.gingerit import GingerIt

parser = GingerIt()

text = "I can also help take care of younger kids at playground. At playground, I can help my friend take care of the ball. I also like to help out and think about the feelings of others."

print(parser.parse(text)['result'])

Any help would be great. Thank you so much!

IvyTan29 avatar Jan 28 '22 06:01 IvyTan29

I am having the same issue. Is gingerit down for some reason?

I tried parsing the HTML and got this errors:

Access denied | services.gingersoftware.com used Cloudflare to restrict access . . . "This website is using a security service to protect itself from online attacks."

So cloudfare is messing something up? Please look into this.

apatra9 avatar Jan 28 '22 17:01 apatra9

i too have same issue. lemme know if anyone know how to fix it.

MythicalMAxX avatar Jan 28 '22 19:01 MythicalMAxX

I am also facing the same issue. Please guys fix his issue. if anyone is able to fix it or have any solution the please mention me.

ghostpacketload avatar Jan 29 '22 18:01 ghostpacketload

It was cloudflare antibot which was blocking request. So you all can fix it by importing cloudscraper and replacing line 16 session = requests.Session() TO session = cloudscraper.create_scraper() In gingerit.py it worked for me. and i hope it works for you all too. @BabyCodePvt @IvyTan29 @apatra9

MythicalMAxX avatar Jan 29 '22 19:01 MythicalMAxX

@MythicalMAxX thank you so much, it worked for me!!

IvyTan29 avatar Jan 30 '22 00:01 IvyTan29

@MythicalMAxX Bro you saved the day. It worked. Thanks. I hope the PR gets approved soon.

ghostpacketload avatar Jan 30 '22 06:01 ghostpacketload

{ "failure": false, "data": { "finalCorrectedString": " My name is Pawan what is your name", "mistakes": [ { "text": "my name is pawan what is your name.", "result": " My name is Pawan what is your name", "corrections": [ { "text": "m", "correct": "My", "definition": null }, { "text": "pawa", "correct": "Pawan", "definition": null } ] } ] } }

@MythicalMAxX After change it start working but did not getting the index parameter that come before changes, key name was "start" Now there is no key name start in the response.

ghostpacketload avatar Jan 30 '22 10:01 ghostpacketload

i recommend you to check your file again because here's what i am getting {'text': 'my name is pawan what is your name.', 'result': 'My name is Pawan what is your name.', 'corrections': [{'start': 11, 'text': 'pawan', 'correct': 'Pawan', 'definition': None}, {'start': 0, 'text': 'my', 'correct': 'My', 'definition': None}]} cloudscraper only bypass bot detection and nothing else

Screenshot (74)

check for start declaration in gingerit.py keep me updated

MythicalMAxX avatar Jan 30 '22 11:01 MythicalMAxX

@MythicalMAxX thanks it's working fine now. I have a query. can we use this library in big project where this library get thousand of request per second. or This library have some limitations.

ghostpacketload avatar Jan 30 '22 14:01 ghostpacketload

@MythicalMAxX thanks it's working fine now. I have a query. can we use this library in big project where this library get thousand of request per second. or This library have some limitations.

I've integrated this library with telegram and it is working fine so i don't think there will be any problem with traffic but there is a limitation like you won't be able to use long paragraphs. I think there is a limit for alphabets you can use.

MythicalMAxX avatar Jan 30 '22 16:01 MythicalMAxX

Alternatively, I was using gingerit in my python library but I decided to train my own model for sentence correction. Feel free to give me some feedback. I keep it updated by gathering more data and retraining the model.

import Caribe as cb


sentence = "I am lived with my parenmts "
correction = cb.t5_kes_corrector(sentence)


print(correction) # Output: I am living with my parents.

KestonSmith avatar Feb 06 '22 23:02 KestonSmith

It was cloudflare antibot which was blocking request. So you all can fix it by importing cloudscraper and replacing line 16 session = requests.Session() TO session = cloudscraper.create_scraper() In gingerit.py it worked for me. and i hope it works for you all too. @BabyCodePvt @IvyTan29 @apatra9

Not working for me in Google Colab

abhiram1809 avatar May 01 '22 12:05 abhiram1809

Hello Abhiram I don't have much experience with Google colab. I recommend you to check that you edited the right file. Or you can fork this repo, edit it and then install it instead. Hope this helps

MythicalMAxX avatar May 01 '22 14:05 MythicalMAxX

It was cloudflare antibot which was blocking request. So you all can fix it by importing cloudscraper and replacing line 16 session = requests.Session() TO session = cloudscraper.create_scraper() In gingerit.py it worked for me. and i hope it works for you all too. @BabyCodePvt @IvyTan29 @apatra9

Iam trying to create an API using GingerIt, I am using DETA to deploy this.how can I change this after I deploy this API?

imshibl avatar Jul 26 '22 04:07 imshibl