• Stars
    star
    104
  • Rank 319,319 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Go Lang package for dealing with Arabic text.

GoArabic

Build Status GoDoc

A Go Lang package for dealing with Arabic text.

This is an initial work on a set of Go functions developed to enhance Arabic web applications. It all started when I wanted to develop a self-hosted no-dependency and standalone Arabic Captcha in Go (for fun, as I was discovering Go ~8 yrs ago), and as expected, the Arabic text wasn't rendered as it should:

Before processing

So I started playing with Glyphs, unicode, and the special Arabic rules for joining letters. After a bit of work, I got this:

Before processing

shouldn't this be a separated package, along with other functionalities? I guess it should!

Current functionalities

  • Glyph representation of the given Arabic text for images/pdf .. etc generation.
  • Strip Tashkeel (Arabic Vowels).
  • SmartLengh: return the length of the given Arabic String without considering Tashkeel (Arabic Vowels).
  • Strip Tatweel
  • rune-wise (UTF-8) reverse of the Arabic text, leaving out the Latin one.

Todo

  • Arabic text normalization (Unshaping)
  • Add support for some special Quran text characters in Glyphs
  • Richer SmartLengh, ignoring some special characters.
  • Slugify: a simple Arabic slug generation. Striping Tashkeel and other special chars.
  • Spell numbers in Arabic idiom.
  • Present dates in Arabic or Hijri and convert Hijri date into Unix timestamp And maybe more...

Usage

Importing

go get github.com/01walid/goarabic
Example Usage
package main

import (
    "fmt"
    "github.com/01walid/goarabic"
)

func main() {
    fmt.Println(goarabic.RemoveTashkeel("ู†ู‹ุตูŒ ุนูŽุฑุจูŠู‘ู"))
    fmt.Println(goarabic.ToGlyph("ุชุฌุฑุจุฉ ุงู„ู†ุต ุงู„ุนุฑุจูŠ"))
}

Documentation

Package docs available on gopkgdoc.

Contributing

Contributions are greatly appreciated. Please fork this repository, make your changes, and open a pull request. More test cases and considerations might be needed, you can run tests using go test for the existing functionalities.

This a SemVersioned package.

License

MIT License.

More Repositories

1

awesome-arabic

A curated list of awesome projects and dev/design resources for supporting Arabic computational needs.
472
star
2

Nibras

ู‚ุงู…ูˆุณ ูุฑู†ุณูŠ-ุนุฑุจูŠ ู…ูˆุฌู‡ ุฅู„ู‰ ุทู„ุจุฉ ุงู„ุณู†ุฉ ุงู„ุฃูˆู„ู‰ ู„ู„ุดุนุจ ุงู„ุชู‚ู†ูŠุฉ ุงู„ุฌุงู…ุนูŠุฉ
C++
32
star
3

muharir

A simple Markdown editor for RTL languages.
JavaScript
29
star
4

dzlibs

A community-driven Algerian index of reusable assets and libraries.
CSS
29
star
5

py-dz-phone-number

Algerian phone numbers as a value object implementation in Python
Python
28
star
6

sloughi

Shareable git hooks for Rust project. Sloughi is a friend of Husky from North Africa! ๐Ÿ‡ฉ๐Ÿ‡ฟ
Rust
26
star
7

echosentry

A sentry (raven-go) middleware for echo micro web framework
Go
16
star
8

Algerian-Wilayas

Algerian Wilayas list in different formats (XML, JSON, xsl..etc) for the sake of DRY
SQL
13
star
9

pg_branch

[WIP] Branch your development postgres database like you do in git
Rust
12
star
10

ArabicNumberToWord

A free crossplatform tool (using Qt/C++) to convert numbers and amounts from numeric to Arabic words
C++
12
star
11

my-arch-stuff

A personal repository of dotfiles, configs, scripts and tools I often setup after any (arch) Linux installation.
Vim Script
7
star
12

cdktf-gke-auth

A pure CDK for Terraform construct to authenticate against Google Kubernetes Engine (GKE) without the need of any Terraform module
TypeScript
7
star
13

it-scoop

[Work In Progress] Static Site version of it-scoop.com
HTML
5
star
14

Daleel-Mostalahat

French-Arabic Computer science terms guide for newbies
2
star
15

Pinnotheque

A cross-platform Desktop application built with Qt, for searching books in the Badji Mokhtar University student library
2
star
16

.dotfiles

01walid's dotfiles for both MacOS and Archlinux
Lua
1
star
17

dz_phonenumbers

Python
1
star