From 327383e38afb810f6afc3cd185444225f0368074 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 7 Dec 2014 22:14:51 +1100 Subject: [PATCH] * Remove unused code in tagger.pyx --- spacy/tagger.pyx | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/spacy/tagger.pyx b/spacy/tagger.pyx index 0ae66a844..04ffef550 100644 --- a/spacy/tagger.pyx +++ b/spacy/tagger.pyx @@ -15,9 +15,6 @@ import cython from thinc.features cimport Feature, count_feats -NULL_TAG = 0 - - def setup_model_dir(tag_type, tag_names, tag_counts, templates, model_dir): if path.exists(model_dir): shutil.rmtree(model_dir) @@ -55,33 +52,6 @@ def train(train_sents, model_dir, nr_iter=10): tagger.model.dump(path.join(model_dir, 'model')) -cdef object _get_gold_pos(i, golds): - if golds[i] == 0: - return None - else: - return [golds[i]] - - -cdef object _get_gold_ner(i, golds, int* ner): - if golds[i] == 0: - return None - else: - return [golds[i]] - - -def evaluate(tagger, sents): - n_corr = 0 - total = 0 - for tokens, golds in sents: - for i, gold in enumerate(golds): - guess = tagger.predict(i, tokens) - tokens.set_tag(i, tagger.tag_type, guess) - if gold != NULL_TAG: - total += 1 - n_corr += guess == gold - return n_corr / total - - cdef class Tagger: """Assign part-of-speech, named entity or supersense tags, using greedy decoding. The tagger reads its model and configuration from disk.