/// <summary> /// Example code to call Rosette API to transliterate a name. /// Requires Nuget Package: /// rosette_api /// </summary> static void Main(string[] args) { //To use the C# API, you must provide an API key string apikey = "Your API key"; string alturl = string.Empty; //You may set the API key via command line argument: //matched_name yourapikeyhere if (args.Length != 0) { apikey = args[0]; alturl = args.Length > 1 ? args[1] : string.Empty; } try { CAPI rosetteApi = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); string transliteration_data = "ana r2ye7 el gam3a el sa3a 3 el 3asr"; //The results of the API call will come back in the form of a Dictionary TransliterationResponse response = rosetteApi.Transliteration(transliteration_data, "ara"); foreach (KeyValuePair <string, string> h in response.Headers) { Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value)); } Console.WriteLine(response.ToString()); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }
/// <summary> /// Example code to call Rosette API to transliterate a name. /// Requires Nuget Package: /// rosette_api /// </summary> static void Main(string[] args) { //To use the C# API, you must provide an API key string apikey = "Your API key"; string alturl = string.Empty; //You may set the API key via command line argument: //matched_name yourapikeyhere if (args.Length != 0) { apikey = args[0]; alturl = args.Length > 1 ? args[1] : string.Empty; } try { CAPI rosetteApi = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl); string transliteration_data = "haza ya7taj fakat ila an takoun ba3dh el-nousous allati na7n ymkn an tata7awal ila al-3arabizi."; string transliteration_language_data = "ara"; //The results of the API call will come back in the form of a Dictionary TransliterationResponse response = rosetteApi.Transliteration(transliteration_data, transliteration_language_data); foreach (KeyValuePair <string, string> h in response.Headers) { Console.WriteLine(string.Format("{0}:{1}", h.Key, h.Value)); } Console.WriteLine(response.ToString()); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }