Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6742187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:48:49+00:00 2026-05-26T11:48:49+00:00

hi i was wondering if someone could help me i want to split a

  • 0

hi i was wondering if someone could help me i want to split a block of text into sentences then split the sentence into words, i have managed to split the text sentence by sentence but i can not figure out how to split the sentences into words. i know if you replace “input.text.split(‘\r?\n’)” the bracket values with space and it would split the text into word for word but i want it first to split the text sentence by sentence then word by word so that i can add custom styles. code is below , thanks in advance. p.s each sentence has a line break.

    <script type="text/javascript">
      var parser = {
        outputString:  '',
        subtitle: function(input) {
          var words = input.text.split('\\r?\\n');
          var duration = input.end - input.start;
          var timeStep = duration/words.length;
          for (var i=0, l=words.length; i<l; ++i) {
            var time = Math.round((input.start + i*timeStep) * 1000);
            var text = words[i];
            var safeText = text.replace('"', '\\"');
            parser.outputString += '<span class="arabic" m="'+time+'" oval="'+safeText+'">'+text+'</span>';
          } //for
          return parser;
        }, //subtitle
    }; //parser

      document.addEventListener('DOMContentLoaded', function(e) {
        var parsed = document.getElementById('parsed');
        parsed.style.width = window.innerWidth - 10 + "px";
        parsed.style.height = window.innerHeight - 10 + "px";
        parsed.value = '<div id="sura-body">' + parser.outputString + '</div>';
      }, false);
    </script>
    <script type="text/javascript" src="paneltext_da.js"></script>
      </head>
     <body>
     <textarea id="parsed"></textarea>
    </body>
    </html>

i still can not figure out how to add the html “<p>” to each sentence the data format am using is json. can some one help. thanks

            .subtitle({
          start: 6.057, 
          end: 9.07, 
          text: "Det er et af de vigtigste værktøjer i hverdagen.", 
          target: "subtitlediv"
        })   
        .subtitle({
          start: 9.07, 
          end: 15.02, 
          text: "Det er i browseren vi læser nyheder, ser TV, checker email, snakker med venner, shopper, booker billetter -", 
          target: "subtitlediv"
        })
        .subtitle({
          start: 15.02, 
          end: 18.08, 
          text: "Tusindvis af de ting vi efterhånden gør på nettet.", 
          target: "subtitlediv"
        })
        .subtitle({
          start: 18.081, 
          end: 23.021, 
          text: "Derfor er det også vigtigt hvilken browser vi bruger, og hvordan den virker.", 
          target: "subtitlediv"
        })
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:48:50+00:00Added an answer on May 26, 2026 at 11:48 am

    I have refactored your function and i hope it will help you out. Check out the link below.

    http://jsfiddle.net/Rdz3s/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wondering if someone could help me. I have next to no knowledge with Ajax,
I was wondering if someone could help me with this. I have defined my
I was wondering if someone could help me with a simple question? i have
Im wondering if someone could help me. I have hundreds of people uploading images
Wondering if someone could help with with some Spring.net IOC integration into a .aspx
I was wondering if someone could help me. Suppose I have some classes as
Im wondering if someone could help me .... I have 2 images, and i
I was wondering if someone could help me. I have the following two tables:
I am wondering of someone could help me out. I want to display random
I was wondering if someone could help me please. I have the following two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.