C1TextParser

ExtractQuotedText

ExtractQuotedText

This view shows basic features of StartsUntilContinuesAfterExtractor.

Features

  • Sample Applications

  • Starts After Continues Until Extractor

    Extract all the quoted text from an excerpt of "The Picture of Dorian Gray" by Oscar Wilde" (public domain book). Extractor specification: Starts After " Continues Until " The input stream content, as well as the extracted result (in Json format) are displayed down below.

    Input file

    Lord Henry smiled, and leaning down, plucked a pink-petalled daisy from the grass and examined it. 
    "I am quite sure I shall understand it," he replied, gazing intently at the little golden,
    white-feathered disk, "and as for believing things, I can believe anything, provided that it is 
    quite incredible."
    The wind shook some blossoms from the trees, and the heavy lilac-blooms, with their clustering 
    stars, moved to and fro in the languid air. A grasshopper began to chirrup by the wall, and like
    a blue thread a long thin dragon-fly floated past on its brown gauze wings. Lord Henry felt as if
    he could hear Basil Hallward's heart beating, and wondered what was coming.
    "The story is simply this," said the painter after some time. "Two months ago I went to a crush at
    Lady Brandon's. You know we poor artists have to show ourselves in society from time to time, just
    to remind the public that we are not savages. With an evening coat and a white tie, as you told me
    once, anybody, even a stock-broker, can gain a reputation for being civilized."

    Extracted result

    {
      "Extractor": "StartsAfterContinuesUntil",
      "Result": [
      {
        "StartIndex": 102,
        "ExtractedText": "I am quite sure I shall understand it,"
      },
      {
        "StartIndex": 216,
        "ExtractedText": "and as for believing things, I can believe anything, provided that it is \r\nquite incredible."
      },
      {
        "StartIndex": 683,
        "ExtractedText": "The story is simply this,"
      },
      {
        "StartIndex": 745,
        "ExtractedText": "Two months ago I went to a crush at\r\nLady Brandon's. You know we poor artists have to show ourselves in society from time to time, just\r\nto remind the public that we are not savages. With an evening coat and a white tie, as you told me\r\nonce, anybody, even a stock-broker, can gain a reputation for being civilized."
      }
    ]
    }
    using System.Collections;
    using System.Globalization;
    using System.Linq;
    using System.Web.Mvc;
    using C1.Web.Mvc;
    using SamplesExplorer.Models;
    using System.Collections.Generic;
    using System;
    using C1.TextParser;
    using System.IO;
    using System.Text;
    using System.Runtime.Serialization;
    
    namespace SamplesExplorer.Controllers
    {
        public partial class C1TextParserController : Controller
        {
            public ActionResult ExtractQuotedText(FormCollection collection)
            {
                StartsAfterContinuesUntil startsAfterContinuesUntil = new StartsAfterContinuesUntil(@"""", @"""");
    
                using (var inputStream = System.IO.File.Open(Server.MapPath("~/Content/sampleFiles/ExtractQuotedText.txt"), FileMode.Open))
                {
                    IExtractionResult result = startsAfterContinuesUntil.Extract(inputStream);
                    ViewBag.ExtractionResult = result.ToJsonString();
                }
                return View();
            }
        }
    }
    
    @section Summary{
        <p>@Html.Raw(Resources.C1TextParser.StartsAfterExtractor_Text0)</p>
    }
    
    <div>
        <div>
            <h3>@Html.Raw(Resources.C1TextParser.StartsAfterExtractor_Title)</h3>
    
            <p>@Html.Raw(Resources.C1TextParser.ExtractQuotedText_Text1)</p>
        </div>
        <div>
            <h3>Input file</h3>
            <pre class="scrollable-pre">@Html.Raw(ControlPages.GetSampleFileContent("ExtractQuotedText.txt"))</pre>
        </div>
        <div>
    
            <h3>Extracted result</h3>
            <pre class="scrollable-pre">@Html.Raw(ViewBag.ExtractionResult)</pre>
        </div>
    </div>