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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:45:44+00:00 2026-05-25T14:45:44+00:00

Here is the solution to the question I had asked here assigning a string

  • 0

Here is the solution to the question I had asked here assigning a string with a combination of two and separate them in a list. The earlier question was an example and below is the actual program.

import sys

param_values = {
            'vowels':{
            'aa' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,1.0),   (-1,-1)],     
            'ae' : [(-1,-1),   (-1,-1),    (0.1,0.8), (-1,-1),   (0.1,1.0),   (-1,-1)], 
            'ah' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,1.0),   (-1,-1)], 
            'ao' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.2,1.0),   (-1,-1)], 
            'eh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,1.0),   (-1,-1)], 
            'er' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.15,0.7),  (-1,-1)], 
            'ey' : [(-1,-1),   (-1,-1),    (0.3,1.0), (-1,-1),   (0.1,0.5),   (-1,-1)],
            'ih' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'iy' : [(-1,-1),   (-1,-1),    (0.2,1.0), (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'uh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (0.1,1.0)], 
            'uw' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (0.1,1.0)],   
            'o'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (0.4,1.0)]       
            },
            'consonants':{
            'b'  : [(-1,-1),   (0.0,0.0),  (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'ch' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            'd'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            'dh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.35),  (-1,-1)], 
            'dx' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.35),  (-1,-1)], 
            'f'  : [(0.3,1.0), (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (-1,-1)], 
            'g'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'hh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'jh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'k'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'l'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            'm'  : [(-1,-1),   (0.0,0.0),  (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'n'  : [(-1,-1),   (0.1,1.0),  (-1,-1),   (0.3,1.0), (0.0,0.0),   (-1,-1)], 
            'ng' : [(-1,-1),   (0.1,1.0),  (-1,-1),   (-1,-1),   (0.0,0.0),   (-1,-1)], 
            'p'  : [(-1,-1),   (0.0,0.0),  (-1,-1),   (-1,-1),   (0.1,0.8),   (-1,-1)], 
            'r'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            's'  : [(-1,-1),   (0.1,1.0),  (-1,-1),   (0.3,1.0), (0.0,0.0),   (-1,-1)],
            'sh' : [(-1,-1),   (0.1,1.0),  (-1,-1),   (0.3,1.0), (0.0,0.0),   (-1,-1)], 
            't'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            'th' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.4),   (-1,-1)], 
            'v'  : [(0.3,1.0), (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (-1,-1)], 
            'w'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (-1,-1),     (0.1,1.0)], 
            'y'  : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.6),   (-1,-1)],  
            'z'  : [(-1,-1),   (0.1,1.0),  (-1,-1),   (0.3,1.0), (0.0,0.0),   (-1,-1)], 
            'zh' : [(-1,-1),   (-1,-1),    (-1,-1),   (-1,-1),   (0.1,0.6),   (-1,-1)] 
             }                         
            }

diphthong = { 
             'aw' : ['ao' , 'uw'],
             'ay' : ['ao' , 'ih'],
             'ow' : ['o' , 'aa'],
             'oy' : ['o' , 'ih']
            }   

def Usage() :
    print "Usage :python co.py phonemeFile"

def coart(phonemeFile):
    """ Function for generating parameter values looking from the global list """
    phonemeList = []
    with open("syllabifiedPhonemes.txt", "r") as pFile :
        for line in pFile :
            l = line.split()
            for phoneme in l : 
                next_phoneme = diphthong.get(phoneme)
                if next_phoneme is None :
                    phonemeList.append((phoneme, param_values.get(phoneme)))

                else : 
                    phonemeList.extend([(phoneme, param_values.get(phoneme)) for phoneme in next_phoneme])

            print "New List"
            print '\n'.join(str(l) for l in phonemeList)

if __name__ == '__main__':
    if len(sys.argv) != 2 : 
        Usage() 

    else :
        phonemeFile = sys.argv[1]

        coart("syllabifiedPhonemes.txt")

The input file syllabifiedPhonemes.txt has the following contents:

s aa ' m ih ' k l eh k ' t aa ' n ih t ' g eh l ' v ae ' n ih ' k aa ' p l ay k

The output I got is the following:

New List
('s', None)
('aa', None)
("'", None)
('m', None)
('ih', None)
("'", None)
('k', None)
('l', None)
('eh', None)
('k', None)
("'", None)
('t', None)
('aa', None)
("'", None)
('n', None)
('ih', None)
('t', None)
("'", None)
('g', None)
('eh', None)
('l', None)
("'", None)
('v', None)
('ae', None)
("'", None)
('n', None)
('ih', None)
("'", None)
('k', None)
('aa', None)
("'", None)
('p', None)
('l', None)
('ao', None)
('ih', None)
('k', None)

Now my question is, how do I display the complete dictionary with the values? I can see that I am not printing it the right way as there is the separation of vowels and consonants. How do I get the output as the following neglecting the vowels and consonants tag?

('s', [(-1, -1), (0.10000000000000001, 1.0), (-1, -1), (0.29999999999999999, 1.0), (0.0, 0.0), (-1, -1)]) 

P.S. For the apostrophes, None is ok as they are not in the dict.

Thank you.

  • 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-25T14:45:44+00:00Added an answer on May 25, 2026 at 2:45 pm

    Replace the section where the phonemes are added with the following:

    if next_phoneme is None :
        phonemeList.append((phoneme, param_values.get(phoneme)))
    else : 
        phonemeList.extend([(phoneme, param_values.get(phoneme)) for phoneme in next_phoneme])
    

    This adds the full tuples, not just the names.

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

Sidebar

Related Questions

Hi guys i previously asked a question and got a good solution. here is
This user asked a similar question but had no viable solution in the answers,
I had a certain query regarding a question I was asked earlier. I was
I am aware that there is a similar question here with no solution. I'm
Update: This question was an epic failure, but here's the working solution. It's based
Ok I had asked a question before about how to open fancybox from an
this is a question i've seen here but the solution posted didn't resolve my
I had an interview today and the person asked me this question: How do
In my previous question on this portal, I had asked about some insight about
Simple problem, though apparently not a simple solution. Example here: http://myhideout.eu/new/ Basically the site

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.