|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Unidecode.NET is a .NET library that provides ASCII transliterations of Unicode text. The library converts Unicode strings to ASCII representations, useful for URL slugs, legacy system integration, and text processing where ASCII-only output is required. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +### Core Components |
| 12 | + |
| 13 | +- **Unidecoder.cs** (`src/Unidecoder.cs`): Main static class containing the transliteration logic |
| 14 | + - Supports two algorithms: `Fast` (optimized but limited to codepoints ≤65535) and `Complete` (proper handling of all Unicode codepoints including Chinese/Japanese) |
| 15 | + - Uses embedded resource file `unidecoder-decodemap.txt` for character mappings |
| 16 | + - Provides extension methods for string transliteration |
| 17 | + - Configurable algorithm selection via static `Algorithm` property |
| 18 | + |
| 19 | +### Project Structure |
| 20 | + |
| 21 | +- `src/`: Main library project (Unidecode.NET.csproj) |
| 22 | +- `test/`: Unit tests using xUnit framework |
| 23 | +- `benchmark/`: Performance benchmarking project |
| 24 | +- `assets/`: Contains the Unicode-to-ASCII mapping data file |
| 25 | + |
| 26 | +## Development Commands |
| 27 | + |
| 28 | +### Building |
| 29 | +```bash |
| 30 | +dotnet build -c Release |
| 31 | +``` |
| 32 | + |
| 33 | +### Running Tests |
| 34 | +```bash |
| 35 | +dotnet test -c Release --no-build |
| 36 | +``` |
| 37 | + |
| 38 | +### Running a Single Test |
| 39 | +```bash |
| 40 | +dotnet test -c Release --filter "TestMethodName" |
| 41 | +``` |
| 42 | + |
| 43 | +### Packaging |
| 44 | +```bash |
| 45 | +dotnet pack -c Release |
| 46 | +``` |
| 47 | + |
| 48 | +## Framework and Dependencies |
| 49 | + |
| 50 | +- Target Framework: .NET 7.0 |
| 51 | +- Test Framework: xUnit 2.4.1 |
| 52 | +- No external runtime dependencies for the main library |
| 53 | +- Uses embedded resources for character mapping data |
| 54 | + |
| 55 | +## Code Style |
| 56 | + |
| 57 | +- Follows .editorconfig settings: UTF-8, LF line endings, 2-space indentation, max line length 160 |
| 58 | +- XML documentation enabled for public APIs |
| 59 | +- Unsafe code blocks allowed for performance optimization |
| 60 | + |
| 61 | +## Testing |
| 62 | + |
| 63 | +Tests are located in `test/` directory: |
| 64 | +- `UnidecoderTest.cs`: Basic functionality tests |
| 65 | +- `CompleteUnidecoderTest.cs`: Comprehensive Unicode testing |
| 66 | + |
| 67 | +The CI/CD pipeline (GitHub Actions) automatically runs build and tests on push. |
0 commit comments