Example #1
0
def classify_file(file_path, expected_classification):
  failures = set()
  success_count = 0
  total_items = 0
  for line in lines(file_path):
    classification = twss_classifier.classify(line)
    if classification == expected_classification: success_count += 1
    else: failures.add(line)
    total_items += 1
  
  print "Expected classification: " + expected_classification
  print "Success rate: " + str((100.0 * success_count) / total_items) + "%"
  print "Failures: "
  for failure in failures: print "\t" + failure
Example #2
0
def classify():
	query = request.args.get('q', 0, type=str)
	return jsonify(result = twss_classifier.classify(query))
Example #3
0
def classify():
    query = request.args.get('q', 0, type=str)
    return jsonify(result=twss_classifier.classify(query))