Sunteți pe pagina 1din 6

npm Enterprise Features Pricing Docs Support

log in or sign up

Search packages

Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

anbani
public

Readme

0 Dependencies

0 Dependents

5 Versions

Anbani is a multifunctional toolkit designed for Georgian Alphabet. Main functionalities include text conversion between various Georgian alphabets via
anbani.core and random text generation via anbani.lorem .

Installation
To install the package simple grab it from npm

npm install anbani

Structure
Here's the structure of the package with four main modules: core for conversion and interpretation of letters, lorem for random text generation, data for
accessing the datasets, and toolkit for bonus features.

Minor features from each module are exposed in $ , such as anbani.core.$.* and anbani.lorem.$.* .

anbani
!" core
# !" convert [Function]
# !" interpret [Function]
# $" $
# $" classifyText [Function]
!" lorem
# !" sentences [Function]
# !" paragraphs [Function]
# !" loadWordlist [Function]
# !" names [Function]
# $" $
# !" randomFirstName [Function]
# !" randomLastName [Function]
# $" randomWord [Function]
!" toolkit
# !" friedman [Function]
# !" frequency [Function]
# $" count [Function]
$" data
!" ab
# !" mkhedruli [String]
# !" asomtavruli [String]
# !" nuskhuri [String]
# $" mtavruli [String]
$" lorem
!" firstNames [Array]
!" lastNames [Array]
$" words [Array]

Usage
Initialize package in your app as follows

var anbani = require('anbani')

Conversion
anbani.core.convert supports all of the Georgian unicameral and bicameral alphabets for conversion listed bellow and even more. Note that you may use
Georgian and Latin letters to pass parameters. It's just a less headache.

// convert(TEXT, FROM, TO)

anbani.core.convert("!"#!"$", "%&'()*+$", "!,-%.!/)*+$")


// 'ႠႬႡႠႬႨ'

anbani.core.convert("!"#!"$", "mkhedruli", ""*,&*)$")


// 'ⴀⴌⴁⴀⴌⴈ'

Georgian also has bicameral styles of the alphabet. If you first hear about that now, check out this article. Generally, automatic capitalization occurs at the beginning
of the sentence. However, you can also append the letter with ' symbol in order to capitalize the word during conversion. This trick also works at anbani.ge as well.
Here's an example

anbani.core.convert("!'"#!"$", "%&'()*+$", "0!"$1$,'*+$")


// 'Ⴀ"#!"$'

anbani.core.convert("$'2- !')!#'., )'-,3'/!"", "mkhedruli", "shanidziseuli")


// 'Ⴈ2- Ⴀ)!#'., Ⴐ-,3'/!"'

Here are all of the conversions supported. Note that you may convert to any of these types but not all of them are supported to be converted from . In other words,
you can only convert from Mkhedruli, Asomtavruli, Nuskhuri, Mtavruli, and Qwerty, since there is no 1-to-1 relation amongst others.

word sentence

mkhedruli 4!).*+$ $2- !)!#'., )-,3'/!"

asomtavruli ႵႠႰႧႳႪႨ ႨႷႭ ႠႰႠႡႤႧႱ ႰႭႱႲႤႥႠႬ

nuskhuri ⴕⴀⴐⴇⴓⴊⴈ ⴈⴗⴍ ⴀⴐⴀⴁⴄⴇⴑ ⴐⴍⴑⴒⴄⴅⴀⴌ

mtavruli

khutsuri Ⴕⴀⴐⴇⴓⴊⴈ Ⴈⴗⴍ ⴀⴐⴀⴁⴄⴇⴑ ⴐⴍⴑⴒⴄⴅⴀⴌ

shanidziseuli Ⴕ!).*+$ Ⴈ2- !)!#'., )-,3'/!"

tfileliseuli !).*+$ 2- !)!#'., )-,3'/!"

phonetic khɑrthulɪ ɪq'ɔ ɑrɑbɛths rɔst'ɛvɑn

transcription kartuli iqo arabets rost'evan

iso_9984 k'art'uli iqo arabet's rostevan

common kartuli iyo arabets rostevan

qwerty qarTuli iyo arabeTs rostevan


If you are wondering what Georgian alphabets look like, or what's the di!erence between all these latinizations here's the table for that as well. Note: if you are not
seeing Mtavruli, that's because it was recently added to Unicode and rollout will probably take a while. You can grab DejaVu fonts that support Mtavruli already.

! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 ჷ ჸ ჹ ჺ

Ⴓ Ⴔ Ⴕ Ⴖ Ⴗ Ⴘ Ⴙ Ⴚ Ⴛ Ⴜ Ⴝ Ⴞ Ⴟ Ⴠ Ⴡ Ⴢ Ⴣ Ⴤ Ⴥ

ⴓ ⴔ ⴕ ⴖ ⴗ ⴘ ⴙ ⴚ ⴛ ⴜ ⴝ ⴞ ⴟ ⴠ ⴡ ⴢ ⴣ ⴤ ⴥ

u f q R y S C c Z w W x j h E I V X H F D Y G L

u f k g y sh ch c dz w' ch' x j h

u p k gh q sh ch ts dz ts' ch' kh j h

u p' k' ḡ q š č' c' j c č kh ǰ h ē y w ẖ' ō f

u ph kh ɣ q' ʃ tʃ ts dz ts' tʃʼ x dʒ h ɛj j wi q hɔɛ f ə ʔ ɢ ʕ

Interpretation
Apart from straightforward conversion, the package also supports interpretation capabilities via anbani.core.interpret , which automagically detects the
language of the text and converts to desired to parameter script.

// interpret(TEXT, TO)

anbani.core.interpret("iyo arabeTs rostevan mefe RmrTisagan sviani", "mkhedruli")


// '$2- !)!#'., )-,3'/!" %'5' 6%).$,!7!" ,/$!"$'

Random text generation


anbani.lorem supports random text generation in Georgian. You can generate texts with word count and paragraph count . Here's an example:

// sentences(WORD_COUNT)

anbani.lorem.sentences(10)
// '%-'&/$(', ,$3$)'" 7$0$&!)"$. 8'$.- 7!%$9)$!", :4-".!/$,.!" 7'%)*5'", *;).'#-('%"$ %',%!"<! %2$/"'.'

or generate paragraphs using

// paragraphs(
// WORD_COUNT_PER_PARAGRAPH,
// PARAGRAPH_COUNT,
// NEWLINE_CHAR="\n\n"
// )

anbani.lorem.paragraphs(20,3)

7!"('/!"7!! %-'&/$(', 0'%-/,=/)'3$. :4-".!/$,.!", (!/'>!)'"! %'7)'<!. 3!3)',3$"$. 0'%-/,=/)'3$. 7!*9!(! !+/$.!"$
7!%$0/0', %*;!%($, 0'%-&!"!, %-/+-<.! %',%!"<! 0'%-&!"! 0'%8-/+$,! 7!,?/!('., (!#$.4$, ,!.$"',"$.

%2$/"'", (!/!.4/'"- 7!"!9!"(! %!).!+$@$ ,$@2)- :4-".!/$,.!". ,$3$)'", 8!&,$+.!, !4!%(,!7'#'" %-!7&'#! %$/$,<! 7!%$0/0',,
%3'%*),! %-<!($! %3'%*),! 3!3)',3$"$, 7$0/$+!. $<$<-(! 8'$.-, %2$/"'.

,$@2)-, %0/'"-('"- %$/$,<! *;).'#-('%"$ ,!%!3! %-!,'&', 3$),+$. ,$@2)-? 7!%$0/0', ,'/"!! %!).!+$@$ /$%<'. *7!"('7-
!4!%(,!7'#'" %$&,'"$. %9+-, %'7)'<! %3'%*),! %$.&)-, %!%($:&+'!.'

Wordlist was generated using Recurrent Neural Networks (char-rnn - karpathy) that was trained on Georgian epic - Vefxistyaosani. Corresponding repo will be
forthcoming. Note that none of the words generated occur in the training dataset (the poem), but rather are built to mimic underlying constructs of the language. This
makes the text feel fully Georgian while actually meaning nothing (which is good, since you don't need to worry about awkward permutation that might ever occur).

Alternatively, you can load up your own wordlist if you want.


anbani.lorem.loadWordlist(
["#*43!)", "#*43!)", "#'", "!#'+", ";!%'"",
";*%!"'", "$";+$", "#$";+$", "7)!%!<$";+$", "/$0+!1''"]
)

anbani.lorem.sentences(7)
// '#*43!) #*43!) ;*%!"' #' ;!%'", $";+$ 7)!%!<$";+$.'

Toolkit
As some bonus features, you can calculate letter frequency of the text and Friedman score (coincidence index).

var text = "$2- !)!#'., )-,3'/!" %'5' 6%).$,!7!" ,/$!"$"

anbani.toolkit.friedman(text)
// 0.06116642958748222

anbani.toolkit.frequency(text)
/*
{
'$': 0.09302325581395349,
'2': 0.023255813953488372,
'-': 0.046511627906976744,
'!': 0.13953488372093023,
')': 0.06976744186046512,
'#': 0.023255813953488372,
''': 0.09302325581395349,
'.': 0.046511627906976744,
',': 0.09302325581395349,
'3': 0.023255813953488372,
'/': 0.046511627906976744,
'"': 0.06976744186046512,
'%': 0.046511627906976744,
'5': 0.023255813953488372,
'6': 0.023255813953488372,
'7': 0.023255813953488372
}
*/

RunKit
Here's a RunKit note for the package https://npm.runkit.com/anbani

var anbani = require("anbani")

// Core module
console.log( anbani.core.convert("4!).*+$ !"#!"$", "%&'()*+$", "0!"$1$,'*+$") )
console.log( anbani.core.interpret("vefxistyaosani", "asomtavruli") )

// Lorem module
console.log( anbani.lorem.sentences(7) ) // param: number of words in total
console.log( anbani.lorem.paragraphs(10, 2) ) // params: number of words per paragraph, number of paragraphs
anbani.lorem.loadWordlist([",*@$", ",-*9$"]) // load custom dataset
console.log( anbani.lorem.sentences(7) )
console.log( anbani.lorem.names(3) ) // param: number of names

// Working with texts


var text = `)-%'+%!" 0'4%"! ,!%2!)- 1!+$.! %$. 1+$')$.!,
9'7!)(%- !),"$ ,*+$.! 2/"! 9'<$. %-"!#')$.!,
?/'", ;!<.!, %-7/<! 4/'2!"!, 7/!4/, *./!+!/$ 5')$.!,
%$,7!" !), 2-/+$ &'+%8$5' ,!&$.! %$, %$')$.!.`
console.log(`Friedman score: ${anbani.toolkit.friedman(text)}`)

var converted = anbani.core.convert(text, "mkhedruli", "khutsuri")


console.log(`The given text is in '${anbani.core.$.classifyText(converted)}' style`)
What else
The code is under MIT license, freely distributed for anyone who wants to use it (just don't forget to mention the source).

Pull requests and collabs are most welcome!

Cheers,
George A anbani.ge

Keywords

converter interpreter lorem ipsum anbani alphabet georgian georgia

install

npm i anbani

weekly downloads

10

version license
1.1.1 MIT

last publish
2 months ago

collaborators

Test with RunKit

You Need Help

Documentation
Support / Contact Us
Registry Status
Website Issues
CLI Issues
Security

About npm
About npm, Inc
Jobs
npm Weekly
Blog
Twitter
GitHub

Terms & Policies

Terms of Use
Code of Conduct
Package Name Disputes
Privacy Policy
Reporting Abuse
Other policies

npm loves you

S-ar putea să vă placă și