Пример #1
0
def delete_Gensim_TrainingSet():
    """after Indexing there might be no need to keep the indexed   
    """

    if request.method == "GET":
        training_id = request.args.get("training_id", "0")
    if request.method == "POST":
        training_id = request.form["training_id"]

    i = Training(training_id, db_location)
    i.delete_set()

    """ @todo: jsonify the result """
    return "deleting training cache ok\n"
Пример #2
0
def gensim_train_fillTrainingSet():

    if request.method == "GET":
        document_text = request.args.get("document_text", "0")
        document_id = request.args.get("document_id", "0")
        training_id = request.args.get("training_id", "0")
    if request.method == "POST":
        document_text = request.form["document_text"]
        document_id = request.form["document_id"]
        training_id = request.form["training_id"]

    t = Training(training_id, db_location)
    t.fill_training_set(document_text, document_id)

    msg = {"msg": "fill_ok"}
    return json.dumps(msg)
Пример #3
0
def initGensimTrainingSet():
    """now the complicated stuff begins
    This is function is supposed to take the initial steps like allocation space for the model etc
    parameters: id=string  
    """
    if request.method == "POST":
        id = request.form["training_id"]
    if request.method == "GET":
        id = request.args.get("training_id", "1", type=int)

    t = Training(training_id=id, db_location=db_location)
    result = t.init_training_set()

    i = Indexing(id, db_location)
    i.init_indexing_set()

    """ @todo jsonify the result """
    return str(result)
Пример #4
0
def train_Gensim_TrainingSet():
    """
    This function is supposed to make it possible to train the classifier with your own 
    documents. I.E. after the clickabilly main server pushed 1000 known documents into this
    then call the startGensimTraining() function. This will train the gensim model
    A Wikipedia training should be possible as well where the training Set is already installed
    parameters: document=<string>,  
    """

    if request.method == "GET":
        training_id = request.args.get("training_id", "0")
    if request.method == "POST":
        training_id = request.form["training_id"]

    t = Training(training_id, db_location)
    t.commit_training_set()

    msg = {"msg": "training_ok"}
    return json.dumps(msg)