Giter Club home page Giter Club logo

egasimov / aznum2words Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 6.0 2.78 MB

[AZ] Azərbaycan dilində ədədlərin sözlə yazılış təsviri üçün Go dilində yazılmış kitabxana. [EN] The library for converting numbers to words in the Azerbaijan language written in Go.

License: MIT License

Go 97.19% Makefile 2.28% Dockerfile 0.53%
golang-library number-to-words converter num2words azerbaijani numbers azerbaijani-translation conversion numbers-to-text numbers-to-words

aznum2words's Introduction

aznum2words logo


CI Go Report Card GitHub tag (latest SemVer) GitHub stars codecov

License GoDoc

AzNum2Words - Azərbaycan dilində ədədlərin sözlə yazılışı(və ya təsviri) üçün nəzərdə tutulan Go dilində yazılmış, açıq qaynaqlı kitabxanadır.


Məqsəd | Goal

Azərbaycan dilində ədədlərin(və ya rəqəmlərin) sözlə yazılış təsvirinə ehtiyac yarandığı hallar olur. Proqram səviyyəsində bu kimi ehtiyacları qarşılamaq üçün vahid bir kitabxananın olması, proqramçıların işini xeyli asanlaşdırır. Kitabxana tam və ya kəsr ədədlərin Azərbaycan dilində sözlə yazılışı(və ya təsviri) üçün nəzərdə tutulub.


İstifadə formaları | Usage forms

Həm library, həm də command-line tool kimi istifadə edilə bilər. Bundan əlavə web-app kimi də istifadə edərək mövcud sisteminə integrasiya etmək mümkündür.

Bu kitabxana vasitəsilə - müsbət, mənfi tam və ya kəsr ədədlərin sözlə yazılış təsvirini əldə etmək mümkündür.


İstifadə yerləri | Use cases

Azərbaycan dilində ədədlərin təsvirinə ehtiyac duyulan hallarda istifadə oluna bilər.

  • Statistik hesabatların tərtib olunması.
  • Maliyyə əməliyyatları zamanı məbləğin sözlə təsvir olunması.
  • Hüquqi və maliyyə sənədləri tez-tez çaşqınlığın qarşısını almaq və dəqiqliyi təmin etmək üçün rəqəmlərin ifadə sözünün istifadəsini tələb edir.
  • Çek yazarkən, dəyişikliklərin və ya saxtakarlığın qarşısını almaq üçün rəqəmsal məbləğə əlavə olaraq məbləğin sözlə ifadəsini də yazmaq adi bir təcrübədir.

Özəlliklər | Features

  • Tam ədədlərin sözlə təsvir olunması
  • Kəsr ədədlərin sözlə təsvir olunması
  • Müsbət vəya mənfi ədədlərin sözlə təsvir olunması
  • Söz ilə təsvir oluna biləcək maksimum tam ədəd: 10^63
  • Söz ilə təsvir oluna biləcək minumum kəsr ədəd: (10^-15)

Kitabxananın proyektə əlavə edilməsi | Add library into the project

go get github.com/egasimov/aznum2words@latest

Kitabxana kimi istifadə qaydası | Guideline for using as library

package main

import (
	"fmt"
	"github.com/egasimov/aznum2words"
)

func main() {
	// in real use, do not discard errors, rather handle it properly :)
	result1, _ := aznum2words.SpellNumber("-95412")
	result2, _ := aznum2words.SpellNumber("-2.7021")
	result3, _ := aznum2words.SpellNumber("5611113210")

	fmt.Println(result1)
	fmt.Println(result2)
	fmt.Println(result3)
}


NƏTİCƏ | OUTPUT

mənfi doxsan beş min dörd yüz on iki
mənfi iki tam on mində yeddi min iyirmi bir
beş milyard altı yüz on bir milyon bir yüz on üç min iki yüz on

CLI kimi quraşdırılması | CLI-Installation

// installs the binaries into $GOPATH/bin
go install github.com/egasimov/aznum2words/cmd/aznum2words-cli@latest

CLI kimi istifadə qaydası | Guideline for using as CLI app

$ aznum2words-cli -- 12.3
on iki tam onda üç

$ aznum2words-cli -- -12.3
mənfi on iki tam onda üç

Web app kimi quraşdırılması | Web-App Installations

// Clone the repository
git clone https://github.com/egasimov/aznum2words.git@latest

Web app kimi istifadə qaydası | Guideline for using as Web app

$ cd ./cmd/aznum2words-webapp/ 
$ go run ./aznum2words-webapp.go
curl --location 'http://localhost:8080/api/v1/conversion/to-word' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "number": "123.45"
}'

Qeyd: open-api-spec contract istifadə edərək online swagger-ui, Postman kimi alətlər ilə REST APİ-ni interaktiv test etmək mümkündür.


Test caseləri yoxlanması | Check test cases

go test ./...

Benchmark yoxlanılması

go test -bench=. -run=^# -benchmem

Versiyalar | Releases

Kitabxananın versiyaları Semver yanaşması ilə tənzimlənir.


Lisenziya | License

Kitabxana MIT Lisenziya altında lisenziyalaşdırılmışdır. Ətraflı məlumat üçün LICENSE faylını nəzərdən keçirin.


Proyektə necə dəstək olmaq olar | How to contribute to project ?

Proyektə contribute etmək üçün aşağıdakı təlimatları nəzərə ala bilərsiniz.

Testləri olmayan vəya nəzərə alınmayan PRlar qəbul edilməyəcək

  1. Reponu fork et
  2. Yeni feature branch yarat (git checkout -b my-new-feature)
  3. Dəyişiklikləri commit et (git commit -am 'Added some feature')
  4. Local branchı origin(remote repo) push et (git push origin my-new-feature)
  5. Yeni Pull Request yarat

Contributorlar

Bu layihəyə aşağıdakı şəxslər töhfə verib:

aznum2words's People

Contributors

bago1 avatar egasimov avatar mehdiyevcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aznum2words's Issues

Feature: Run project as web app | Introduce Web API

As for now, AzNum2Words can be utilized in two ways:

  • Library (via importing into go-projects)
  • CLI app(build binaries and executing it)

For the people who have no experience with Go language or their already existing system is not compatible to integrate via go library, it would be nice to have another option to use AzNum2Words in somehow.

The proposed solution is ability to run AzNum2Words as microservice and having its well-defined API. So as the result, consumers will able to use functionalities offered by AzNum2Words via calling its exposed API, basically endpoints.

Initially, it was thought that developing web app exposing REST API due to its simplicity and having wider range of uses in the industry. (gPRC support can be added later on demand)

Simple saying, new feature is to develop web app exposing AzNum2Words functionalities as REST API to consumers.

There are few requirements for new feature that need to be considered while developing it.

  1. Prepare open-spec contract based on OpenAPI 3.0
    1.1. Code-generator
    tools such as oapi-codegen can be used to generate models, server-side codes to minimize human errors.

  2. It needs to be highly configurable via config file, environment variables.( e.g godotenv) [MUST]

  3. Able to run web-app both on locally and containerized environment. [MUST]

  4. Write tests to increase maintainability and code quality [MUST]

  5. Observability purpose requirements [[DESIRED]]
    5.1. Add Health check purpose endpoints
    5.2. Expose metrics
    5.3. Do properly error handling, logging

Bug: CLI app installation command described in Readme does not work as expected

Description
Installing the CLI application using the provided command does not work as expected. The command must specify a package that points to the cli, not the executable file.

Current:
go install github.com/egasimov/aznum2words/cmd/cliapp/aznum2words-cli@latest

Should be:
go install github.com/egasimov/aznum2words/cmd/cliapp@latest

In order for the command to work as expected the name of the cli app package also needs to be changed.

To Reproduce

  1. Execute the following command:
    go install github.com/egasimov/aznum2words/cmd/cliapp/aznum2words-cli@latest

  2. Result:
    go: github.com/egasimov/aznum2words/cmd/cliapp/aznum2words-cli@latest: module github.com/egasimov/aznum2words@latest found (v0.1.0), but does not contain package github.com/egasimov/aznum2words/cmd/cliapp/aznum2words-cli

Expected behavior
The command installed the binaries into $GOPATH/bin properly, and command should work with provided examples.

Desktop:

  • MacOS Monterey 12.2
  • Go version go1.19.4

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.