def write_moses_config(self, phrase_table, target_file):
        new_config_name = os.path.join(self.tmp_dir, 'moses.'+self.time_stamp+'.ini')
        new_config = open(new_config_name, 'w')
        constrained = False
        for line in open(self.moses_config):
            if line.startswith("PhraseDictionaryBinary"):
                good_line = [s for s in line.strip().split() if not s.startswith('path')]
                new_config.write("%s path=%s\n" % (' '.join(good_line), phrase_table))
            elif line.startswith("ConstrainedDecoding"):
                new_config.write(target_file % "ConstrainedDecoding path=%s max-unknowns=-1\n")
            elif line.startswith("[weight]") and not constrained:
                new_config.write("ConstrainedDecoding path=%s max-unknowns=-1\n\n" % target_file)
                new_config.write("[weight]\n")
            else:
                new_config.write(line)
        new_config.close()
        return new_config_name

    # src, tg - lists of lists
    # align_file - new file to store the alignments
    # each inner list is a sentence
dataset/ETHPy150Open qe-team/marmot/marmot/representations/segmentation_representation_generator.py/SegmentationRepresentationGenerator.write_moses_config/swapped operands of `%`