def GetPlotnikCode(line):
    """ Call arpabet2plotnik -> in oder to get the plotnik vowel classes """
    phoneset = cmu.read_phoneset("../cmu_phoneset.txt")
    vowelSystem = "NorthAmerican"
    trans = line[30]
    ac = line[27]
    stress = line[28]
    phone = extractFormants.Phone()
    xmin = float(line[38])
    xmax = float(line[39])
    phone.label = ac + stress
    phone.xmin = xmin
    phone.xmax = xmax
    i = 0
    phones = [phone]
    speaker = extractFormants.Speaker()

    code, prec_p = plotnik.cmu2plotnik_code(i, phones, trans, phoneset,
                                            speaker, vowelSystem)
    return code.split('.')[0]
from shorta import is_tense

# setup for testing old system

from cmu import read_phoneset
from extractFormants import Phone
from plotnik_old import phila_system, cmu2plotnik_code

phoneset = read_phoneset('../cmu_phoneset.txt')

def is_tense_old(word, pron):
    try:
        i = pron.index("AE1")
    except ValueError:
        return "irrelevant"
    phones = []
    for phone in pron:
        myphone = Phone()
        myphone.label = phone
        phones.append(myphone)
    trans = word
    (code, prec_p) = cmu2plotnik_code(i, phones, trans, phoneset, None, "PHILA")
    fm = code.split(".")[1][0]
    fp = code.split(".")[1][1]
    fv = code.split(".")[1][2]
    ps = code.split(".")[1][3]
    fs = code.split(".")[1][4]
    pc = "3"
    pcode = phila_system(i, phones, trans, fm, fp, fv, ps, fs, pc, phoneset)
    if pcode == "33":
        return True
  case = options['case']
  outputFormat = options['outputFormat']
  outputHeader = options['outputHeader']
  formantPredictionMethod = options['formantPredictionMethod']
  measurementPointMethod = options['measurementPointMethod']
  speechSoftware = options['speechSoftware']
  nFormants = int(options['nFormants'])
  maxFormant = int(options['maxFormant'])
  removeStopWords = options['removeStopWords']
  measureUnstressed = options['measureUnstressed']
  minVowelDuration = float(options['minVowelDuration'])
  windowSize = float(options['windowSize'])
  preEmphasis = float(options['preEmphasis'])
  multipleFiles = options['multipleFiles']

  phoneset = cmu.read_phoneset(phonesetFile)

  # make sure the specified speech analysis program is in our path
  speechSoftware = checkSpeechSoftware(speechSoftware)

  # determine what program we'll use to extract portions of the audio file
  soundEditor = getSoundEditor()

  # if we're using the Mahalanobis distance metric for vowel formant prediction, we need to load files with the mean and covariance values
  if formantPredictionMethod == 'mahalanobis':
    means = loadMeans(meansFile)
    covs = loadCovs(covsFile)

  # put the list of stop words in upper or lower case to match the word transcriptions
  newStopWords = []
  for w in stopWords:
Exemple #4
0
from shorta import is_tense

# setup for testing old system

from cmu import read_phoneset
from extractFormants import Phone
from plotnik_old import phila_system, cmu2plotnik_code

phoneset = read_phoneset('../cmu_phoneset.txt')


def is_tense_old(word, pron):
    try:
        i = pron.index("AE1")
    except ValueError:
        return "irrelevant"
    phones = []
    for phone in pron:
        myphone = Phone()
        myphone.label = phone
        phones.append(myphone)
    trans = word
    (code, prec_p) = cmu2plotnik_code(i, phones, trans, phoneset, None,
                                      "PHILA")
    fm = code.split(".")[1][0]
    fp = code.split(".")[1][1]
    fv = code.split(".")[1][2]
    ps = code.split(".")[1][3]
    fs = code.split(".")[1][4]
    pc = "3"
    pcode = phila_system(i, phones, trans, fm, fp, fv, ps, fs, pc, phoneset)
    case = options['case']
    outputFormat = options['outputFormat']
    outputHeader = options['outputHeader']
    formantPredictionMethod = options['formantPredictionMethod']
    measurementPointMethod = options['measurementPointMethod']
    speechSoftware = options['speechSoftware']
    nFormants = int(options['nFormants'])
    maxFormant = int(options['maxFormant'])
    removeStopWords = options['removeStopWords']
    measureUnstressed = options['measureUnstressed']
    minVowelDuration = float(options['minVowelDuration'])
    windowSize = float(options['windowSize'])
    preEmphasis = float(options['preEmphasis'])
    multipleFiles = options['multipleFiles']

    phoneset = cmu.read_phoneset(phonesetFile)

    # make sure the specified speech analysis program is in our path
    speechSoftware = checkSpeechSoftware(speechSoftware)

    # determine what program we'll use to extract portions of the audio file
    soundEditor = getSoundEditor()

    # if we're using the Mahalanobis distance metric for vowel formant prediction, we need to load files with the mean and covariance values
    if formantPredictionMethod == 'mahalanobis':
        means = loadMeans(meansFile)
        covs = loadCovs(covsFile)

    # put the list of stop words in upper or lower case to match the word transcriptions
    newStopWords = []
    for w in stopWords: