first commit
This commit is contained in:
commit
821c0f259e
|
@ -0,0 +1,24 @@
|
|||
.DS_Store
|
||||
.env
|
||||
.flaskenv
|
||||
*.pyc
|
||||
*.pyo
|
||||
env/
|
||||
env*
|
||||
dist/
|
||||
build/
|
||||
*.egg
|
||||
*.egg-info/
|
||||
_mailinglist
|
||||
.tox/
|
||||
.cache/
|
||||
.pytest_cache/
|
||||
.idea/
|
||||
docs/_build/
|
||||
.vscode
|
||||
|
||||
# Coverage reports
|
||||
htmlcov/
|
||||
.coverage
|
||||
.coverage.*
|
||||
*,cover
|
|
@ -0,0 +1,15 @@
|
|||
import distance
|
||||
from flask import request
|
||||
from flask_restful import Resource
|
||||
from stempel import StempelStemmer
|
||||
|
||||
stemmer = StempelStemmer.polimorf()
|
||||
|
||||
|
||||
class JaccardResource(Resource):
|
||||
|
||||
def post(self):
|
||||
request_json = request.get_json()
|
||||
str1 = stemmer.stem(request_json['str1'])
|
||||
str2 = stemmer.stem(request_json['str2'])
|
||||
return {"dist": distance.jaccard(str1, str2)}
|
|
@ -0,0 +1,13 @@
|
|||
from flask import Flask
|
||||
from flask_restful import Api
|
||||
from api.resources.Jaccard import JaccardResource
|
||||
|
||||
app = Flask(__name__)
|
||||
api = Api(app)
|
||||
|
||||
|
||||
api.add_resource(JaccardResource, '/stemmer-distance')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
|
@ -0,0 +1,4 @@
|
|||
Distance~=0.1.3
|
||||
Flask~=1.1.2
|
||||
flask_restful~=0.3.8
|
||||
pystempel~=1.1.0
|
Loading…
Reference in New Issue