Beispiel #1
0
 def saveToFile(self, event):
     fileChooser = JFileChooser()
     if not (self.targetURL is None):
         fileChooser.setSelectedFile(File("Burp_SSL_Scanner_Result_%s.html" \
             % (self.targetURL.getHost())))
     else:
         fileChooser.setSelectedFile(File("Burp_SSL_Scanner_Result.html"))
     if (fileChooser.showSaveDialog(self.getUiComponent()) == JFileChooser.APPROVE_OPTION):
         fw = FileWriter(fileChooser.getSelectedFile())
         fw.write(self.textPane.getText())
         fw.flush()
         fw.close()
         print "Saved results to disk"
    def writeLocations(self):

        f = Files.createExternalFile(Environment.DIRECTORY_DOWNLOADS,
                                     "WeatherForecast", "locations.txt", None,
                                     None)

        try:
            stream = FileWriter(f)

            for key in self.order:
                stream.write(self.locations[key] + "\n")

            stream.flush()
            stream.close()

        except FileNotFoundException:
            pass
Beispiel #3
0
        if i.strip() != ''
    ]
    de_vocab = [
        i.strip()
        for i in codecs.open(options.de_vocab, 'r', 'utf8').readlines()
        if i.strip() != ''
    ]
    for env in en_vocab:
        add_to_tags(env)
    uc_training = UnCachedFgList(training_instanes=training_ti,
                                 en_vocab=en_vocab)
    for idx, ti in enumerate(training_ti):
        print idx, uc_training.get(idx)
    trainer = CrfTrainer(get_trainer_prm())
    exit(1)
    feature_ids, feature_labels = zip(
        *sorted([(v, k) for k, v in feature_label2id.iteritems()]))
    # initialize weight for each feature
    factor_graph_model = FgModel(len(feature_label2id), list(feature_labels))
    for fid in list(feature_ids):
        factor_graph_model.add(fid, 0.0)

    trainer.train(factor_graph_model, uc_training)
    sw = FileWriter('feature.weights')
    factor_graph_model.printModel(sw)
    sw = codecs.open('feature.names', 'w', 'utf8')
    for k, i in feature_label2id.iteritems():
        sw.write(str(i) + '\t' + str(k) + '\n')
    sw.flush()
    sw.close()
import de.embl.cba.metadata.MetaData as MetaData
import de.embl.cba.metadata.MetadataCreator as MetadataCreator
import ij.IJ as IJ
import org.yaml.snakeyaml.DumperOptions as DumperOptions
import org.yaml.snakeyaml.Yaml as Yaml
import java.io.FileWriter as FileWriter

file = "/Volumes/cba/exchange/OeyvindOedegaard/yaml_project/01_TestFiles/20180627_LSM780M2_208_ibidi1_fcs_B_Posx96.lsm"
metadataCreator = MetadataCreator(file)
metadata = metadataCreator.getMetadata()

dumperOptions = DumperOptions()
dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK)

outputPath = "/Volumes/cba/exchange/OeyvindOedegaard/yaml_project/test.yaml"
yaml = Yaml(dumperOptions)
writer = FileWriter(outputPath)
yaml.dump(metadata, writer)
writer.flush()
writer.close()

IJ.open(outputPath)
Beispiel #5
0
        ti, obs, guess = get_instance(line)
        training_ti.append(ti)

    for line in open(options.test_file).readlines():
        ti, obs, guess = get_instance(line)
        testing_ti.append(ti)

    en_vocab = [i.strip() for i in codecs.open(options.en_vocab, 'r', 'utf8').readlines() if i.strip() != '']
    de_vocab = [i.strip() for i in codecs.open(options.de_vocab, 'r', 'utf8').readlines() if i.strip() != '']
    for env in en_vocab:
        add_to_tags(env)
    uc_training = UnCachedFgList(training_instanes=training_ti, en_vocab=en_vocab)
    for idx, ti in enumerate(training_ti):
        print idx, uc_training.get(idx)
    trainer = CrfTrainer(get_trainer_prm())
    exit(1)
    feature_ids, feature_labels = zip(*sorted([(v, k) for k, v in feature_label2id.iteritems()]))
    # initialize weight for each feature
    factor_graph_model = FgModel(len(feature_label2id), list(feature_labels))
    for fid in list(feature_ids):
        factor_graph_model.add(fid, 0.0)

    trainer.train(factor_graph_model, uc_training)
    sw = FileWriter('feature.weights')
    factor_graph_model.printModel(sw)
    sw = codecs.open('feature.names', 'w', 'utf8')
    for k, i in feature_label2id.iteritems():
        sw.write(str(i) + '\t' + str(k) + '\n')
    sw.flush()
    sw.close()