def analyze(ask_id): ask = models.Ask.query.get(ask_id) text = ask.question.title + ' ' + ask.question.text result = match_text_for_mandate(ask.mandate, text) ask.match.data = flask.json.dumps(result) ask.match.score = len(result['top_matches']) models.db.session.commit()
def analyze_sponsorship(sponsorship_id): sponsorship = models.Sponsorship.query.get(sponsorship_id) proposal = sponsorship.proposal text = proposal.title + ' ' + proposal.text result = match_text_for_mandate(sponsorship.mandate, text) sponsorship.match.data = flask.json.dumps(result) sponsorship.match.score = len(result['top_matches']) models.db.session.commit()
def analyze(ask_id): ask = models.Ask.query.get(ask_id) text = ask.question.title + ' ' + ask.question.text result = match_text_for_mandate(ask.mandate, text) ask.match.data = flask.json.dumps(result) if not ask.match.manual: ask.match.score = ask.match.get_score_from_data() models.db.session.commit()
def analyze_sponsorship(sponsorship_id): sponsorship = models.Sponsorship.query.get(sponsorship_id) proposal = sponsorship.proposal text = proposal.title + ' ' + proposal.text result = match_text_for_mandate(sponsorship.mandate, text) sponsorship.match.data = flask.json.dumps(result) if not sponsorship.match.manual: sponsorship.match.score = ask.match.get_score_from_data() models.db.session.commit()