def __init__(self): self.crf = CRF.default(self.feature_functions) logger.info('SequenceTagger initialized')
def tagger_retrain(): GLOBALS['tagger'] = CRF.default(crf_feature_functions, retrain=True) return dict(success=True)
def tagger_retrain(): GLOBALS["tagger"] = CRF.default(crf_feature_functions, retrain=True) return dict(success=True)
from tweedr.models import DBSession, TokenizedLabel import logging logger = logging.getLogger(__name__) # tell bottle where to look for templates # We use Mako templates (*.mako) that are in the templates/ directory in the package root. # There are also Handlebars (*.bars) templates in there, but those are rendered on the client-side. bottle.TEMPLATE_PATH.append(os.path.join(tweedr.root, 'templates')) # this is the primary export app = bottle.Bottle() # globals are messy, but we don't to retrain a tagger for every request logger.debug('initializing %s (training or loading CRF using defaults)', __name__) GLOBALS = dict(tagger=CRF.default(crf_feature_functions)) @app.get('/') def root(): redirect('/crf') @app.get('/crf') @view('crf.mako') def index(): # effectively static; all the fun stuff happens in the template return dict() @app.get('/tokenized_labels/sample')
import logging logger = logging.getLogger(__name__) # tell bottle where to look for templates # We use Mako templates (*.mako) that are in the templates/ directory in the package root. # There are also Handlebars (*.bars) templates in there, but those are rendered on the client-side. bottle.TEMPLATE_PATH.append(os.path.join(tweedr.root, "templates")) # this is the primary export app = bottle.Bottle() # globals are messy, but we don't to retrain a tagger for every request logger.debug("initializing %s (training or loading CRF using defaults)", __name__) GLOBALS = dict(tagger=CRF.default(crf_feature_functions)) @app.get("/") def root(): redirect("/crf") @app.get("/crf") @view("crf.mako") def index(): # effectively static; all the fun stuff happens in the template return dict() @app.get("/tokenized_labels/sample")