Exemple #1
0
void FeatureGenBackoff::add_backed_off_template(int plus) {
    add_template(lexicon_->word_index.size(), grammar_->n_rules(), plus);
    add_template(lexicon_->word_index.size(), grammar_->n_nonterms(), plus);

    if (!simple_) {
        add_template(lexicon_->tag_index.size(), grammar_->n_rules(), plus);
        add_template(lexicon_->tag_index.size(), grammar_->n_nonterms(), plus);
    }
}
void DialogSpectraTemplates::on_pushNew_clicked()
{
  Qpx::Spectrum::Template new_template;
  new_template.appearance = generateColor().rgba();
  new_template.match_pattern.resize(current_dets_.size());
  new_template.add_pattern.resize(current_dets_.size());
  DialogSpectrumTemplate* newDialog = new DialogSpectrumTemplate(new_template, current_dets_, false, this);
  connect(newDialog, SIGNAL(templateReady(Qpx::Spectrum::Template)), this, SLOT(add_template(Qpx::Spectrum::Template)));
  newDialog->exec();
}
Exemple #3
0
static GtkWidget *create_template_menu(void)
{
    GtkWidget *combo_box;
    GtkListStore *store;
    GtkCellRenderer *renderer;
    gint i;

    store = gtk_list_store_new(4, G_TYPE_STRING,
                                  G_TYPE_INT,
                                  G_TYPE_POINTER,
                                  G_TYPE_POINTER);

    i = 0;

    add_template(store, 2, "Th-232 -> Ra-228 -> Pb-208",
                 1.4e10, N_YEAR, 5.8, N_YEAR);
    i++;

    add_template(store, 4, "Am-241 -> Np-237 -> U-233 -> Th-229 -> Bi-209",
                 4.3e2, N_YEAR, 2.1e6, N_YEAR, 1.6e5, N_YEAR, 7.3e3, N_YEAR);
    i++;

    add_template(store, 3, "Th-230 -> Ra-226 -> Pb-210 -> Pb-206",
                 7.5e4, N_YEAR, 1.6e3, N_YEAR, 22.0, N_YEAR);
    i++;

    add_template(store, 3, "U-235 -> Pa-231 -> Ac-227 -> Pb-207",
                 7.0e8, N_YEAR, 3.3e4, N_YEAR, 22.0, N_YEAR);
    i++;

    combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));

    renderer = gtk_cell_renderer_text_new();
    gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_box), renderer, TRUE);
    gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), renderer,
                                   "text", 0, NULL);

    gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), i - 1);

    return combo_box;
}
Exemple #4
0
void FeatureGenBackoff::init(const Lexicon *lexicon,
                             const Grammar *grammar) {
    lexicon_ = lexicon;
    grammar_ = grammar;


    int n_tags = lexicon->tag_index.size();
    int n_nonterms = grammar->n_nonterms();
    int n_rules = grammar->n_rules();
    int n_labels = lexicon->deplabel_index.size();

    for (int i = 0; i < 8; ++i) {
        add_backed_off_template(1);
    }
    add_backed_off_template(n_tags);
    add_backed_off_template(n_tags);
    add_backed_off_template(n_nonterms);
    add_backed_off_template(n_nonterms);

    // ad hoc features.
    add_template(n_nonterms, n_nonterms);
    add_template(n_nonterms, n_nonterms);
    add_template(2, n_tags);
    add_template(2, n_nonterms);
    add_template(2, n_rules);

    add_template(10, n_nonterms);
    add_template(10, n_rules);

    if (!simple_) {
        add_template(10, 10, n_nonterms);
        add_template(10, 10, n_rules);


        add_template(n_nonterms, n_labels);
        add_template(n_nonterms, n_labels);
        add_template(n_nonterms, n_labels);
        add_template(n_rules, n_labels);
        add_template(n_nonterms, n_nonterms, n_labels);
        add_template(n_nonterms, n_nonterms, n_labels);
    }
    add_template(lexicon->tag_index.size(), grammar_->n_rules(), 1);
    add_template(lexicon->tag_index.size(), grammar_->n_nonterms(), 1);
    add_template(lexicon->tag_index.size(), grammar_->n_rules(), 1);
    add_template(lexicon->tag_index.size(), grammar_->n_nonterms(), 1);
    add_template(lexicon->tag_index.size(), lexicon->tag_index.size(), grammar_->n_nonterms());
    add_template(lexicon->tag_index.size(), lexicon->tag_index.size(), grammar_->n_rules());
    add_template(grammar_->n_nonterms(), 1, 1);
    add_template(grammar_->n_nonterms(), 1, 1);

}