How to use the refextract.references.regexs.remove_year function in refextract

To help you get started, we’ve selected a few refextract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inspirehep / refextract / refextract / references / engine.py View on Github external
break

        if not year:
            for el in citation:
                m = re_year_in_misc_txt.search(el['misc_txt'])
                if m:
                    year = m.group(0)

        if year:
            citation.append({'type': 'YEAR',
                             'year': year,
                             'misc_txt': '',
                             })
            for el in citation:
                if year in el['misc_txt']:
                    el['misc_txt'] = remove_year(el['misc_txt'], year)

    return splitted_citations
github inspirehep / refextract / refextract / references / engine.py View on Github external
for author in re.findall('[a-zA-Z]{4,}', book_authors):
                        if find_substring_ignore_special_chars(citation_element['misc_txt'], author) != -1:
                            book_found = True

                    if book_found:
                        LOGGER.debug(u"Book found: %s", title)
                        book_element = {'type': 'BOOK',
                                        'misc_txt': '',
                                        'authors': book_authors,
                                        'title': line[1],
                                        'year': book_year}
                        citation.append(book_element)
                        citation_element['misc_txt'] = cut_substring_with_special_chars(citation_element['misc_txt'], title, startIndex)
                        # Remove year from misc txt
                        citation_element['misc_txt'] = remove_year(citation_element['misc_txt'], book_year)
                        return True

        LOGGER.debug("Book not found!")

    return False