Giter Club home page Giter Club logo

goarabic's Introduction

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'm discovering Go), 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

got 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.

goarabic's People

Contributors

01walid avatar tarrsalah avatar a-pav avatar mostafa-h-j avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.