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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:17:29+00:00 2026-05-30T14:17:29+00:00

Example : Speak -> Spubeak, more info here Don’t give me a solution, but

  • 0

Example: Speak -> Spubeak, more info here

Don’t give me a solution, but point me in the right direction or tell which which python library I could use? I am thinking of regex since I have to find a vowel, but then which method could I use to insert ‘ub’ in front of a vowel?

  • 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-30T14:17:31+00:00Added an answer on May 30, 2026 at 2:17 pm

    It is more complex then just a simple regex e.g.,

    "Hi, how are you?" → "Hubi, hubow ubare yubou?"
    

    Simple regex won’t catch that e is not pronounced in are.

    You need a library that provides a pronunciation dictionary such as nltk.corpus.cmudict:

    from nltk.corpus import cmudict # $ pip install nltk
    # $ python -c "import nltk; nltk.download('cmudict')"
    
    def spubeak(word, pronunciations=cmudict.dict()):
        istitle = word.istitle() # remember, to preserve titlecase
        w = word.lower() #note: ignore Unicode case-folding
        for syllables in pronunciations.get(w, []):
            parts = []
            for syl in syllables:
                if syl[:1] == syl[1:2]:
                    syl = syl[1:] # remove duplicate
                isvowel = syl[-1].isdigit()
                # pronounce the word
                parts.append('ub'+syl[:-1] if isvowel else syl)
            result = ''.join(map(str.lower, parts))
            return result.title() if istitle else result
        return word # word not found in the dictionary
    

    Example:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import re
    
    sent = "Hi, how are you?"
    subent = " ".join(["".join(map(spubeak, re.split("(\W+)", nonblank)))
                       for nonblank in sent.split()])
    print('"{}" → "{}"'.format(sent, subent))
    

    Output

    "Hi, how are you?" → "Hubay, hubaw ubar yubuw?"

    Note: It is different from the first example: each word is replaced with its syllables.

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

Sidebar

Related Questions

I am creating an application based on the Speak Here example app . I
Example: find / * Gives me all files and directories, but I want only
Not that I need it, but it was interesting to hear someone speak about
Hello for all people... Sorry for my english, but speak spanish... In this week,
I will let the example speak for it self: ruby-1.9.2-p0 > DateTime.now => Mon,
Hello kind computing people, Okay this is super broad, but I thought I'd give
For example text file: Speak friend and enter using a Perl script to remove
Take the following LINQ query as an example. Please don't comment on the code
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe
Example I have Person , SpecialPerson , and User . Person and SpecialPerson are

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.