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 8018567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:09:28+00:00 2026-06-04T21:09:28+00:00

Based on the given input: I can do waaaaaaaaaaaaay better :DDDD!!!! I am sooooooooo

  • 0

Based on the given input:

I can do waaaaaaaaaaaaay better :DDDD!!!! I am sooooooooo exicted about it :))) Good !!

Desired: output

I can do way/LNG better :D/LNG !/LNG I am so/LNG exicted about it :)/LNG Good !/LNG

— Challenges:

  1. better vs. soooooooooo >> we need to keep the first one as is but shorten the second
  2. for the second we need to add a tag (LNG) as it might have some importance for intensification for subjectivity and sentiment

—- Problem: error message “unbalanced parentheses”

Any ideas?

My code is:

import re 

lengWords = {} # a dictionary of lengthened words 

def removeDuplicates(corpus):

data = (open(corpus, 'r').read()).split()
myString = " ".join(data)

for word in data:
    for chr in word: 
        countChr = word.count(chr)
        if countChr >= 3: 
            lengWords[word] = word+"/LNG"
            lengWords[word] = re.sub(r'([A-Za-z])\1+', r'\1', lengWords[word])
            lengWords[word] = re.sub(r'([\'\!\~\.\?\,\.,\),\(])\1+', r'\1', lengWords[word])                             

    for k, v in lengWords.items():
        if k == word: 
            re.sub(word, v, myString)
return myString
  • 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-06-04T21:09:29+00:00Added an answer on June 4, 2026 at 9:09 pm

    It’s not the perfect solution, but I don’t have time to refine it now- just wanted to get you started with easy approach:

    s = "I can do waaaaaaaaaaaaay better :DDDD!!!! I am sooooooooo exicted about it :))) Good !!"
    re.sub(r'(.)(\1{2,})',r'\1/LNG',s)
    >> 'I can do wa/LNGy better :D/LNG!/LNG I am so/LNG exicted about it :)/LNG Good !!'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to block a given change based on the user role?
Given: WPF 4.0 desktop-based application. Basic input form with two TextBox fields and submit
How do I create and initialize an array in F# based on a given
I was given a task. First dialog based application has 4 buttons (up, down,
My boss have given me assignment to find how a web based application developed
Documentation states: Files are included based on the file path given or, if none
I have an Excel Workbook which has some VSTO-based c# code. Given a known
I've been looking into a legacy application with a web-based user interface. Given its
I want to filter records from given file based on some criteria,i want my
I want to develop a program which recolors the input image based on the

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.