Skip to content

Commit 44cc0d9

Browse files
Text edits
1 parent 7c6f2bb commit 44cc0d9

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

docs/source/redact/redacting_json.rst

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
Redact JSON data
22
===================
3-
To redact sensitive information from a JSON string or Python dict, pass the object to the `redact_json` method:
43

5-
Like other SDK functions that modify data the `redact_html` allows you to configure how different entity types are treated. You can learn more about the common parameters:
4+
Using redact_json
5+
-----------------
66

7-
* generator_default
8-
* generator_config
9-
* label_allow_lists
10-
* label_block_lists
7+
To redact sensitive information from a JSON string or Python dict, pass the object to the ``redact_json`` method:
118

12-
by reading :ref:`redact-config`.
9+
Similar to other SDK functions that modify data, ``redact_html`` allows you to configure how to treat different entity types.
10+
11+
To learn more about the common parameters:
12+
13+
* ``generator_default``
14+
* ``generator_config``
15+
* ``label_allow_lists``
16+
* ``label_block_lists``
17+
18+
go to :ref:`redact-config`.
1319

1420
.. code-block:: python
1521
@@ -48,14 +54,20 @@ This produces the following output:
4854
Conversation data stored in JSON
4955
--------------------------------
5056

51-
When conversation data (typically text transcribed from audio recordings) is stored in JSON it is common for different parts of the conversation are found spread across multiple locations in JSON. Using the redact_json method is not ideal because each piece of text is treated independently when performing NER identification. This can result in worse NER identification. The :class:`JsonConversationHelper<tonic_textual.helpers.json_conversation_helper.JsonConversationHelper>` will process entire conversations in single NER calls yielding better performance and then return an NER result that still maps to your original JSON structure.
57+
When conversation data, such as text transcribed from audio recordings is stored in JSON, different parts of the conversation are often spread across multiple locations in JSON.
5258

53-
As an example, let's say you have a JSON document representing a conversation as follows:
59+
Using ``redact_json`` method is not ideal in this case, because NER identification treats each piece of text independently. This can result in worse NER identification.
60+
61+
The :class:`JsonConversationHelper<tonic_textual.helpers.json_conversation_helper.JsonConversationHelper>` processes entire conversations in single NER calls, which improves performance, and then returns an NER result that still maps to your original JSON structure.
62+
63+
For example, the following JSON document represents a conversation:
5464

5565
.. literalinclude:: json_conversation_example.json
5666
:language: JSON
5767

58-
Naively, we could process each speech utterance using our redact_json endpoint but we could lose context since each utterance would be run through our models independetly. Let's use the :class:`JsonConversationHelper<tonic_textual.helpers.json_conversation_helper.JsonConversationHelper>` to improve our results.
68+
Naively, we could use the ``redact_json`` endpoint to process each speech utterance. However, we might lose context, because each utterance runs through our models independetly.
69+
70+
To improve the results, we'll use the :class:`JsonConversationHelper<tonic_textual.helpers.json_conversation_helper.JsonConversationHelper>`.
5971

6072
.. code-block:: python
6173
@@ -79,7 +91,7 @@ Naively, we could process each speech utterance using our redact_json endpoint b
7991
8092
response = helper.redact(data, lambda x: x["conversation"]["transcript"], lambda x: x["content"], lambda content: ner.redact(content))
8193
82-
This yields the following redaction result below. Each piece of speech from the conversation is stored in its own element in the resulting array. The order of text in the response matches the order of text in the original conversation.
94+
This produces the following redaction result. In the resulting array, each piece of speech from the conversation is stored in its own element. The order of the text in the response matches the order of text in the original conversation.
8395

8496
.. literalinclude:: json_conversation_response.json
85-
:language: JSON
97+
:language: JSON

0 commit comments

Comments
 (0)