Demo entry 6783221

test

   

Submitted by anonymous on Feb 03, 2019 at 10:04
Language: Python. Code size: 690 Bytes.

from flask import Flask, request
import urllib2

app = Flask(__name__)
@app.route('/parser', methods=['GET'])
def result():
    question_quoted = request.args.get("question")
    question = urllib2.unquote(question_quoted)
    print(question)
    
    # You semantic parser goes here, it converts a question into a MRL
    # E.g. "How many hospitals are there in Heidelberg" is turned into
    # "query(area(keyval('name','Heidelberg')),nwr(keyval('amenity','hospital')),qtype(count))"
    mrl = "query(area(keyval('name','Heidelberg')),nwr(keyval('amenity','hospital')),qtype(count))"
    # Simply return the MRL and the web service will handle the rest
    
    return mrl

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).