unsupported language error
This commit is contained in:
parent
9acdeacafb
commit
427755d40b
@ -10,11 +10,11 @@ api = Api(app)
|
|||||||
|
|
||||||
|
|
||||||
lemmatizer = spacy.load('en', disable=['parser', 'ner'])
|
lemmatizer = spacy.load('en', disable=['parser', 'ner'])
|
||||||
app.logger.info("Lemmatizer initialized")
|
print("Lemmatizer initialized")
|
||||||
|
|
||||||
pickle_in = open("dictionaries/dict.pickle","rb")
|
pickle_in = open("dictionaries/dict.pickle","rb")
|
||||||
dictionary = pickle.load(pickle_in)
|
dictionary = pickle.load(pickle_in)
|
||||||
app.logger.info("Dictionary initialized")
|
print("Dictionary initialized")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@ class LemmatizerResource(Resource):
|
|||||||
return {'error':'Missing parameter: sentences'}, 400
|
return {'error':'Missing parameter: sentences'}, 400
|
||||||
|
|
||||||
language = json_data['language']
|
language = json_data['language']
|
||||||
|
if language not in ['pl', 'en']:
|
||||||
|
return {'error':'Unsupported language: %s' % language}, 400
|
||||||
|
|
||||||
|
|
||||||
sentences = []
|
sentences = []
|
||||||
for sentence in json_data['sentences']:
|
for sentence in json_data['sentences']:
|
||||||
|
Loading…
Reference in New Issue
Block a user