1

I'm practicing web scraping with java and there is a string variable which always contain repetitive sentence. For example:

String sentence = "This is sentence one. This is sentence one.";

Can someone help me in removing duplicate sentence from a string?

  • Bohemian's solution in the duplicate will work, but you will need to change the char/regex that you split with in order to get separate whole "sentences" – Hovercraft Full Of Eels Jul 11 '20 at 14:11
  • That's the main problem, what char should I use to split sentence. I cannot use full-stop as sometimes sentence is repeated but doesn't even have a full-stop. – Pulkit Bansal Jul 11 '20 at 14:24
  • That's your problem to solve: how do you define a "sentence", and I'm afraid that only *you* can solve this – Hovercraft Full Of Eels Jul 11 '20 at 14:38
  • Then you have your work cut out for you -- scrape the data, *analyze* the data, try some form of splitting using the best regex idea, then re-scrape, re-analyze, repeat ... again, only you can figure this out since only you have the data in hand – Hovercraft Full Of Eels Jul 11 '20 at 15:45

0 Answers0