liveBook · Manning

Anonymization

As explained in Natural Language Processing in Action, Second Edition

Anonymization is the transformation of data to remove or obscure information that can identify individuals.

Anonymization transforms data by replacing or obscuring identifying information. In multilingual chatbot datasets, name substitution makes conversations shareable while preserving realistic interaction patterns. section 8.2

RNN models can support anonymization through named entity recognition and generation of fictional names, social security numbers, telephone numbers, and other PII. This process remains imperfect: names cross nationality boundaries, language categories overlap, and dataset bias can limit representation. section 8.2

Building a global surname resource

A surname–nationality dataset combines public APIs and internal chatbot data, then expands underrepresented regions. Inspecting duplicate surnames reveals ambiguity: Michel appears across six nationality categories, making deterministic identification unreliable. section 8.2

Listing 8.3 Loading the surname data
>>> repo = 'tangibleai/nlpia2'                            #1
>>> filepath = 'src/nlpia2/data/surname-nationality.csv.gz'
>>> url = f"https://gitlab.com/{repo}/-/raw/main/{filepath}"
>>> df = pd.read_csv(url)                  #2
>>> df[['surname', 'nationality']].sort_values('surname').head(9)
        surname nationality
16760   Aalbers       Dutch
16829   Aalders       Dutch
35706  Aalsburg       Dutch
35707     Aalst       Dutch
11070     Aalto     Finnish
11052  Aaltonen     Finnish
10853     Aarab    Moroccan
35708     Aarle       Dutch
11410    Aarnio     Finnish

Load and inspect the surname–nationality dataset used to develop anonymization mappings. section 8.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Demonstrates name substitution, fictional-data generation, dataset construction, and ambiguity limitations without specifying a complete production workflow.
Examples
Uses multilingual chatbot dialogs, surname–nationality data, fictional names, and generated social security and telephone numbers.
What you can do after
Apply it via RNN models and substitution scripts to create more shareable chatbot datasets with representative names.
How it connects
Connects anonymization with recurrent neural networks, named entity recognition, personally identifiable information, and dataset bias.

Also explained in

Compare how 6 books explain anonymization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.