R/Transliterate.R

Transliterate <-
function(texts){
  # The alphabet 
  texts <- gsub('\u0622', 'A', texts)
  texts <- gsub('\u0627', 'a', texts)
  texts <- gsub('\u0628', 'b', texts)
  texts <- gsub('\u067E', 'p', texts)
  texts <- gsub('\u062a', 't', texts)
  texts <- gsub('\u062b', 'U', texts)
  texts <- gsub('\u062c', 'J', texts)
  texts <- gsub('\u0686', 'C', texts)
  texts <- gsub('\u062d', 'H', texts)
  texts <- gsub('\u062e', 'K', texts)
  texts <- gsub('\u062f', 'd', texts)
  texts <- gsub('\u0630', 'Z', texts)
  texts <- gsub('\u0631', 'r', texts)
  texts <- gsub('\u0632', 'z', texts)
  texts <- gsub('\u0698', 'j', texts)
  texts <- gsub('\u0633', 's', texts)
  texts <- gsub('\u0634', 'W', texts)
  texts <- gsub('\u0635', 'S', texts)
  texts <- gsub('\u0636', 'X', texts)
  texts <- gsub('\u0637', 'T', texts)
  texts <- gsub('\u0638', 'x', texts)
  texts <- gsub('\u0639', 'E', texts)
  texts <- gsub('\u063a', 'g', texts)
  texts <- gsub('\u0641', 'f', texts)
  texts <- gsub('\u0642', 'Q', texts)
  texts <- gsub('\u06A9', 'k', texts)
  texts <- gsub('\u06AF', 'G', texts)
  texts <- gsub('\u0644', 'l', texts)
  texts <- gsub('\u0645', 'm', texts)
  texts <- gsub('\u0646', 'n', texts)
  texts <- gsub('\u0648', 'v', texts)
  texts <- gsub('\u0647', 'h', texts)
  texts <- gsub('\u06CC', 'i', texts)
  # Numbers
  texts <- gsub('\u06f1', '1', texts)
  texts <- gsub('\u06f2', '2', texts)
  texts <- gsub('\u06f3', '3', texts)
  texts <- gsub('\u06f4', '4', texts)
  texts <- gsub('\u06f5', '5', texts)
  texts <- gsub('\u06f6', '6', texts)
  texts <- gsub('\u06f7', '7', texts)
  texts <- gsub('\u06f8', '8', texts)
  texts <- gsub('\u06f9', '9', texts)
  texts <- gsub('\u06f0', '0', texts)
  return(texts)
}

Try the PersianStemmer package in your browser

Any scripts or data that you put into this service are public.

PersianStemmer documentation built on June 28, 2019, 5:03 p.m.