IF YOU โค๏ธ RAPIDMINER, PLEASE HELP US GET TO #1 AGAIN - VOTE IN KDNUGGETS POLL 2019! ๐Ÿ™ ๐Ÿ™ ๐Ÿ™

Split preformatted text (of web page) on paragraphs

philipp25philipp25 Member Posts: 2 Contributor I
Hello,
I crawled multiple pages with the "get Pages"-Operator (Webmining Extension). All of the text of the website is in a <pre>-HTML-tag.
I want to cut the preformatted-text by the paragraphs. The "get Content"-Operator extracts the text perfectly, but destroys the formatting.

Any solution?

Thanks!

Answers

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,118   Unicorn
    You could split the text up by paragraph using the Cut Document operator and then use Extract Content operator on the resulting paragraphs, and then join everything back together.
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
    philipp25
  • philipp25philipp25 Member Posts: 2 Contributor I
    edited May 15
    Thanks! But first I have to extract the text from the <pre> don't I?  I would post a Link, but my RM-Account seems to be too new :)

    <body>
        <pre>
                  preformatted text
                  paragaph
                 performatted text
        </pre>
    </body>

    Okay I got further. I extracted the text into an attribute and it looks like this:

    text
    text

    text2
    text2

    How do I split the text on each empty line / paragraph ?



  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,118   Unicorn
    Cut Document should do the trick if you use regex for line breaks, or you could also do the cut before you remove the html and use the html code instead.
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • sgenzersgenzer 12Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,261  Community Manager
    @philipp25 I just boosted your user acct - you can post links now.

    Scott

Sign In or Register to comment.