NextGenPowerToys.DataPrivacy.Hebrew
1.2.1
dotnet add package NextGenPowerToys.DataPrivacy.Hebrew --version 1.2.1
NuGet\Install-Package NextGenPowerToys.DataPrivacy.Hebrew -Version 1.2.1
<PackageReference Include="NextGenPowerToys.DataPrivacy.Hebrew" Version="1.2.1" />
<PackageVersion Include="NextGenPowerToys.DataPrivacy.Hebrew" Version="1.2.1" />
<PackageReference Include="NextGenPowerToys.DataPrivacy.Hebrew" />
paket add NextGenPowerToys.DataPrivacy.Hebrew --version 1.2.1
#r "nuget: NextGenPowerToys.DataPrivacy.Hebrew, 1.2.1"
#:package NextGenPowerToys.DataPrivacy.Hebrew@1.2.1
#addin nuget:?package=NextGenPowerToys.DataPrivacy.Hebrew&version=1.2.1
#tool nuget:?package=NextGenPowerToys.DataPrivacy.Hebrew&version=1.2.1
NextGenPowerToys.DataPrivacy.Hebrew
A comprehensive Hebrew text anonymization service for detecting and anonymizing PII/PCI data in Hebrew text with cultural awareness and typo tolerance.
Features
- Hebrew Language Support: Native Hebrew text processing with mixed Hebrew-digit number recognition
- Typo Tolerance: Handles common Hebrew misspellings (שמנה→שמונה, תשה→תשע)
- Cultural Awareness: Uses appropriate Hebrew terminology and placeholders
- 10 Entity Types: Credit cards, phone numbers, addresses, IDs, bank accounts, passports, emails, passwords, names, driver licenses
- High Performance: Sub-100ms processing with 98%+ accuracy
- GDPR Compliant: Privacy-first design with secure processing
Installation
dotnet add package NextGenPowerToys.DataPrivacy.Hebrew
Quick Start
1. Register Services
using NextGenPowerToys.DataPrivacy.Hebrew.BusinessServices;
// In Program.cs or Startup.cs
builder.Services.AddHebrewAnonymizationServices();
2. Basic Usage
using NextGenPowerToys.DataPrivacy.Hebrew.Abstractions.Interfaces;
public class MyService
{
private readonly IHebrewAnonymizationService _anonymizer;
public MyService(IHebrewAnonymizationService anonymizer)
{
_anonymizer = anonymizer;
}
public async Task<string> ProcessHebrewText(string hebrewText)
{
var result = await _anonymizer.AnonymizeAsync(hebrewText);
return result.AnonymizedText;
}
}
Usage Examples
Anonymizing Hebrew Text
var hebrewText = "שלום, מספר הכרטיס שלי הוא ארבע חמש שש שבע שמונה תשע אחד שתיים";
var result = await anonymizer.AnonymizeAsync(hebrewText);
Console.WriteLine(result.AnonymizedText);
// Output: "שלום, מספר הכרטיס שלי הוא [כרטיס אשראי]"
Console.WriteLine($"Detected {result.DetectedEntities?.Count} entities");
// Output: "Detected 1 entities"
Analyzing Without Anonymization
var result = await anonymizer.AnalyzeAsync("הטלפון שלי הוא אפס חמש שתיים אחד שלוש ארבע חמש שש שבע");
foreach (var entity in result.DetectedEntities ?? [])
{
Console.WriteLine($"Found {entity.EntityType} at position {entity.Start}-{entity.End}");
}
// Output: "Found PHONE_NUMBER at position 15-45"
Validating Hebrew Text
var isValid = await anonymizer.ValidateInputAsync("טקסט בעברית");
Console.WriteLine($"Text is valid: {isValid}");
// Output: "Text is valid: True"
Getting Supported Entities
var entities = await anonymizer.GetSupportedEntitiesAsync();
foreach (var entity in entities)
{
Console.WriteLine($"Supported: {entity}");
}
// Output: CREDIT_CARD, PHONE_NUMBER, ADDRESS, etc.
Supported Entity Types
Entity Type | Hebrew Placeholder | Example Pattern |
---|---|---|
Credit Card | [כרטיס אשראי] |
כרטיס + Hebrew numbers |
Phone Number | [טלפון] |
טלפון/נייד + Hebrew numbers |
Address | [כתובת] |
רחוב + Hebrew text + numbers |
Israeli ID | [תעודת זהות] |
9-digit Israeli format |
Bank Account | [חשבון בנק] |
Israeli bank formats |
Passport | [דרכון] |
Mixed alphanumeric |
[מייל] |
Standard email format | |
Password | [סיסמה] |
Hebrew context + numbers |
Person Name | [שם פרטי] |
Hebrew name patterns |
Driver License | [רישיון נהיגה] |
Israeli license format |
Hebrew Number Recognition
The service recognizes Hebrew numbers with typo tolerance:
// All these variations are recognized:
"אחד שתיים שלוש" // Standard
"אחה שתים שלש" // Common typos
"אחד 2 שלוש" // Mixed Hebrew-digits
"אחד שתיים שלוש" // Variable spacing
Configuration
Custom Configuration
builder.Services.AddHebrewAnonymizationServices(options =>
{
options.EnableTypoTolerance = true;
options.MinimumConfidenceScore = 0.8;
options.PreserveHebrewContext = true;
});
Advanced Usage with Dependency Injection
public class HebrewTextProcessor
{
private readonly IHebrewAnonymizationService _anonymizer;
private readonly ILogger<HebrewTextProcessor> _logger;
public HebrewTextProcessor(
IHebrewAnonymizationService anonymizer,
ILogger<HebrewTextProcessor> logger)
{
_anonymizer = anonymizer;
_logger = logger;
}
public async Task<ProcessingResult> ProcessBankConversation(string conversation)
{
try
{
// Validate input
if (!await _anonymizer.ValidateInputAsync(conversation))
{
return ProcessingResult.Invalid("Invalid Hebrew text");
}
// Anonymize
var result = await _anonymizer.AnonymizeAsync(conversation);
_logger.LogInformation("Processed conversation with {EntityCount} entities",
result.DetectedEntities?.Count ?? 0);
return ProcessingResult.Success(result.AnonymizedText, result.DetectedEntities);
}
catch (Exception ex)
{
_logger.LogError(ex, "Failed to process Hebrew conversation");
return ProcessingResult.Error(ex.Message);
}
}
}
Performance
- Processing Speed: < 100ms per 1000 characters
- Memory Usage: < 100MB for 10,000 test strings
- Accuracy: 98%+ detection rate
- Precision: > 95% (minimal false positives)
Thread Safety
All services are thread-safe and can be used in concurrent scenarios:
var tasks = hebrewTexts.Select(async text =>
await anonymizer.AnonymizeAsync(text));
var results = await Task.WhenAll(tasks);
Error Handling
try
{
var result = await anonymizer.AnonymizeAsync(hebrewText);
}
catch (InvalidHebrewTextException ex)
{
// Handle invalid Hebrew text
logger.LogWarning("Invalid Hebrew text: {Message}", ex.Message);
}
catch (HebrewProcessingException ex)
{
// Handle processing errors
logger.LogError(ex, "Hebrew processing failed");
}
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.
Support
For issues and questions, please visit our GitHub repository or contact the NextGenPowerToys team.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.