Description
Golang Transliterator provides one-way string transliteration. It takes Unicode text and coverts to ASCII characters. For example, Input: München, Output: Muenchen.
For now, only these languages have specific transliteration rules: DE, DA, EO, RU, BG, SV, HU, HR, SL, SR, NB, UK, MK, CA, BS. For other languages, general ASCII transliteration rules will be applied. Also, this package supports adding custom transliteration rules for your specific use-case. Please check the examples section below.
GO Transliterator alternatives and similar packages
Based on the "Text Processing" category.
Alternatively, view GO Transliterator alternatives based on common mentions on social networks and blogs.
-
micro-editor
A modern and intuitive terminal-based text editor -
sh
A shell parser, formatter, and interpreter with bash support; includes shfmt -
go-humanize
Go Humans! (formatters for units to human friendly sizes) -
goldmark
:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured. -
bluemonday
bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS -
commonregex
🍫 A collection of common regular expressions for Go -
mxj
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages. -
html-to-markdown
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules. -
Dataflow kit
Extract structured data from web sites. Web sites scraping. -
xpath
XPath package for Golang, supports HTML, XML, JSON document query. -
omniparser
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc. -
Koazee
A StreamLike, Immutable, Lazy Loading and smart Golang Library to deal with slices. -
go-pkg-rss
This package reads RSS and Atom feeds and provides a caching mechanism that adheres to the feed specs. -
go-edlib
📚 String comparison and edit distance algorithms library, featuring : Levenshtein, LCS, Hamming, Damerau levenshtein (OSA and Adjacent transpositions algorithms), Jaro-Winkler, Cosine, etc... -
gotabulate
Gotabulate - Easily pretty-print your tabular data with Go -
goq
A declarative struct-tag-based HTML unmarshaling or scraping package for Go built on top of the goquery library -
goribot
A simple golang spider/scraping framework,build a spider in 3 lines. -
xquery
XQuery lets you extract data from HTML/XML documents using XPath expression. -
strutil-go
Golang metrics for calculating string similarity and other string utility functions -
gospider
⚡ Light weight Golang spider framework | 轻量的 Golang 爬虫框架 -
github_flavored_markdown
GitHub Flavored Markdown renderer with fenced code block highlighting, clickable header anchor links. -
go-pkg-xmlx
Extension to the standard Go XML package. Maintains a node tree that allows forward/backwards browsing and exposes some simple single/multi-node search functions. -
editorconfig-core-go
EditorConfig Core written in Go -
shell2telegram
Telegram bot constructor from command-line -
regroup
Match regex group into go struct using struct tags and automatic parsing -
go-fixedwidth
Encoding and decoding for fixed-width formatted data -
go-zero-width
Zero-width character detection and removal for Go -
cat
Extract text from plaintext, .docx, .odt and .rtf files. Pure go. -
align
A general purpose application and library for aligning text. -
pagser
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler
Static code analysis for 29 languages.
Do you think we are missing an alternative of GO Transliterator or a related project?
README
Golang text Transliterator
Golang Transliterator provides one-way string transliteration. It takes Unicode text and converts to ASCII characters. Example use-case: transliterate cyrilic city name to be able to use it in the url ("Київ" ==> "Куiv").
For now, only these languages have specific transliteration rules: DE, DA, EO, RU, BG, SV, HU, HR, SL, SR, NB, UK, MK, CA, BS. For other languages, general ASCII transliteration rules will be applied. Also, this package supports adding custom transliteration rules for your specific use-case. Please check the examples section below.
Installation
go get -u github.com/alexsergivan/transliterator
Language specific transliteration example
package main
import (
"fmt"
"github.com/alexsergivan/transliterator"
)
func main() {
trans := transliterator.NewTransliterator(nil)
text := "München"
// Langcode should be provided accrding to ISO 639-1.
fmt.Println(trans.Transliterate(text, "de")) // Result: Muenchen
fmt.Println(trans.Transliterate(text, "en")) // Result: Munchen
anotherText := "你好"
fmt.Println(trans.Transliterate(anotherText, "")) // Result: Ni Hao
oneMoreText := "Київ"
fmt.Println(trans.Transliterate(oneMoreText, "uk")) // Result: Kyiv
fmt.Println(trans.Transliterate(oneMoreText, "en")) // Result: Kiyiv
fmt.Println(trans.Transliterate(oneMoreText, "")) // Result: Kiyiv
}
Adding of custom Language translitartion rules
package main
import (
"fmt"
"github.com/alexsergivan/transliterator"
)
func main() {
customLanguageOverrites := make(map[string]map[rune]string)
customLanguageOverrites["myLangcode"] = map[rune]string{
// Ї
0x407: "CU",
// и
0x438: "y",
}
trans := transliterator.NewTransliterator(&customLanguageOverrites)
text := "КиЇв"
fmt.Println(trans.Transliterate(text, "myLangcode")) // Result: KyCUv
}