示例#1
0
文件: nlp.py 项目: Priya22/tweedr
 def __init__(self):
     self.crf = CRF.default(self.feature_functions)
     logger.info('SequenceTagger initialized')
示例#2
0
def tagger_retrain():
    GLOBALS['tagger'] = CRF.default(crf_feature_functions, retrain=True)
    return dict(success=True)
示例#3
0
文件: crf.py 项目: Priya22/tweedr
def tagger_retrain():
    GLOBALS["tagger"] = CRF.default(crf_feature_functions, retrain=True)
    return dict(success=True)
示例#4
0
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')
示例#5
0
文件: crf.py 项目: Priya22/tweedr
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")