R/nepalese-words-to-number-nepali-alphabet.R

# 
# nepalese_words_to_number <- function(x) { 
#   x <- gsub("soonya|शून्य",             "+0" , x , ignore.case = TRUE)     
#   x <- gsub("ek|एक",                 "+1" , x , ignore.case = TRUE)     
#   x <- gsub("dui|दुई",                "+2" , x , ignore.case = TRUE)     
#   x <- gsub("tin|तीन",                "+3" , x , ignore.case = TRUE)     
#   x <- gsub("char|चार",               "+4" , x , ignore.case = TRUE)     
#   x <- gsub("paanch|पाँच",             "+5" , x , ignore.case = TRUE)     
#   x <- gsub("chha|छ",               "+6" , x , ignore.case = TRUE)     
#   x <- gsub("sat|सात",                "+7" , x , ignore.case = TRUE)     
#   x <- gsub("aath|आठ",               "+8" , x , ignore.case = TRUE)     
#   x <- gsub("nau|नौ",                "+9" , x , ignore.case = TRUE)     
#   x <- gsub("das|दस",               "+10" , x , ignore.case = TRUE)     
#   x <- gsub("eghaara|एघार",           "+11" , x , ignore.case = TRUE)     
#   x <- gsub("barha|बार्ह",             "+12" , x , ignore.case = TRUE)     
#   x <- gsub("terha|तेह्र",             "+13" , x , ignore.case = TRUE)     
#   x <- gsub("chaudha|चौध",           "+14" , x , ignore.case = TRUE)     
#   x <- gsub("pandhra|पन्ध्र",           "+15" , x , ignore.case = TRUE)     
#   x <- gsub("sorha|सोह्र",             "+16" , x , ignore.case = TRUE)     
#   x <- gsub("satra|सत्र",             "+17" , x , ignore.case = TRUE)     
#   x <- gsub("athara|अठार",            "+18" , x , ignore.case = TRUE)     
#   x <- gsub("unnais|उन्नाइस",            "+19" , x , ignore.case = TRUE)     
#   x <- gsub("bis|बिस",               "+20" , x , ignore.case = TRUE)     
#   x <- gsub("ekkais|एक्काइस",            "+21" , x , ignore.case = TRUE)     
#   x <- gsub("baais|बाइस",              "+22" , x , ignore.case = TRUE)     
#   x <- gsub("teis|तेइस",              "+23" , x , ignore.case = TRUE)     
#   x <- gsub("chaubis|चौबिस",           "+24" , x , ignore.case = TRUE)     
#   x <- gsub("pachchis|पच्चीस",           "+25" , x , ignore.case = TRUE)     
#   x <- gsub("chhabbis|छब्बीस",           "+26" , x , ignore.case = TRUE)     
#   x <- gsub("sattais|सत्ताइस",           "+27" , x , ignore.case = TRUE)     
#   x <- gsub("aththais|अठ्ठाइस",           "+28" , x , ignore.case = TRUE)     
#   x <- gsub("unantis|उनन्तिस",           "+29" , x , ignore.case = TRUE)     
#   x <- gsub("tis|तिस",               "+30" , x , ignore.case = TRUE)     
#   x <- gsub("ekkattis|एक्कतिस",          "+31" , x , ignore.case = TRUE)     
#   x <- gsub("battis|बत्तीस",            "+32" , x , ignore.case = TRUE)     
#   x <- gsub("tettis|तेत्तिस",            "+33" , x , ignore.case = TRUE)     
#   x <- gsub("chauntis|चौंतीस",          "+34" , x , ignore.case = TRUE)     
#   x <- gsub("paintis|पैंतीस",           "+35" , x , ignore.case = TRUE)     
#   x <- gsub("chhattis|छत्तिस",          "+36" , x , ignore.case = TRUE)     
#   x <- gsub("saitis|सैतिस",            "+37" , x , ignore.case = TRUE)     
#   x <- gsub("athtis|अठ्तीस",            "+38" , x , ignore.case = TRUE)     
#   x <- gsub("unnanchaalis|उन्नान्चालिस",       "+39" , x , ignore.case = TRUE)     
#   x <- gsub("chalees|चालिस",           "+40" , x , ignore.case = TRUE)     
#   x <- gsub("ekchalees|एकचालीस",         "+41" , x , ignore.case = TRUE)     
#   x <- gsub("bayalees|बयालीस",          "+42" , x , ignore.case = TRUE)     
#   x <- gsub("triyalees|त्रियालीस",         "+43" , x , ignore.case = TRUE)     
#   x <- gsub("chawaalees|चवालीस",        "+44" , x , ignore.case = TRUE)     
#   x <- gsub("paitaalees|पैतालीस",        "+45" , x , ignore.case = TRUE)     
#   x <- gsub("chhayaalees|छयालीस",        "+46" , x , ignore.case = TRUE)     
#   x <- gsub("sacchaalees|सचालीस",       "+47" , x , ignore.case = TRUE)     
#   x <- gsub("athchaalees|अठचालीस",       "+48" , x , ignore.case = TRUE)     
#   x <- gsub("unanchas|उनन्चास",          "+49" , x , ignore.case = TRUE)     
#   x <- gsub("pachas|पचास",            "+50" , x , ignore.case = TRUE)     
#   # x <- gsub("ekaaunna|",          "+51" , x , ignore.case = TRUE)     
#   # x <- gsub("baaunna|",           "+52" , x , ignore.case = TRUE)     
#   # x <- gsub("tripanna|",          "+53" , x , ignore.case = TRUE)     
#   # x <- gsub("chaunna|",           "+54" , x , ignore.case = TRUE)     
#   # x <- gsub("pachpanna|",         "+55" , x , ignore.case = TRUE)     
#   # x <- gsub("chhapanna|",         "+56" , x , ignore.case = TRUE)     
#   # x <- gsub("santaunna|",         "+57" , x , ignore.case = TRUE)     
#   # x <- gsub("anthauna|",          "+58" , x , ignore.case = TRUE)     
#   # x <- gsub("unansathee|",        "+59" , x , ignore.case = TRUE)     
#   # x <- gsub("sathee|",            "+60" , x , ignore.case = TRUE)     
#   # x <- gsub("eksatthee|",         "+61" , x , ignore.case = TRUE)     
#   # x <- gsub("baisathee|",         "+62" , x , ignore.case = TRUE)     
#   # x <- gsub("trisathee|",         "+63" , x , ignore.case = TRUE)     
#   # x <- gsub("chausathee|",        "+64" , x , ignore.case = TRUE)     
#   # x <- gsub("paisathee|",         "+65" , x , ignore.case = TRUE)     
#   # x <- gsub("chaisathee|",        "+66" , x , ignore.case = TRUE)     
#   # x <- gsub("satsathee|",         "+67" , x , ignore.case = TRUE)     
#   # x <- gsub("athsathee|",         "+68" , x , ignore.case = TRUE)     
#   # x <- gsub("unansattaree|",      "+69" , x , ignore.case = TRUE)     
#   # x <- gsub("sattaree|",          "+70" , x , ignore.case = TRUE)     
#   # x <- gsub("ekhattar|",          "+71" , x , ignore.case = TRUE)     
#   # x <- gsub("bahattar|",          "+72" , x , ignore.case = TRUE)     
#   # x <- gsub("trihattar|",         "+73" , x , ignore.case = TRUE)     
#   # x <- gsub("chauhattar|",        "+74" , x , ignore.case = TRUE)     
#   # x <- gsub("pachahattar|",       "+75" , x , ignore.case = TRUE)     
#   # x <- gsub("chhahattar|",        "+76" , x , ignore.case = TRUE)     
#   # x <- gsub("satahattar|",        "+77" , x , ignore.case = TRUE)     
#   # x <- gsub("athahattar|",        "+78" , x , ignore.case = TRUE)     
#   # x <- gsub("unasee|",            "+79" , x , ignore.case = TRUE)     
#   # x <- gsub("asee|",              "+80" , x , ignore.case = TRUE)     
#   # x <- gsub("ekasee|",            "+81" , x , ignore.case = TRUE)     
#   # x <- gsub("bayasee|",           "+82" , x , ignore.case = TRUE)     
#   # x <- gsub("triyasee|",          "+83" , x , ignore.case = TRUE)     
#   # x <- gsub("chaurasee|",         "+84" , x , ignore.case = TRUE)     
#   # x <- gsub("pachasee|",          "+85" , x , ignore.case = TRUE)     
#   # x <- gsub("chhayasee|",         "+86" , x , ignore.case = TRUE)     
#   # x <- gsub("satasee|",           "+87" , x , ignore.case = TRUE)     
#   # x <- gsub("athasee|",           "+88" , x , ignore.case = TRUE)     
#   # x <- gsub("unannabbe|",         "+89" , x , ignore.case = TRUE)     
#   # x <- gsub("nabbe|",             "+90" , x , ignore.case = TRUE)     
#   # x <- gsub("ekanabbe|",          "+91" , x , ignore.case = TRUE)     
#   # x <- gsub("bayanabbe|",         "+92" , x , ignore.case = TRUE)     
#   # x <- gsub("triyanabbe|",        "+93" , x , ignore.case = TRUE)     
#   # x <- gsub("chauranabbe|",       "+94" , x , ignore.case = TRUE)     
#   # x <- gsub("paanchanabbe|",      "+95" , x , ignore.case = TRUE)     
#   # x <- gsub("chhyanabbe|",        "+96" , x , ignore.case = TRUE)     
#   # x <- gsub("santanabbe|",        "+97" , x , ignore.case = TRUE)     
#   # x <- gsub("anthanabbe|",        "+98" , x , ignore.case = TRUE)     
#   # x <- gsub("unansaya|",          "+99" , x , ignore.case = TRUE)     
#   x <- gsub("saya|सय",              ")*(100)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("dui saya",     "+200", x , ignore.case = TRUE)     
#   #    x <- gsub("tin saya",     "+300", x , ignore.case = TRUE)     
#   #   x <- gsub("char saya",     "+400", x , ignore.case = TRUE)     
#   # x <- gsub("paanch saya",     "+500", x , ignore.case = TRUE)     
#   #   x <- gsub("chha saya",     "+600", x , ignore.case = TRUE)     
#   #    x <- gsub("sat saya",     "+700", x , ignore.case = TRUE)     
#   #   x <- gsub("aath saya",     "+800", x , ignore.case = TRUE)     
#   #    x <- gsub("nau saya",     "+900", x , ignore.case = TRUE)     
#   x <- gsub("hajaar|हजार",            ")*(1000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("dui hajaar",   ")*(2000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("tin hajaar",   ")*(3000)+(0", x , ignore.case = TRUE)     
#   #   x <- gsub("char hajaar",   ")*(4000)+(0", x , ignore.case = TRUE)     
#   # x <- gsub("paanch hajaar",   ")*(5000)+(0", x , ignore.case = TRUE)  
#   # x <- gsub("chha hajaar",     ")*(6000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("sat hajaar",   ")*(7000)+(0", x , ignore.case = TRUE)     
#   #   x <- gsub("aath hajaar",   ")*(8000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("nau hajaar",   ")*(9000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("das hajaar",   ")*(10000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("bis hajaar",   ")*(20000)+(0", x , ignore.case = TRUE)     
#   #    x <- gsub("tis hajaar",   ")*(30000)+(0", x , ignore.case = TRUE)     
#   # x <- gsub("chalis hajaar",   ")*(40000)+(0", x , ignore.case = TRUE)     
#   # x <- gsub("pachas hajaar",   ")*(50000)+(0", x , ignore.case = TRUE) 
#   # x <- gsub("sathi hajaar",    ")*(60000)+(0", x , ignore.case = TRUE)  
#   # x <- gsub("sattari hajaar",  ")*(70000)+(0", x , ignore.case = TRUE)   
#   #    x <- gsub("asi hajaar",   ")*(80000)+(0", x , ignore.case = TRUE)     
#   #  x <- gsub("nabbe hajaar",   ")*(90000)+(0", x , ignore.case = TRUE)     
#   x <- gsub("lakh|लाख",              ")*(100000)+(0", x , ignore.case = TRUE)
#   # x <- gsub("das lakh",        ")*(1000000)+(0", x , ignore.case = TRUE)     
#   x <- gsub("karod|करोड",             ")*(100000000)+(0", x , ignore.case = TRUE)     
#   x <- gsub("arba|अर्ब",              ")*(1000000000)+(0", x , ignore.case = TRUE)
#   x <- gsub("kharaba|खरब",            ")*(100000000000)+(0", x , ignore.case = TRUE)    
#   x <- gsub("nil|निल",               ")*(10000000000000)+(0", x , ignore.case = TRUE)
#   x <- gsub("padhna|पधना",            ")*(1000000000000000)+(0", x , ignore.case = TRUE)
#   x <- gsub("shankha|शंख",           ")*(100000000000000000)+(0", x , ignore.case = TRUE)
#   x <- gsub("Y",                 "", x , ignore.case = T)
#   x <- gsub(" ",                 "", x , ignore.case = T)
#   x <- gsub("^",                 "(0", x , ignore.case = T)
#   x <- gsub("$",                 ")", x , ignore.case = T)
#   x <- gsub("\\(0\\(",           "", x , ignore.case = T )
#   x <- gsub("\\+\\+",            "\\+\\(", x , ignore.case = T )
#   x <- gsub("\\)\\+\\)",         "\\)", x , ignore.case = T )
#   
#   y = as.integer(eval(parse(text = x)))
#   
#   if (is.na(y)) {
#     list('Parsed value: ' = eval(parse(text = x)), "Actual Equation: " = x)
#     warning("WARNING: Due to R's limited ability to retain huge integer, the result is displayed in equation form.")
#   } else {
#     as.integer(eval(parse(text = x)))
#   }
# }
# 
# # x = "tin करोड़ dui"
# # nepalese_words_to_number(x)
sbohora/Somya documentation built on May 14, 2019, 7:35 a.m.