-
Notifications
You must be signed in to change notification settings - Fork 0
Api Documentation
Welcome to the Canworks wiki!
Args: 'text', type=to_unicode_or_bust, required=True, location="form" 'algorithm', type=str, required=True, location="form" Errors:
if not bool(text):
return {
"error": True,
"success": False,
"error_code": 101,
"messege": "Text field cannot be left empty"
}
if not bool(algorithm):
return {
"error": True,
"success": False,
"error_code": 302,
"messege": "Algorithm field cannot be left empty"}
Result: Form of result:
return {
"result": result,
"success": True,
"error": False,
"overall_sentiment": '%.2f'%ProcessingWithBlob.new_blob_polarity(to_unicode_or_bust(text)),
"noun_phrase": noun_phrase,}
Args: 'sentence', type=to_unicode_or_bust, required=True, location="form" 'tag', type=str, required=True, location="form" 'review_id', type=str, required=True, location="form" Errors: if not os.path.exists(path): return {"success": False, "error": True, "messege": "The tag {0} you mentioned doesnt exist in the learning model, ask admin to create this file".format(tag), "error_code": 201,
Result: } return {"success": True, "error": False, "messege": "The sentence --{0}-- with the changed tag --{1}-- with id --{2} has been uploaded".format(sentence, tag, review_id), }
Args: 'sentence', type=to_unicode_or_bust, required=True, location="form" 'is_error', type=str, required=True, location="form" 'review_id', type=str, required=True, location="form" 'error_messege', type=str, required=True, location="form" Errors: if int(error) != 2: return {"success": False, "error": True, "messege": "Only error sentences can be tagged, 'void' is an invalid tag", "error_code": 207, }
if not os.path.exists(path):
return {"success": False,
"error": True,
"messege": "some error occurred",
"error_code": 210,
}
Results: return {"success": True, "error": False, "messege": "The sentence --{0}-- with the error messege --{1}-- with id --{2} has been uploaded".format(sentence, error_messege, review_id), }
Args: 'sentence', type=str, required=True, location="form" 'is_error', type=str, required=True, location="form" 'review_id', type=str, required=True, location="form"
Errors: if int(error) != 3: return {"success": False, "error": True, "messege": "Only interjection sentences can be tagged, 'void' is an invalid tag", "error_code": 207,}
if not os.path.exists(path):
return {"success": False,
"error": True,
"messege": "File doenst exists for interjection",
"error_code": 210,}
Results: return {"success": True, "error": False, "messege": "The sentence --{0}-- with id --{1} has been uploaded for interjection erros".format(sentence, review_id), }
Args: 'sentence', type=str, required=True, location="form" 'option_value', type=str, required=True, location="form" 'option_text', type=str, required=True, location="form" 'review_id', type=str, required=True, location="form"
Errors: if int(option_value) != 2 and int(option_value) != 3: return {"success": False, "error": True, "messege": "Only repeated customer or recommended customer sentences can be tagged, 'void' is an invalid tag", "error_code": 206,}
if not os.path.exists(path):
return {"success": False,
"error": True,
"messege": "File for {0} doesnt exists in the backend, Please contact your asshole admin".format(option_text),
"error_code": 205,}
Results: return {"success": True, "error": False, "messege": "The sentence --{0}-- with review id --{1} has been uploaded for {2}".format(sentence, review_id, option_text), }
Args: 'city', type=str, required=True, location="form" Results: return {"success": False, "error": True, "result": result, }
Args: 'eatery_id', type=str, required=True, location="form" Results: return {"success": False, "error": True, "result": result, "classified_reviews": is_classified_reviews, "unclassified_reviews": not_classified_reviews, }
Args: 'review_id', type=str, required=True, location="form" Errors: if not reviews.find_one({'review_id': __id}): return {"success": False, "error": True, "messege": "The review doesnt exists", }
if reviews.find_one({'review_id': __id}).get("is_classified"):
return {"success": False,
"error": True,
"messege": "The reviews has already been marked classified, Please refresh the page",
}
Results: return {"success": True, "error": False, "messege": "The reviews has been marked classified", }
Args: 'review_id', type=str, required=True, location="form" Errors: if not reviews.find_one({'review_id': __id}): return {"success": False, "error": True, "messege": "The review doesnt exists", }
Results:
return {"success": True,
"error": False,
"result": result,
}
Args:
'sentence', type=str, required=True, location="form"
'grams', type=str, required=True, location="form"
Errors:
if not sentence:
return {"success": False,
"error": True,
"messege": "The text field cannot be left empty",
}
if not grams:
return {"success": False,
"error": True,
"messege": "The grams field cannot be left empty",
}
if grams == "void":
return {"success": False,
"error": True,
"messege": "The grams field cannot be equals to void",
}
Results: return {"success": True, "error": False, "result": nltk_ngrams(sentence, grams), }
Args: 'noun_phrase', type=str, required=True, location="form" 'review_id', type=str, required=True, location="form" 'sentence', type=str, required=True, location="form" Errors: if not reviews.find_one({'review_id': review_id}): return {"success": False, "error": True, "messege": "The review doesnt exists", }
if not noun_phrase:
return {"success": False,
"error": True,
"messege": "The Noun phrase field cannot be left empty",
}
Results:
return {"success": True,
"error": False,
"messege": "noun phrase --{0}-- for sentence --{1}-- with review id --<{2}>--has been uploaded".format(noun_phrase, sentence, review_id),
}
Args: None, Errors: None, Results: return {"success": True, "error": True, "result": result, }
Args: 'eatery_id', type=str, required=True, location="form" Errors: None Results: "success": True, "error": True, "result": {"start": "{0}-{1}-{2}".format(start_year, start_month, start_date), "end": "{0}-{1}-{2}".format(end_year, end_month, end_date)}, }
Args: 'eatery_id', type=str, required=True, location="form" 'category', type=str, required=True, location="form" 'start_date', type=str, required=True, location="form" 'end_date', type=str, required=True, location="form" Errors: None Results: return {"success": True, "error": True, "result": result }
Args: 'eatery_id', type=str, required=True, location="form" 'category', type=str, required=True, location="form" 'start_date', type=str, required=True, location="form" 'end_date', type=str, required=True, location="form" Errors: None, Results: return {"success": True, "error": True, "result": final_result[0:30], }
Args: 'text', type=to_unicode_or_bust, required=True, location="form" 'sentences_with_classification', type=to_unicode_or_bust, required=True, location="form", action="append") Errors: None, Results: return{ "result": result, "success": True, "error": False, }
Args: None, Errors: None, Results: None,