Skip to content

Add argument to preserve unicode characters in json output.#307

Open
wayneworkman wants to merge 1 commit into
WikiExtractor:masterfrom
wayneworkman:master
Open

Add argument to preserve unicode characters in json output.#307
wayneworkman wants to merge 1 commit into
WikiExtractor:masterfrom
wayneworkman:master

Conversation

@wayneworkman

@wayneworkman wayneworkman commented Mar 31, 2023

Copy link
Copy Markdown

Here's a snippit from the Anthropology article before this code change using the --json argument.

Their New Latin ' derived from the combining forms of the Greek words \"\u00e1nthr\u014dpos\" (, \"human\") and \"l\u00f3gos\" (, \"study\").

Here it is after these code changes, using --json and --preserve-unicode

Their New Latin ' derived from the combining forms of the Greek words \"ánthrōpos\" (, \"human\") and \"lógos\" (, \"study\").

For text computing activities, it's nice to have the option to preserve these unicode characters in their true form, rather than ASCII representations.

@wayneworkman wayneworkman changed the title Add argument to preserve unicode in json output. Add argument to preserve unicode characters in json output. Mar 31, 2023
@wayneworkman

wayneworkman commented Apr 2, 2023

Copy link
Copy Markdown
Author

Thinking more on this pull request, when you load the JSON output text using json.loads() in python, the unicode is represented correctly in the loaded JSON. Given that, I think this pull request is only valid for a few scenarios:

  • When you're not loading the JSON output with a JSON tool; i.e. parsing it manually (not a great idea).
  • When you want to view the output manually as a sanity check to see what the source text looks like.
  • When you're using the JSON output for personal reading purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant