无法访问获取URL的话传递的列表

问题描述:

如何从邮递员传递list以及如何访问多个属性无法访问获取URL的话传递的列表

@api.route('/Spacy/<input>/<texts>') 
class Spacy(Resource): 
    if input == pos: 
     def get(self, input): 
      ''' 
      Returns part-of speech. 
      ''' 
      doc = nlp(texts) 
      return [(word.text, word.lemma_, word.pos_) for word in doc] 
    elif input == verb: 
     def get(self, input): 
      ''' 
      Returns verbs and the stemmed verb. 
      ''' 
      doc = nlp(texts) 
      return [(word.text, word.lemma_) for word in doc if word.pos_ == "VERB"] 
    elif input == synonyms: 
     def get(self, input): 
      ''' 
      Returns the synonyms. 
      ''' 
      synonyms = wordnet.synsets(input) 
      lemmas = set(chain.from_iterable([word.lemma_names() for word in synonyms])) 
      return jsonify([syn.replace("_"," ") for syn in list(lemmas)]) 

我传递/spacy?input=verb,synonyms&text=flower 我应该如何接受它,并通过

我使用spacy太

你可以改变你的查询参数/spacy?input=verb&input=synonyms&text=flower代码。并使用request.args.getlist("input")获取input的列表值。

+0

你可以举一个例子,它会更有帮助 –