Beispiel #1
0
        public static GetTextResponse ConvertProcessedTextDocumentToGetTextResponse(ProcessedText document)
        {
            var getTextResponse = new GetTextResponse
            {
                Author = document.Author,
                AutomatedReadabilityIndex = document.AutomatedReadabilityIndex,
                AverageSentenceLength     = document.AverageSentenceLength,
                ColemanLiauIndex          = document.ColemanLiauIndex,
                Content = document.Content,
                DaleChallReadabilityScore = document.DaleChallReadabilityScore,
                DatePublished             = document.DatePublished,
                DifficultWords            = document.DifficultWords,
                Domain              = document.Domain,
                Excerpt             = document.Excerpt,
                FleschKincaidGrade  = document.FleschKincaidGrade,
                FleshEase           = document.FleshEase,
                GunningFoxIndex     = document.GunningFoxIndex,
                LeadImageUrl        = document.LeadImageUrl,
                LexiconCount        = document.LexiconCount,
                LinsearWriteIndex   = document.LinsearWriteIndex,
                LixReadabilityIndex = document.LixReadabilityIndex,
                OverallScore        = document.OverallScore,
                ProcessedTime       = document.ProcessedTime,
                SentenceCount       = document.SentenceCount,
                SmogIndex           = document.SmogIndex,
                Summary             = document.Summary,
                Predicted           = document.Predicted,
                SyllableCount       = document.SyllableCount,
                Title = document.Title,
                Url   = document.Url,
            };

            return(getTextResponse);
        }
Beispiel #2
0
        public virtual HttpResponseMessage GetText(string text)
        {
            GetTextResponse response = new GetTextResponse();

            try
            {
                response.Text = _textService.PingText(text);
            }
            catch (Exception ex)
            {
                response.Text  = string.Empty;
                response.Error = string.Format("Internal server error: {0}", ex.Message);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }