Comments (11)
The issue was due to the fact that JSON.stringify(this.json)
(function that is supposed to convert a JSON object to a JSON string) converts special characters like -
or "
into characters that are not JSON compliant. To avoid this I followed the SO links above to create a computed property named valid_json
that post-process the JSON file after JSON.stringify()
by replacing non-compliant characters by their unicode equivalents. This makes the JSON file valid:
valid_json: function () {
var json = JSON.stringify(this.json).replace(/[\u007F-\uFFFF]/g, function(chr) {
return "\\u" + ("0000" + chr.charCodeAt(0).toString(16)).substr(-4)
})
return json
}
from cdqa-annotator.
Hi @mamrou
- What code did you use to load the json file?
- Can you load the original input json file (before annotations)?
from cdqa-annotator.
Hi @fmikaelian
- a classic
with open('output.json') as json_file: bnp_data = json.load(json_file)
- Yes, there is no issue when loading the original input file before annotations.
from cdqa-annotator.
It seems it is an encoding error due to the followinf character: http://www.hexadecimaldictionary.com/hexadecimal/0xAC/. Maybe the annotator does not encode the question / answers with the correct format. We could compare squad json and our custom annotated json types to see where we are wrong?
from cdqa-annotator.
If you load the original json, do nothing and export it directly, can you read the output?
from cdqa-annotator.
Same encoding error message as above.
from cdqa-annotator.
Ok. Could you run a diff between original file and output file (without annotations)?
from cdqa-annotator.
I run a diff between the two json to spot potential tracks of failure. What I can say is that the encoding of some specific punctuations or characters (like `
, '
or €
) may be at the origin of the issue.
I will clean the original json from all those special characters and punctuations and keep you posted about the result.
from cdqa-annotator.
Could we just encode the output json with the same format as input directly in the annotator? Do you know what is the encoding format of the input SQuAD? Maybe we can find this info online?
from cdqa-annotator.
vscode report the following error for many lines in the output json: Invalid characters in string. Control characters must be escaped.json(262)
from cdqa-annotator.
- https://stackoverflow.com/questions/31649362/json-stringify-and-unicode-characters
- https://stackoverflow.com/questions/4901133/json-and-escaping-characters
from cdqa-annotator.
Related Issues (20)
- Add tour of the app for better user onboarding
- Use electron to make the annotator an app
- Add icons to buttons
- Create "Are you sure you want to delete paragraph" modal?
- Progress & Confirmation Toasts
- Refresh restarts the annotator
- Append random question_id to each annotation
- "Next" button is not working when article has a single paragraph
- Using tool to validate semi-automatically created question/answers pairs HOT 1
- JSON output is not able to be trained. HOT 1
- Issue with running vue serve on windows HOT 8
- I get Attribute error when try your example code in my system during prediction step. Though it works fine in colab
- http://localhost:8080/ not running after vue serve command HOT 3
- Dependencies not found running vue serve HOT 1
- after uploading json it doesnt load the next page for annotation HOT 4
- is there any limit on the no.of rows in a data-frame for the annotator to load the json file?
- "Next" Button doesn't work HOT 3
- Upload a pre-defined set of questions
- Local host issue
- 'Next' button freezes after 3 documents.
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 cdqa-annotator.