def get_author_year_score_for_input_fields(result_record, hypothesis): """ returns evidences based on just author and year. For most sources, you should rather use get_basic_score_for_input_fields -- see there for more information. :param result_record: :param hypothesis: :return: """ input_fields = hypothesis.get_detail('input_fields') evidences = Evidences() normalized_authors = hypothesis.get_detail('normalized_authors') if normalized_authors is None: normalized_authors = normalize_author_list( input_fields.get('author', '')) add_author_evidence(evidences, normalized_authors, result_record['author_norm'], result_record['first_author_norm'], has_etal=hypothesis.get_detail('has_etal')) add_year_evidence(evidences, input_fields.get('year'), result_record.get('year')) return evidences
def get_author_year_score_for_input_fields(result_record, hypothesis): """ returns evidences based on just author and year. :param result_record: :param hypothesis: :return: """ input_fields = hypothesis.get_detail('input_fields') normalized_authors = hypothesis.get_detail('normalized_authors') if normalized_authors is None: normalized_authors = normalize_author_list( input_fields.get('author', '')) evidences = Evidences() add_author_evidence(evidences, normalized_authors, result_record['author_norm'], result_record['first_author_norm'], has_etal=hypothesis.get_detail('has_etal')) add_year_evidence(evidences, input_fields.get('year'), result_record.get('year')) return evidences
def get_score_for_baas_match(result_record, hypothesis): """ scores a BAAS->DDA match. For these, volume and page are hidden deep inside pub_raw. We also expect an expected_bibstem detail in the hypothesis, mainly for robustness in case this gets used to score something else. :param result_record: :param hypothesis: :return: """ evidences = Evidences() if not re.match(r'....%s' % hypothesis.get_detail('expected_bibstem'), result_record['bibcode']): evidences.add_evidence(current_app.config['EVIDENCE_SCORE_RANGE'][0], 'no DDA bibcode') return evidences input_fields = hypothesis.get_detail('input_fields') normalized_authors = hypothesis.get_detail('normalized_authors') if normalized_authors is None: normalized_authors = normalize_author_list( input_fields.get('author', '')) add_author_evidence(evidences, normalized_authors, result_record['author_norm'], result_record['first_author_norm']) add_boolean_evidence( evidences, 'Vol. %s' % input_fields['volume'] in result_record['pub_raw'], 'vol in pub_raw?') add_boolean_evidence( evidences, re.search(r'p\.\s*%s\b' % input_fields['page'], result_record['pub_raw']), 'page in pub_raw?') return evidences