Exemplo n.º 1
0
def delete_Gensim_IndexSet():
    """after Indexing there might be no need to keep the indexed items   
    """

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

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

    """ @todo jsonify the result """
    return "deleting index ok\n"
Exemplo n.º 2
0
def Gensim_IndexSet():
    """
    start the indexing with formally done filled items
    """

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

    i = Indexing(training_id, db_location)
    i.commit_indexing_set()

    msg = {"msg": "indexing_ok"}
    return json.dumps(msg)
Exemplo n.º 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)
Exemplo n.º 4
0
def gensim_train_fillIndexingSet():
    """
    filling the index
    """
    if request.method == "POST":
        training_id = request.form["training_id"]
        document_text = request.form["document_text"]
        document_id = request.form["document_id"]
    if request.method == "GET":
        document_id = request.args.get("document_id", "0")
        training_id = request.args.get("training_id", "0")
        document_text = request.args.get("document_text", "0")

    q = Indexing(training_id, db_location)
    q.fill_indexing_set(document_text, document_id)

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