# Path: tagset.py
# class Tag:
#     def __init__(self, field, position, tagset):
#         self.field = field
#         self.position = position
#         self.tagset = tagset
#         tagset.tag_fields.add(field)
# 
#     def c_value(self):
#         if self.position == 0:
#             return 'tag'
#         else:
#             return '((i>=%d)? history[i-%d] : %s)' % (
#                     -self.position, -self.position, self.tagset.c_n_tags)


import sys
import hashlib, math
from collections import defaultdict
from tagset import Tag
            size_t j;
            tags = get_tags(hash%d_fmix(invariant_hashes[N_INVARIANTS*i + %d]));
            /* if (tags[0] == 1) {
                for (k=0; k<beam_size; k++) {
                    max_tag[k] = tags[1];
                    max_beam[k] = 0;
                    max_score[k] = beam_scores[k];
                }
            } else */ {
                for (j=1; j<tags[0]+1; j++) {
                    for (k=0; k<beam_size; k++) {
                        extract_features(
                                beams[k], tags[j], i, n_items,
                                invariant_hashes, feature_hashes);
                        const real score = beam_scores[k] + get_score(
                                feature_hashes, N_FEATURES,
                                weights, weights_len,
                                use_dropout, dropout_seed);
                        if (score > max_score[BEAM_SIZE-1]) {
                            size_t l,m;
                            for (l=0; score < max_score[l]; l++);
                            for (m=BEAM_SIZE-1; m>l; m--) {
                                max_score[m] = max_score[m-1];
                                max_tag[m] = max_tag[m-1];
                                max_beam[m] = max_beam[m-1];
                            }
                            max_score[l] = score;
                            max_tag[l] = (label)tags[j];
                            max_beam[l] = k;
                        }

# Path: tagset.py
# class Tag:
#     def __init__(self, field, position, tagset):
#         self.field = field
#         self.position = position
#         self.tagset = tagset
#         tagset.tag_fields.add(field)
# 
#     def c_value(self):
#         if self.position == 0:
#             return 'tag'
#         else:
#             return '((i>=%d)? history[i-%d] : %s)' % (
#                     -self.position, -self.position, self.tagset.c_n_tags)


# Path: form.py
import sys
import hashlib, math
from collections import defaultdict
from tagset import Tag

            size_t j;
            tags = get_tags(hash%d_fmix(invariant_hashes[N_INVARIANTS*i + %d]));
            /* if (tags[0] == 1) {
                for (k=0; k<beam_size; k++) {
                    max_tag[k] = tags[1];
                    max_beam[k] = 0;
                    max_score[k] = beam_scores[k];
                }
            } else */ {
                for (j=1; j<tags[0]+1; j++) {
                    for (k=0; k<beam_size; k++) {
                        extract_features(
                                beams[k], tags[j], i, n_items,
                                invariant_hashes, feature_hashes);
                        const real score = beam_scores[k] + get_score(
                                feature_hashes, N_FEATURES,
                                weights, weights_len,
                                use_dropout, dropout_seed);
                        if (score > max_score[BEAM_SIZE-1]) {
                            size_t l,m;
                            for (l=0; score < max_score[l]; l++);
                            for (m=BEAM_SIZE-1; m>l; m--) {
                                max_score[m] = max_score[m-1];
                                max_tag[m] = max_tag[m-1];
                                max_beam[m] = max_beam[m-1];
                            }
                            max_score[l] = score;
                            max_tag[l] = (label)tags[j];
                            max_beam[l] = k;
                        }

                    }