File: README.md

package info (click to toggle)
golang-github-gosimple-unidecode 1.0.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 984 kB
  • sloc: makefile: 2
file content (58 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# unidecode

[![Go Reference](https://pkg.go.dev/badge/github.com/gosimple/unidecode.svg)](https://pkg.go.dev/github.com/gosimple/unidecode)
[![Tests](https://github.com/gosimple/unidecode/actions/workflows/tests.yml/badge.svg)](https://github.com/gosimple/unidecode/actions/workflows/tests.yml)

Unicode transliterator in Golang - Replaces non-ASCII characters with their
ASCII approximations.

Fork of https://github.com/rainycape/unidecode

## Example

```go
package main

import (
	"fmt"

	"github.com/gosimple/unidecode"
)

func main() {
	decoded := unidecode.Unidecode("Łódź")
	fmt.Println(decoded)
	// Output: Lodz
}
```

### Requests or bugs?

<https://github.com/gosimple/unidecode/issues>

## Installation

```shell
go get -u github.com/gosimple/unidecode
```

## Benchmark

```shell
go test -run=NONE -bench=. -benchmem -count=6 ./... > old.txt
# make changes
go test -run=NONE -bench=. -benchmem -count=6 ./... > new.txt

go install golang.org/x/perf/cmd/benchstat@latest

benchstat old.txt new.txt
```

## Add new characters

1. Edit `table.txt` file.
2. Rebuild `table.go` file:

   ```go
   go run ./make_table.go
   ```