frameworks such as Stanza or transformers when necessary.Quickstart‚Äã# Install necessary packages# ! pip install langchain langchain-experimental openai presidio-analyzer presidio-anonymizer spacy Faker# ! python -m spacy download en_core_web_lgfrom langchain_experimental.data_anonymizer import PresidioReversibleAnonymizeranonymizer = PresidioReversibleAnonymizer(    analyzed_fields=["PERSON"],)By default, PresidioAnonymizer and PresidioReversibleAnonymizer use a model trained on English texts, so they handle other languages moderately well. For example, here the model did not detect the person:anonymizer.anonymize("Me llamo Sof√≠a")  # "My name is Sof√≠a" in Spanish    'Me llamo Sof√≠a'They may also take words from another language as actual entities. Here, both the word 'Yo' ('I' in Spanish) and Sof√≠a have been classified as PERSON:anonymizer.anonymize("Yo soy Sof√≠a")  # "I am Sof√≠a" in Spanish    'Kari Lopez soy Mary Walker'If you want to anonymise texts from other languages, you need to download other models and add them to the anonymiser configuration:# Download the models for the languages you want to use# ! python -m spacy download en_core_web_md# ! python -m spacy download es_core_news_mdnlp_config = {    "nlp_engine_name": "spacy",    "models": [        {"lang_code": "en", "model_name": "en_core_web_md"},        {"lang_code": "es", "model_name": "es_core_news_md"},    ],}We have therefore added a Spanish language model. Note also that we have downloaded an alternative model for English as well - in this case we have replaced the large model en_core_web_lg (560MB) with its smaller version en_core_web_md (40MB) - the size is therefore reduced by 14 times! If you care about the speed of anonymisation, it is worth considering it.All models for the different languages can be found in the spaCy documentation.Now pass the configuration as the languages_config parameter to Anonymiser. As you can see, both previous examples work flawlessly:anonymizer =
Open In Colab
Open In Colab ->: frameworks such as Stanza or transformers when necessary.Quickstart‚Äã# Install necessary packages# ! pip install langchain langchain-experimental openai presidio-analyzer presidio-anonymizer spacy Faker# ! python -m spacy download en_core_web_lgfrom langchain_experimental.data_anonymizer import PresidioReversibleAnonymizeranonymizer = PresidioReversibleAnonymizer(    analyzed_fields=["PERSON"],)By default, PresidioAnonymizer and PresidioReversibleAnonymizer use a model trained on English texts, so they handle other languages moderately well. For example, here the model did not detect the person:anonymizer.anonymize("Me llamo Sof√≠a")  # "My name is Sof√≠a" in Spanish    'Me llamo Sof√≠a'They may also take words from another language as actual entities. Here, both the word 'Yo' ('I' in Spanish) and Sof√≠a have been classified as PERSON:anonymizer.anonymize("Yo soy Sof√≠a")  # "I am Sof√≠a" in Spanish    'Kari Lopez soy Mary Walker'If you want to anonymise texts from other languages, you need to download other models and add them to the anonymiser configuration:# Download the models for the languages you want to use# ! python -m spacy download en_core_web_md# ! python -m spacy download es_core_news_mdnlp_config = {    "nlp_engine_name": "spacy",    "models": [        {"lang_code": "en", "model_name": "en_core_web_md"},        {"lang_code": "es", "model_name": "es_core_news_md"},    ],}We have therefore added a Spanish language model. Note also that we have downloaded an alternative model for English as well - in this case we have replaced the large model en_core_web_lg (560MB) with its smaller version en_core_web_md (40MB) - the size is therefore reduced by 14 times! If you care about the speed of anonymisation, it is worth considering it.All models for the different languages can be found in the spaCy documentation.Now pass the configuration as the languages_config parameter to Anonymiser. As you can see, both previous examples work flawlessly:anonymizer =