VnAddressSanitizer 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package VnAddressSanitizer --version 1.0.0
                    
NuGet\Install-Package VnAddressSanitizer -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VnAddressSanitizer" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VnAddressSanitizer" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="VnAddressSanitizer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VnAddressSanitizer --version 1.0.0
                    
#r "nuget: VnAddressSanitizer, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VnAddressSanitizer@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VnAddressSanitizer&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=VnAddressSanitizer&version=1.0.0
                    
Install as a Cake Tool

VnAddressSanitizer

NuGet License: MIT

Vietnamese address sanitizer for geocoding. Cleans noisy user input (phone numbers, delivery instructions, landmarks, duplicate admin units) into standardized address strings optimized for VietMap, Google Maps, HERE, and Mapbox APIs.

Installation

dotnet add package VnAddressSanitizer

Quick Start

using VnAddressSanitizer;

// Default geocoding-optimized sanitization
var clean = AddressSanitizer.Sanitize(
    "0868047361 gọi này nhận hàng dùm em, 31 trương phước phan"
);
// Result: "31 trương phước phan"

Before / After Examples

Input Output
0868047361 gọi này nhận hàng dùm em, 31 trương phước phan 31 trương phước phan
phone: 0944701399, 28b hai bà trưng, Xã Bình Hưng 28b hai bà trưng, Xã Bình Hưng
1279 Nguyễn Tất Thành (Khách Sạn Hiền Thuận) 1279 Nguyễn Tất Thành
158B Giai Phong, gần coopmart, Hải Phòng 158B Giai Phong, Hải Phòng
Hồ Chí Minh 700000, Việt Nam Hồ Chí Minh

Custom Options

var options = new SanitizeOptions
{
    RemoveParentheses = true,        // Remove (...) content
    RemovePhoneNumbers = true,       // Remove VN phone numbers
    RemoveInstructions = true,       // Remove delivery/contact notes
    RemoveDirectionNotes = true,     // Remove landmark/direction notes
    RemovePostalCodesAndCountry = true,  // Remove postal codes & "Việt Nam"
    DeduplicateAdminUnits = true,    // Deduplicate Phường/Quận/TP suffixes
    RemoveBuildingInfo = false,      // Keep building/floor info (useful for delivery)
    AdditionalPatterns = new[] { @"\bCustomPattern\b" }  // Add custom regex
};

var clean = AddressSanitizer.Sanitize(rawAddress, options);

Pipeline

Raw Input
  → Stage 1: Unicode Normalization (NFC, whitespace, dashes)
  → Stage 2: Parenthetical Content Removal
  → Stage 3: Noise Removal (phone, labels, instructions, landmarks, postal)
  → Stage 4: Admin Unit Deduplication
  → Stage 5: Punctuation Cleanup
  → Clean Output

Batch Testing with Console Runner

dotnet run --project tools/VnAddressSanitizer.Runner -- input.txt

Mac or Linux

dotnet run --project tools/VnAddressSanitizer.Runner -- "$(pwd)/sample_input.txt"

Supported .NET Versions

  • .NET 6.0
  • .NET 7.0
  • .NET 8.0
  • .NET 9.0

Known Trade-offs

  • Parentheses removal may remove useful info like (Hẻm 1539). Disable with RemoveParentheses = false.
  • Direction note removal is context-aware (requires separator prefix) but may occasionally remove relevant info.
  • Building info is preserved by default since it may be useful for delivery workflows.
  • This package does not parse addresses into structured admin units — it only cleans strings for better geocoding results.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 107 4/27/2026
1.0.0 117 4/26/2026