From afbf24b58398233a95edc59c3a20fc5c659b45cb Mon Sep 17 00:00:00 2001 From: maks-operlejn-ds Date: Wed, 11 Oct 2023 22:02:47 +0000 Subject: [PATCH] Reorder notebooks in docs --- .../multi_language.ipynb | 28 +++++++++++++------ .../qa_privacy_protection.ipynb | 9 ++++++ .../reversible.ipynb | 12 +++++++- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/docs/docs/guides/privacy/presidio_data_anonymization/multi_language.ipynb b/docs/docs/guides/privacy/presidio_data_anonymization/multi_language.ipynb index b6e3100e8d0c6..c7e8d6c87058e 100644 --- a/docs/docs/guides/privacy/presidio_data_anonymization/multi_language.ipynb +++ b/docs/docs/guides/privacy/presidio_data_anonymization/multi_language.ipynb @@ -1,5 +1,15 @@ { "cells": [ + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "---\n", + "sidebar_position: 2\n", + "title: Multi-language anonymization\n", + "---" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -248,15 +258,15 @@ "import langdetect\n", "from langchain.schema import runnable\n", "\n", + "\n", "def detect_language(text: str) -> dict:\n", " language = langdetect.detect(text)\n", " print(language)\n", " return {\"text\": text, \"language\": language}\n", "\n", "\n", - "chain = (\n", - " runnable.RunnableLambda(detect_language)\n", - " | (lambda x: anonymizer.anonymize(x[\"text\"], language=x[\"language\"]))\n", + "chain = runnable.RunnableLambda(detect_language) | (\n", + " lambda x: anonymizer.anonymize(x[\"text\"], language=x[\"language\"])\n", ")" ] }, @@ -345,15 +355,17 @@ "import fasttext\n", "\n", "model = fasttext.load_model(\"lid.176.ftz\")\n", + "\n", + "\n", "def detect_language(text: str) -> dict:\n", - " language = model.predict(text)[0][0].replace('__label__', '')\n", + " language = model.predict(text)[0][0].replace(\"__label__\", \"\")\n", " print(language)\n", " return {\"text\": text, \"language\": language}\n", "\n", - "chain = (\n", - " runnable.RunnableLambda(detect_language)\n", - " | (lambda x: anonymizer.anonymize(x[\"text\"], language=x[\"language\"]))\n", - ")\n" + "\n", + "chain = runnable.RunnableLambda(detect_language) | (\n", + " lambda x: anonymizer.anonymize(x[\"text\"], language=x[\"language\"])\n", + ")" ] }, { diff --git a/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb b/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb index df08756fb493b..13e7e500eed42 100644 --- a/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb +++ b/docs/docs/guides/privacy/presidio_data_anonymization/qa_privacy_protection.ipynb @@ -1,5 +1,14 @@ { "cells": [ + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "---\n", + "sidebar_position: 3\n", + "---" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/docs/docs/guides/privacy/presidio_data_anonymization/reversible.ipynb b/docs/docs/guides/privacy/presidio_data_anonymization/reversible.ipynb index 745566b0d82eb..a94b0eabaf7bf 100644 --- a/docs/docs/guides/privacy/presidio_data_anonymization/reversible.ipynb +++ b/docs/docs/guides/privacy/presidio_data_anonymization/reversible.ipynb @@ -1,5 +1,15 @@ { "cells": [ + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "---\n", + "sidebar_position: 1\n", + "title: Reversible anonymization \n", + "---" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -623,4 +633,4 @@ }, "nbformat": 4, "nbformat_minor": 4 -} \ No newline at end of file +}