Coder Social home page Coder Social logo

shtigran / armeniantranslittranslatorconsole Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 2.09 MB

Armenian Translit Translator, Armenian translit, translit. The program allow You translate Armenian text into translit. It takes the Armenian text and return the Translit text.

C# 100.00%

armeniantranslittranslatorconsole's Introduction

Armenian Translit Translator

C#6.0 .NET FRAMEWORK 4.6


Test and Result

gif source

Purpose

Many Armenians in the world aren't able to understand armenian letters and armenian text. Many of them know armenian language, but don't know letters. This program allow inpute armenian text file and translate it into armenian translit in another output file, in order to who knows the armenian language, but doesn't know the armenian letters can read the text.


ReplaceArm class implementation

public static class ReplaceArm
{

    public static string ReplaceArmText(this string text)
  {
      Console.OutputEncoding = System.Text.Encoding.UTF8;
      Dictionary<string, string> database = new Dictionary<string, string>();
      database.Add("ա", "a");
      database.Add("բ", "b");
      database.Add("գ", "g");
      database.Add("դ", "d");
      database.Add("ե", "e");
      database.Add("զ", "z");
      database.Add("է", "e");
      database.Add("ը", "@");
      database.Add("թ", "t");
      database.Add("ժ", "dj");
      database.Add("ի", "i");
      database.Add("լ", "l");
      database.Add("խ", "kh");
      database.Add("ծ", "ts");
      database.Add("կ", "k");
      database.Add("հ", "h");
      database.Add("ձ", "dz");
      database.Add("ղ", "gh");
      database.Add("ճ", "tc");
      database.Add("մ", "m");
      database.Add("յ", "y");
      database.Add("ն", "n");
      database.Add("շ", "sh");
      database.Add("ո", "o");
      database.Add("չ", "ch");
      database.Add("պ", "p");
      database.Add("ջ", "j");
      database.Add("ռ", "r");
      database.Add("ս", "s");
      database.Add("վ", "v");
      database.Add("տ", "t");
      database.Add("ր", "r");
      database.Add("ց", "c");
      database.Add("ու", "u");
      database.Add("փ", "ph");
      database.Add("ք", "q");
      database.Add("և", "ev");
      database.Add("օ", "o");
      database.Add("ֆ", "f");

      string result = "";
      bool flag = false;
      for (int i = 0; i < text.Length; i++)
    {
        if (i < text.Length-1)
      {
          if (text[i] == 'ո' && text[i + 1] == 'ւ')
        { result += "u";
            i++;
            continue;
        }
      }

        if(char.ToLower(text[i]) <='z' && char.ToLower(text[i]) >= 'a')
      {
          result += text[i].ToString();
          continue;
      }
       if (text[i].ToString() == "\n")
      {
          result += "\r\n";
          continue;
      }
        if (char.IsNumber(text[i]) || char.IsPunctuation(text[i]) || char.IsWhiteSpace(text[i]))
      {
          result += text[i].ToString();
          continue;
      }

        if (char.IsUpper(text[i]))
          flag = true;
        foreach (KeyValuePair<string, string> key in database)
      {         
          if (text[i].ToString().ToLower() == key.Key && flag == true)
        {
            result += key.Value.ToUpper();
            break;
        }
          if (text[i].ToString() == key.Key)
        {
            result += key.Value;
            break;
        }            
      }

        flag = false;
    }
            
      return result;
  }
}

Description of ReplaceArm class

This class allow You translate Armenian text into translit.It takes the text and return translit text.

Program class implementation

This part take the location path of the file and copy the text into the string. The the method ReplaceArmText() of ReplaceArm class take it convert into translit and return to program. Then the program create the file and copy there the method returned text.

armeniantranslittranslatorconsole's People

Contributors

shtigran avatar

Stargazers

 avatar Meri Sahakyan avatar Aram Zhamkochyan avatar Narek Yegoryan avatar  avatar Tigran Vardanyan avatar

Watchers

James Cloos 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.