<commit_before>Writing ipuz puzzles
====================

The following writes the puzzle instance to a JSONP string ``data``:

::

    import ipuz
    data = ipuz.write(puzzle)

As the specification recommends JSONP the above produces a JSONP string.
You can also write a JSON string by using:

::

    import ipuz
    data = ipuz.write(puzzle, json_only=True)

By default the callback function ``ipuz`` is used in the JSONP format. You
can specify a different callback function name as follows:

::

    import ipuz
    data = ipuz.write(puzzle, callback_name="ipuz_function")<commit_msg>Extended the documentation about writing puzzles<commit_after>Writing ipuz puzzles
====================

The function ``ipuz.write`` can be used to convert a puzzle as a Python
dictionary object to a JSON / JSONP string. This function performs no validation
on the provided puzzle and as such it is the application's responsibility
to construct a valid puzzle that can be read by ``ipuz.read`` or other
applications.

The following writes a Python dictionary ``puzzle`` to a string called ``data``:

::

    import ipuz
    data = ipuz.write(puzzle)

As the specification recommends JSONP the above produces a JSONP string.
You can create a JSON string by using ``json_only=True``:

::

    import ipuz
    data = ipuz.write(puzzle, json_only=True)

By default the callback function ``ipuz`` is used in the JSONP format. You
can specify a different callback function name by using
the ``callback_name`` parameter:

::

    import ipuz
    data = ipuz.write(puzzle, callback_name="ipuz_function")
{'fraction_non_alphanumeric': 0.09274447949526814, 'fraction_numerical': 0.0, 'mean_word_length': 4.358108108108108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3660268', 'n_tokens_mistral': 451, 'n_tokens_neox': 423, 'n_words': 199}