> For the complete documentation index, see [llms.txt](https://docs.sdv.dev/rdt/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/phone-number/anonymizedgeoextractor.md).

# ＊ AnonymizedGeoExtractor

{% hint style="info" %}
**＊SDV Enterprise Feature.** This feature is available to our licensed users and is not currently in our public library. For more information, visit our page to [Explore SDV](https://docs.sdv.dev/sdv/explore/sdv-enterprise/compare-features).
{% endhint %}

The `AnonymizedGeoExtractor` performs Contextual Anonymization on phone number data. It transforms phone numbers by extracting geographical context. When reversing the transform, it generates new, fake phone numbers in the correct context.

![](/files/Ezq9ywVDPLhTtPCHJULx)

```python
from rdt.transformers.phone_number import AnonymizedGeoExtractor

transformer = AnonymizedGeoExtractor()
```

## Parameters

**`default_country`**: If phone number does not have an international country code, provide the country code to use.

<table data-header-hidden><thead><tr><th width="214"></th><th></th></tr></thead><tbody><tr><td>(default) <code>None</code></td><td>No default country. All phone numbers must have international country codes.</td></tr><tr><td><code>&#x3C;string></code></td><td>A string representing an <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">Alpha-2 country code</a> (<code>"US"</code>)</td></tr></tbody></table>

**`match_unique_numbers_per_region`**: Limit the number of new phone numbers created to the number originally found in the dataset.

<table data-header-hidden><thead><tr><th width="221"></th><th></th></tr></thead><tbody><tr><td>(default) <code>False</code></td><td>Create a variety of new phone numbers based on the geography</td></tr><tr><td><code>True</code></td><td>Put a limit on the amount of new phone numbers created. Phone numbers will be recycled after the limit is reached.</td></tr></tbody></table>

{% hint style="warning" %}
Setting this to `True` will leak information about the number of phone numbers within each geographical region. However, these numbers will be newly created numbers that may not appear in the original data. Always evaluate the risk of a data leak before sharing your transformed data.
{% endhint %}

### Examples

```python
from rdt.transformers.phone_number import AnonymizedGeoExtractor

transformer = AnonymizedGeoExtractor(
    default_country="US",
    match_unique_numbers_per_region=True
)
```

## Attributes

After fitting the transformer, you can access the learned values through the attributes.

**`region_to_unique_count`**: The number of unique phone numbers that belong to every region found in the original data

```python
>>> transformer.region_to_unique_count
{
  ('US', 'Berkeley,CA'): 15,
  ('US', 'Cambridge,MA'): 34,
  ...
}
```

*Note: If you have not selected to match unique numbers per region, then the transformer will not store these values and you'll see `None` instead.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/phone-number/anonymizedgeoextractor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
