예제 #1
0
def write_slf_phoneme_ngram_lattices(outpath, sent, slfdirpath, dictionary, no_syll_stress):
  #Make the SLF
  slf = lattice_tools.make_phoneme_slf(sent, dictionary, pronoun_variant=True, no_syll_stress=no_syll_stress, SRILM_lattice_fix=True)
  
  #Write it out
  wf = open(os.path.join(slfdirpath, outpath), "w")
  for l in slf:
    wf.write(l)
  wf.close()
예제 #2
0
def write_slf_alignment_lattices(outpath, sent, slfdirpath, dictionary, pronoun_variant):
  #Make the SLF
  slf = lattice_tools.make_phoneme_slf(sent, dictionary, pronoun_variant)
  
  #Write it out
  wf = open(os.path.join(slfdirpath, outpath), "w")
  for l in slf:
    wf.write(l)
  wf.close()
예제 #3
0
def write_slf_alignment_lattices(outpath, sent, slfdirpath, dictionary,
                                 pronoun_variant):
    #Make the SLF
    slf = lattice_tools.make_phoneme_slf(sent, dictionary, pronoun_variant)

    #Write it out
    wf = open(os.path.join(slfdirpath, outpath), "w")
    for l in slf:
        wf.write(l)
    wf.close()
예제 #4
0
def write_slf_phoneme_ngram_lattices(outpath, sent, slfdirpath, dictionary,
                                     no_syll_stress):
    #Make the SLF
    slf = lattice_tools.make_phoneme_slf(sent,
                                         dictionary,
                                         pronoun_variant=True,
                                         no_syll_stress=no_syll_stress,
                                         SRILM_lattice_fix=True)

    #Write it out
    wf = open(os.path.join(slfdirpath, outpath), "w")
    for l in slf:
        wf.write(l)
    wf.close()
예제 #5
0
파일: txt2lmscore.py 프로젝트: RasmusD/SiRe
def create_lattices_and_list(txtlist, outdirpath, dictionary, overwrite=False):
    path_list = []
    for txt in txtlist:
        path = os.path.join(outdirpath, txt[0] + ".phoneme_slf")
        # Make the slf
        slf = lattice_tools.make_phoneme_slf(txt[1:], dictionary, pronoun_variant=True, no_syll_stress=True)
        # Write it out
        wf = io.open_writefile_safe(path, overwrite)
        for l in slf:
            wf.write(l)
        wf.close()
        # Everything has gone well so we add the path
        path_list.append(path)
    # Write out the path file.
    wf = io.open_writefile_safe(os.path.join(outdirpath, "lattices.list"))
    for p in path_list:
        wf.write(p + "\n")
    wf.close()
예제 #6
0
def create_lattices_and_list(txtlist, outdirpath, dictionary, overwrite=False):
    path_list = []
    for txt in txtlist:
        path = os.path.join(outdirpath, txt[0] + ".phoneme_slf")
        #Make the slf
        slf = lattice_tools.make_phoneme_slf(txt[1:],
                                             dictionary,
                                             pronoun_variant=True,
                                             no_syll_stress=True)
        #Write it out
        wf = io.open_writefile_safe(path, overwrite)
        for l in slf:
            wf.write(l)
        wf.close()
        #Everything has gone well so we add the path
        path_list.append(path)
    #Write out the path file.
    wf = io.open_writefile_safe(os.path.join(outdirpath, "lattices.list"))
    for p in path_list:
        wf.write(p + "\n")
    wf.close()