public override machineTranslationResult getTargetLang(string sourceText)
        {
            urlAPI.Mymemory url = new urlAPI.Mymemory();
            client.requestAPI(String.Format(url.urlTranslatorMymemory, sourceText, source, target));
            var contentJson = client.getContentFromResopne();
            var content     = JsonConvert.DeserializeObject <Mymemory>(contentJson);
            machineTranslationResult Result = new machineTranslationResult();

            if (sourceText.Length >= 500)
            {
                Result.fail     = true;
                Result.failText = fail;
            }
            else
            {
                if (content != null)
                {
                    Result.src   = sourceText;
                    Result.tag   = content.responseData.translatedText;
                    Result.type  = name;
                    Result.fail  = false;
                    Result.score = float.Parse(content.responseData.match) * 100;
                }
                else
                {
                    Result.fail     = true;
                    Result.failText = fail;
                }
            }
            return(Result);
        }
        public override machineTranslationResult getTargetLang(string sourceText)
        {
            urlAPI.openNMT url     = new urlAPI.openNMT();
            var            client  = new RestClient(url.urlTranslatorOpenNMT);
            var            request = new RestRequest("translate", Method.POST);

            request.RequestFormat = DataFormat.Json;
            List <openNMTPost> data = new List <openNMTPost>();
            openNMTPost        post = null;

            if (source == "vi" && target == "en")
            {
                post = new openNMTPost {
                    src = sourceText, id = 1
                };
            }
            if (source == "en" && target == "vi")
            {
                post = new openNMTPost {
                    src = sourceText, id = 0
                };
            }
            data.Add(post);
            string jsonData = JsonConvert.SerializeObject(data);

            request.AddBody(jsonData);
            var response = client.Execute(request);
            var result   = JsonConvert.DeserializeObject <List <List <OpenNMT> > >(response.Content);
            machineTranslationResult Result = new machineTranslationResult();

            if (result != null)
            {
                foreach (var listResult in result)
                {
                    foreach (var a in listResult)
                    {
                        Result.src   = a.src;
                        Result.tag   = a.tgt;
                        Result.fail  = false;
                        Result.score = float.Parse(a.pred_score);
                        Result.type  = name;
                    }
                }
            }
            else
            {
                Result.fail     = true;
                Result.failText = fail;
            }
            return(Result);
        }