示例#1
0
def api_gensim_summarization():
   document = RequestService().get_parameter('document')
   try:
      ratio = float(request.args.get('ratio') if 'ratio' in request.args else '')
   except ValueError:
      ratio = 0.2
   try:
      word_count = int(request.args.get('word_count') if 'word_count' in request.args else '')
   except ValueError:
      word_count = None
   try:
      split = bool(request.args.get('split') if 'split' in request.args else 'True')
   except ValueError:
      split = True
   result = gensim.summarize(document=document, ratio=ratio, word_count=word_count, split=split)
   return jsonify(result)
示例#2
0
def api_textblob_language_detection():
    document = RequestService().get_parameter('document')
    result = textblob.detect_language(document=document)
    return jsonify(result)
示例#3
0
def api_vader_sentiment_analysis_nlp():
    document = RequestService().get_parameter('document')
    result = nltk.vader_sentiment_analysis(document=document)
    return jsonify(result)
示例#4
0
def api_textblob_spelling_correction():
    document = RequestService().get_parameter('document')
    result = textblob.spelling_correction(document=document)
    return jsonify(result)
示例#5
0
def api_textblob_translation():
    document = RequestService().get_parameter('document')
    language = RequestService().get_parameter('language')
    result = textblob.translate(document=document, language=language)
    return jsonify(result)
示例#6
0
def api_spacy_similarity():
    model = RequestService().get_parameter('model')
    document = RequestService().get_parameter('document')
    similarTo = RequestService().get_parameter('similarTo')
    result = spacy.similarity(model, document, similarTo)
    return jsonify(result)
示例#7
0
def api_textblob_nlp():
    document = RequestService().get_parameter('document')
    result = textblob.nlp(document=document)
    return jsonify(result)
示例#8
0
def api_allennlp_open_information_extraction():
   document = RequestService().get_parameter('document')
   model = allenNlp.open_information_extraction(document=document)
   return jsonify(model)
示例#9
0
def api_spacy():
    model = RequestService().get_parameter('model')
    document = RequestService().get_parameter('document')
    result = spacy.nlp(model, document)
    return jsonify(result)
示例#10
0
def api_allennlp_coreference_resolution():
   document = RequestService().get_parameter('document')
   model = allenNlp.coreference_resolution(document=document)
   return jsonify(model)
示例#11
0
def api_allennlp_dependency_parsing():
   document = RequestService().get_parameter('document')
   model = allenNlp.dependency_parsing(document=document)
   return jsonify(model)
示例#12
0
def api_allennlp_textual_entailment():
   document = RequestService().get_parameter('document')
   hypothesis = RequestService().get_parameter('hypothesis')
   model = allenNlp.textual_entailment(document=document, hypothesis=hypothesis)
   return jsonify(model)
示例#13
0
def api_allennlp_machine_comprehension():
   document = RequestService().get_parameter('document')
   question = RequestService().get_parameter('question')
   model = allenNlp.machine_comprehension(document=document, question=question)
   return jsonify(model)
示例#14
0
def api_allennlp_semantic_role_labeling():
   document = RequestService().get_parameter('document')
   model = allenNlp.semantic_role_labeling(document=document)
   return jsonify(model)
示例#15
0
def api_allennlp_named_entity_recognition():
   document = RequestService().get_parameter('document')
   model = allenNlp.named_entity_recognition(document=document)
   return jsonify(model)
示例#16
0
def api_allennlp_event2mind():
   document = RequestService().get_parameter('document')
   model = allenNlp.event2mind(document=document)
   return jsonify(model)