public void ProcessRequest(HttpContext context)
        {
            try
            {
                #region [.anti-bot.]
                var antiBot = context.ToAntiBot();
                if (antiBot.IsNeedRedirectOnCaptchaIfRequestNotValid())
                {
                    antiBot.SendGotoOnCaptchaJsonResponse();
                    return;
                }
                #endregion

                var text          = context.GetRequestStringParam("text", Config.MAX_INPUTTEXT_LENGTH);
                var splitBySmiles = context.Request["splitBySmiles"].Try2Boolean(true);
                var html          = context.Request["html"].Try2Boolean(false);

                #region [.anti-bot.]
                antiBot.MarkRequestEx(text);
                #endregion

                var hcd   = new http_context_data(context);
                var words = hcd.GetConcurrentFactory().Run(text, splitBySmiles);

                SendJsonResponse(context, words, text, html);
            }
            catch (Exception ex)
            {
                SendJsonResponse(context, ex);
            }
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var text    = context.GetRequestStringParam("text", Config.MAX_INPUTTEXT_LENGTH);
                var hcd     = new http_context_data(context);
                var factory = hcd.GetConcurrentFactory();

                var urls = factory.Run(text);

                SendJsonResponse(context, urls);
            }
            catch (Exception ex)
            {
                SendJsonResponse(context, ex);
            }
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var text          = context.GetRequestStringParam("text", Config.MAX_INPUTTEXT_LENGTH);
                var splitBySmiles = context.Request["splitBySmiles"].Try2Boolean(true);
                var returnText    = context.Request["returnText"].Try2Boolean(true);

                var hcd   = new http_context_data(context);
                var sents = hcd.GetConcurrentFactory().AllocateSents(text, splitBySmiles);

                SendJsonResponse(context, sents, text, returnText);
            }
            catch (Exception ex)
            {
                SendJsonResponse(context, ex);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var text = context.Request["text"];

                var hcd     = new http_context_data(context);
                var factory = hcd.GetConcurrentFactory();

                var ips = factory.Run(text);

                SendJsonResponse(context, ips);
            }
            catch (Exception ex)
            {
                SendJsonResponse(context, ex);
            }
        }
Exemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            #region [.log.]
            if (Log.ProcessViewCommand(context))
            {
                return;
            }
            #endregion

            var text = default(string);
            try
            {
                text = context.GetRequestStringParam("text", Config.Inst.MAX_INPUTTEXT_LENGTH);
                var type = context.Request["type"];

                var hcd           = new http_context_data(context);
                var languageInfos = default(LanguageInfo[]);
                if (string.Compare(type, "ru", true) == 0)
                {
                    languageInfos = hcd.GetRussianLanguageConcurrentFactory().DetectLanguage(text);
                }
                else
                {
                    languageInfos = hcd.GetMultiLanguageConcurrentFactory().DetectLanguage(text);
                }

                Log.Info(context, text);
                context.Response.ToJson(languageInfos);
            }
            catch (Exception ex)
            {
                Log.Error(context, text, ex);
                context.Response.ToJson(ex);
            }

            /*
             * {
             *  GC.Collect( GC.MaxGeneration, GCCollectionMode.Forced );
             *  GC.WaitForPendingFinalizers();
             *  GC.Collect( GC.MaxGeneration, GCCollectionMode.Forced );
             * }
             */
        }