def _get_art_context(record): abstract = get_abstract(record) try: abstract_language = detect(abstract) except LangDetectException: abstract_language = '' return { 'abstract': abstract, 'abstract_language': abstract_language, 'arxiv_id': get_arxiv_id(record), 'authors': get_authors(record), 'collaborations': get_collaborations(record), 'divulgation': get_divulgation(record), 'doi': get_doi(record), 'domains': get_domains(record), 'inspire_id': get_inspire_id(record), 'journal_issue': get_journal_issue(record), 'journal_title': get_journal_title(record), 'journal_volume': get_journal_volume(record), 'keywords': get_keywords(record), 'language': get_language(record), 'page_artid': get_page_artid(record), 'peer_reviewed': get_peer_reviewed(record), 'publication_date': get_publication_date(record), 'subtitle': get_subtitle(record), 'title': get_title(record), }
def _build_publication(record): return { 'abstract': get_abstract(record), 'authors': _get_authors(record), 'collaborations': get_collaborations(record), 'keywords': get_keywords(record), 'publication_id': record['control_number'], 'title': get_title(record), 'topics': get_inspire_categories(record), }
def test_get_keywords(): schema = load_schema('hep') subschema = schema['properties']['keywords'] record = { 'keywords': [ { 'schema': 'INSPIRE', 'value': 'CKM matrix', }, ], } assert validate(record['keywords'], subschema) is None expected = ['CKM matrix'] result = get_keywords(record) assert expected == result
def _get_preprint_context(record): abstract = get_abstract(record) try: abstract_language = detect(abstract) except LangDetectException: abstract_language = '' return { 'abstract': abstract, 'abstract_language': abstract_language, 'arxiv_id': get_arxiv_id(record), 'authors': get_authors(record), 'collaborations': get_collaborations(record), 'divulgation': get_divulgation(record), 'domains': get_domains(record), 'inspire_id': get_inspire_id(record), 'keywords': get_keywords(record), 'language': get_language(record), 'subtitle': get_subtitle(record), 'title': get_title(record), }