16 lines
401 B
Python
16 lines
401 B
Python
|
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)}
|