Search is not available for this dataset
text stringlengths 75 104k |
|---|
def group_list(self, params=None):
''' /v1/firewall/group_list
GET - account
List all firewall groups on the current account.
Link: https://www.vultr.com/api/#firewall_group_list
'''
params = params if params else dict()
return self.request('/v1/firewall/group_li... |
def info(self, params=None):
''' /v1/account/info
GET - account
Retrieve information about the current account
Link: https://www.vultr.com/api/#account_info
'''
params = params if params else dict()
return self.request('/v1/account/info', params, 'GET') |
def dump_info():
'''Shows various details about the account & servers'''
vultr = Vultr(API_KEY)
try:
logging.info('Listing account info:\n%s', dumps(
vultr.account.info(), indent=2
))
logging.info('Listing apps:\n%s', dumps(
vultr.app.list(), indent=2
... |
def availability(self, dcid, params=None):
''' /v1/regions/availability
GET - public
Retrieve a list of the VPSPLANIDs currently available
in this location. If your account has special plans available,
you will need to pass your api_key in in order to see them.
For all ot... |
def update_params(params, updates):
'''Merges updates into params'''
params = params.copy() if isinstance(params, dict) else dict()
params.update(updates)
return params |
def set_requests_per_second(self, req_per_second):
'''Adjusts the request/second at run-time'''
self.req_per_second = req_per_second
self.req_duration = 1 / self.req_per_second |
def _request_get_helper(self, url, params=None):
'''API GET request helper'''
if not isinstance(params, dict):
params = dict()
if self.api_key:
params['api_key'] = self.api_key
return requests.get(url, params=params, timeout=60) |
def _request_post_helper(self, url, params=None):
'''API POST helper'''
if self.api_key:
query = {'api_key': self.api_key}
return requests.post(url, params=query, data=params, timeout=60) |
def _request_helper(self, url, params, method):
'''API request helper method'''
try:
if method == 'POST':
return self._request_post_helper(url, params)
elif method == 'GET':
return self._request_get_helper(url, params)
raise VultrError(... |
def request(self, path, params=None, method='GET'):
'''API request / call method'''
_start = time.time()
if not path.startswith('/'):
path = '/' + path
resp = self._request_helper(self.api_endpoint + path, params, method)
if resp.status_code != 200:
if ... |
def create(self, subid, params=None):
''' /v1/snapshot/create
POST - account
Create a snapshot from an existing virtual machine.
The virtual machine does not need to be stopped.
Link: https://www.vultr.com/api/#snapshot_create
'''
params = update_params(params, {... |
def destroy(self, snapshotid, params=None):
''' /v1/snapshot/destroy
POST - account
Destroy (delete) a snapshot. There is no going
back from this call.
Link: https://www.vultr.com/api/#snapshot_destroy
'''
params = update_params(params, {'SNAPSHOTID': snapshotid}... |
def destroy(self, subid, ipaddr, params=None):
''' /v1/server/destroy_ipv4
POST - account
Removes a secondary IPv4 address from a server. Your server will be
hard-restarted. We suggest halting the machine gracefully before
removing IPs.
Link: https://www.vultr.com/api/#s... |
def list(self, subid, params=None):
''' /v1/server/list_ipv4
GET - account
List the IPv4 information of a virtual machine. IP information is only
available for virtual machines in the "active" state.
Link: https://www.vultr.com/api/#server_list_ipv4
'''
params = ... |
def reverse_default(self, subid, ipaddr, params=None):
''' /v1/server/reverse_default_ipv4
POST - account
Set a reverse DNS entry for an IPv4 address of a virtual
machine to the original setting. Upon success, DNS changes
may take 6-12 hours to become active.
Link: https... |
def reverse_set(self, subid, ipaddr, entry, params=None):
''' /v1/server/reverse_set_ipv4
POST - account
Set a reverse DNS entry for an IPv4 address of a virtual machine. Upon
success, DNS changes may take 6-12 hours to become active.
Link: https://www.vultr.com/api/#server_reve... |
def bandwidth(self, subid, params=None):
''' /v1/server/bandwidth
GET - account
Get the bandwidth used by a virtual machine
Link: https://www.vultr.com/api/#server_bandwidth
'''
params = update_params(params, {'SUBID': subid})
return self.request('/v1/server/band... |
def create(self, dcid, vpsplanid, osid, params=None):
''' /v1/server/create
POST - account
Create a new virtual machine. You will start being billed for this
immediately. The response only contains the SUBID for the new machine.
You should use v1/server/list to poll and wait for ... |
def get_user_data(self, subid, params=None):
''' /v1/server/get_user_data
GET - account
Retrieves the (base64 encoded) user-data for this subscription.
Link: https://www.vultr.com/api/#server_get_user_data
'''
params = update_params(params, {'SUBID': subid})
retu... |
def halt(self, subid, params=None):
''' /v1/server/halt
POST - account
Halt a virtual machine. This is a hard power off (basically, unplugging
the machine). The data on the machine will not be modified, and you
will still be billed for the machine. To completely delete a
... |
def label_set(self, subid, label, params=None):
''' /v1/server/label_set
POST - account
Set the label of a virtual machine.
Link: https://www.vultr.com/api/#server_label_set
'''
params = update_params(params, {
'SUBID': subid,
'label': label
... |
def neighbors(self, subid, params=None):
''' v1/server/neighbors
GET - account
Determine what other subscriptions are hosted on the same physical
host as a given subscription.
Link: https://www.vultr.com/api/#server_neighbors
'''
params = update_params(params, {'... |
def os_change(self, subid, osid, params=None):
''' /v1/server/os_change
POST - account
Changes the operating system of a virtual machine. All data will be
permanently lost.
Link: https://www.vultr.com/api/#server_os_change
'''
params = update_params(params, {
... |
def os_change_list(self, subid, params=None):
''' /v1/server/os_change_list
GET - account
Retrieves a list of operating systems to which this server can be
changed.
Link: https://www.vultr.com/api/#server_os_change_list
'''
params = update_params(params, {'SUBID'... |
def reboot(self, subid, params=None):
''' /v1/server/reboot
POST - account
Reboot a virtual machine. This is a hard reboot
(basically, unplugging the machine).
Link: https://www.vultr.com/api/#server_reboot
'''
params = update_params(params, {'SUBID': subid})
... |
def reinstall(self, subid, params=None):
''' /v1/server/reinstall
POST - account
Reinstall the operating system on a virtual machine. All data
will be permanently lost, but the IP address will remain the
same There is no going back from this call.
Link: https://www.vultr... |
def restore_backup(self, subid, backupid, params=None):
''' /v1/server/restore_backup
POST - account
Restore the specified backup to the virtual machine. Any data
already on the virtual machine will be lost.
Link: https://www.vultr.com/api/#server_restore_backup
'''
... |
def restore_snapshot(self, subid, snapshotid, params=None):
''' /v1/server/restore_snapshot
POST - account
Restore the specificed snapshot to the virtual machine.
Any data already on the virtual machine will be lost.
Link: https://www.vultr.com/api/#server_restore_snapshot
... |
def set_user_data(self, subid, userdata, params=None):
''' /v1/server/set_user_data
POST - account
Sets the cloud-init user-data (base64) for this subscription.
Note that user-data is not supported on every operating
system, and is generally only provided on instance startup.
... |
def start(self, subid, params=None):
''' /v1/server/start
POST - account
Start a virtual machine. If the machine is already
running, it will be restarted.
Link: https://www.vultr.com/api/#server_start
'''
params = update_params(params, {'SUBID': subid})
r... |
def upgrade_plan(self, subid, vpsplanid, params=None):
''' /v1/server/upgrade_plan
POST - account
Upgrade the plan of a virtual machine. The virtual machine will be
rebooted upon a successful upgrade.
Link: https://www.vultr.com/api/#server_upgrade_plan
'''
param... |
def upgrade_plan_list(self, subid, params=None):
''' /v1/server/upgrade_plan_list
GET - account
Retrieve a list of the VPSPLANIDs for which a virtual machine
can be upgraded. An empty response array means that there are
currently no upgrades available.
Link: https://www.... |
def create(self, name, ssh_key, params=None):
''' /v1/sshkey/create
POST - account
Create a new SSH Key
Link: https://www.vultr.com/api/#sshkey_create
'''
params = update_params(params, {
'name': name,
'ssh_key': ssh_key
})
return ... |
def destroy(self, sshkeyid, params=None):
''' /v1/sshkey/destroy
POST - account
Remove a SSH key. Note that this will not remove
the key from any machines that already have it.
Link: https://www.vultr.com/api/#sshkey_destroy
'''
params = update_params(params, {'S... |
def list(self, params=None):
''' /v1/sshkey/list
GET - account
List all the SSH keys on the current account
Link: https://www.vultr.com/api/#sshkey_list
'''
params = params if params else dict()
return self.request('/v1/sshkey/list', params, 'GET') |
def update(self, sshkeyid, params=None):
''' /v1/sshkey/update
POST - account
Update an existing SSH Key. Note that this will only
update newly installed machines. The key will not be
updated on any existing machines.
Link: https://www.vultr.com/api/#sshkey_update
... |
def create_from_url(self, url, params=None):
''' /vi/iso/create_from_url
POST - account
Create a new ISO image on the current account.
The ISO image will be downloaded from a given URL.
Download status can be checked with the v1/iso/list call.
Link: https://www.vultr.com... |
def list_ipv6(self, subid, params=None):
''' /v1/server/list_ipv6
GET - account
List the IPv6 information of a virtual machine. IP information is only
available for virtual machines in the "active" state. If the virtual
machine does not have IPv6 enabled, then an empty array is r... |
def reverse_delete_ipv6(self, subid, ipaddr, params=None):
''' /v1/server/reverse_delete_ipv6
POST - account
Remove a reverse DNS entry for an IPv6 address of a virtual machine.
Upon success, DNS changes may take 6-12 hours to become active.
Link: https://www.vultr.com/api/#serv... |
def reverse_list_ipv6(self, subid, params=None):
''' /v1/server/reverse_list_ipv6
GET - account
List the IPv6 reverse DNS entries of a virtual machine. Reverse DNS
entries are only available for virtual machines in the "active" state.
If the virtual machine does not have IPv6 ena... |
def reverse_set_ipv6(self, subid, ipaddr, entry, params=None):
''' /v1/server/reverse_set_ipv6
POST - account
Set a reverse DNS entry for an IPv6 address of a virtual machine. Upon
success, DNS changes may take 6-12 hours to become active.
Link: https://www.vultr.com/api/#server... |
def create(self, name, script, params=None):
''' /v1/startupscript/create
POST - account
Create a startup script
Link: https://www.vultr.com/api/#startupscript_create
'''
params = update_params(params, {
'name': name,
'script': script
})
... |
def destroy(self, scriptid, params=None):
''' /v1/startupscript/destroy
POST - account
Remove a startup script
Link: https://www.vultr.com/api/#startupscript_destroy
'''
params = update_params(params, {'SCRIPTID': scriptid})
return self.request('/v1/startupscript... |
def update(self, scriptid, params=None):
''' /v1/startupscript/update
POST - account
Update an existing startup script
Link: https://www.vultr.com/api/#startupscript_update
'''
params = update_params(params, {'SCRIPTID': scriptid})
return self.request('/v1/startu... |
def halt_running():
'''Halts all running servers'''
vultr = Vultr(API_KEY)
try:
serverList = vultr.server.list()
#logging.info('Listing servers:\n%s', dumps(
#serverList, indent=2
#))
except VultrError as ex:
logging.error('VultrError: %s', ex)
f... |
def create(self, dcid, ip_type, params=None):
''' /v1/reservedip/create
POST - account
Create a new reserved IP. Reserved IPs can only be used within the
same datacenter for which they were created.
Link: https://www.vultr.com/api/#reservedip_create
'''
params = ... |
def process_reference_line(working_line,
journals_matches,
pprint_repnum_len,
pprint_repnum_matchtext,
publishers_matches,
removed_spaces,
standardised_titles... |
def tag_arxiv(line):
"""Tag arxiv report numbers
We handle arXiv in 2 ways:
* starting with arXiv:1022.1111
* this format exactly 9999.9999
We also format the output to the standard arxiv notation:
* arXiv:2007.12.1111
* arXiv:2007.12.1111v2
"""
def tagger(match):
groups = m... |
def tag_arxiv_more(line):
"""Tag old arxiv report numbers
Either formats:
* hep-th/1234567
* arXiv:1022111 [hep-ph] which transforms to hep-ph/1022111
"""
line = RE_ARXIV_CATCHUP.sub(ur"\g<suffix>/\g<year>\g<month>\g<num>", line)
for report_re, report_repl in RE_OLD_ARXIV:
report_n... |
def tag_pos_volume(line):
"""Tag POS volume number
POS is journal that has special volume numbers
e.g. PoS LAT2007 (2007) 369
"""
def tagger(match):
groups = match.groupdict()
try:
year = match.group('year')
except IndexError:
# Extract year from volu... |
def find_numeration_more(line):
"""Look for other numeration in line."""
# First, attempt to use marked-up titles
patterns = (
re_correct_numeration_2nd_try_ptn1,
re_correct_numeration_2nd_try_ptn2,
re_correct_numeration_2nd_try_ptn3,
re_correct_numeration_2nd_try_ptn4,
)... |
def add_tagged_report_number(reading_line,
len_reportnum,
reportnum,
startpos,
true_replacement_index,
extras):
"""In rebuilding the line, add an identified institutional ... |
def add_tagged_journal(reading_line,
journal_info,
previous_match,
startpos,
true_replacement_index,
extras,
standardised_titles):
"""In rebuilding the line, add an identified pe... |
def add_tagged_publisher(reading_line,
matched_publisher,
startpos,
true_replacement_index,
extras,
kb_publishers):
"""In rebuilding the line, add an identified periodical TITLE (standardised... |
def get_replacement_types(titles, reportnumbers, publishers):
"""Given the indices of the titles and reportnumbers that have been
recognised within a reference line, create a dictionary keyed by
the replacement position in the line, where the value for each
key is a string describing the type o... |
def account_for_stripped_whitespace(spaces_keys,
removed_spaces,
replacement_types,
len_reportnums,
journals_matches,
replacement_index):
... |
def identify_and_tag_collaborations(line, collaborations_kb):
"""Given a line where Authors have been tagged, and all other tags
and content has been replaced with underscores, go through and try
to identify extra items of data which should be placed into 'h'
subfields.
Later on, these t... |
def identify_and_tag_authors(line, authors_kb):
"""Given a reference, look for a group of author names,
place tags around the author group, return the newly tagged line.
"""
re_auth, re_auth_near_miss = get_author_regexps()
# Replace authors which do not convert well from utf-8
for pattern, ... |
def sum_2_dictionaries(dicta, dictb):
"""Given two dictionaries of totals, where each total refers to a key
in the dictionary, add the totals.
E.g.: dicta = { 'a' : 3, 'b' : 1 }
dictb = { 'a' : 1, 'c' : 5 }
dicta + dictb = { 'a' : 4, 'b' : 1, 'c' : 5 }
@param dicta:... |
def identify_ibids(line):
"""Find IBIDs within the line, record their position and length,
and replace them with underscores.
@param line: (string) the working reference line
@return: (tuple) containing 2 dictionaries and a string:
Dictionary: matched IBID text: (Key: position of IBI... |
def find_numeration(line):
"""Given a reference line, attempt to locate instances of citation
'numeration' in the line.
@param line: (string) the reference line.
@return: (string) the reference line after numeration has been checked
and possibly recognized/marked-up.
"""
pattern... |
def identify_journals(line, kb_journals):
"""Attempt to identify all periodical titles in a reference line.
Titles will be identified, their information (location in line,
length in line, and non-standardised version) will be recorded,
and they will be replaced in the working line by underscore... |
def identify_report_numbers(line, kb_reports):
"""Attempt to identify all preprint report numbers in a reference
line.
Report numbers will be identified, their information (location
in line, length in line, and standardised replacement version)
will be recorded, and they will be replaced... |
def identify_and_tag_URLs(line):
"""Given a reference line, identify URLs in the line, record the
information about them, and replace them with a "<cds.URL />" tag.
URLs are identified in 2 forms:
+ Raw: http://invenio-software.org/
+ HTML marked-up: <a href="http://invenio-software.or... |
def identify_and_tag_DOI(line):
"""takes a single citation line and attempts to locate any DOI references.
DOI references are recognised in both http (url) format and also the
standard DOI notation (DOI: ...)
@param line: (string) the reference line in which to search for DOI's.
@return:... |
def remove_reference_line_marker(line):
"""Trim a reference line's 'marker' from the beginning of the line.
@param line: (string) - the reference line.
@return: (tuple) containing two strings:
+ The reference line's marker (or if there was not one,
a 'space' charact... |
def roman2arabic(num):
"""Convert numbers from roman to arabic
This function expects a string like XXII
and outputs an integer
"""
t = 0
p = 0
for r in num:
n = 10 ** (205558 % ord(r) % 7) % 9995
t += n - 2 * p % n
p = n
return t |
def format_volume(citation_elements):
"""format volume number (roman numbers to arabic)
When the volume number is expressed in roman numbers (CXXII),
they are converted to their equivalent in arabic numbers (42)
"""
re_roman = re.compile(re_roman_numbers + u'$', re.UNICODE)
for el in citation_e... |
def handle_special_journals(citation_elements, kbs):
"""format special journals (like JHEP) volume number
JHEP needs the volume number prefixed with the year
e.g. JHEP 0301 instead of JHEP 01
"""
for el in citation_elements:
if el['type'] == 'JOURNAL' and el['title'] in kbs['special_journal... |
def format_report_number(citation_elements):
"""Format report numbers that are missing a dash
e.g. CERN-LCHH2003-01 to CERN-LHCC-2003-01
"""
re_report = re.compile(ur'^(?P<name>[A-Z-]+)(?P<nums>[\d-]+)$', re.UNICODE)
for el in citation_elements:
if el['type'] == 'REPORTNUMBER':
... |
def format_hep(citation_elements):
"""Format hep-th report numbers with a dash
e.g. replaces hep-th-9711200 with hep-th/9711200
"""
prefixes = ('astro-ph-', 'hep-th-', 'hep-ph-', 'hep-ex-', 'hep-lat-',
'math-ph-')
for el in citation_elements:
if el['type'] == 'REPORTNUMBER':... |
def format_author_ed(citation_elements):
"""Standardise to (ed.) and (eds.)
e.g. Remove extra space in (ed. )
"""
for el in citation_elements:
if el['type'] == 'AUTH':
el['auth_txt'] = el['auth_txt'].replace('(ed. )', '(ed.)')
el['auth_txt'] = el['auth_txt'].replace('(ed... |
def look_for_books(citation_elements, kbs):
"""Look for books in our kb
Create book tags by using the authors and the title to find books
in our knowledge base
"""
title = None
for el in citation_elements:
if el['type'] == 'QUOTED':
title = el
break
if title... |
def split_volume_from_journal(citation_elements):
"""Split volume from journal title
We need this because sometimes the volume is attached to the journal title
instead of the volume. In those cases we move it here from the title to the
volume
"""
for el in citation_elements:
if el['type... |
def remove_b_for_nucl_phys(citation_elements):
"""Removes b from the volume of some journals
Removes the B from the volume for Nucl.Phys.Proc.Suppl. because in INSPIRE
that journal is handled differently.
"""
for el in citation_elements:
if el['type'] == 'JOURNAL' and el['title'] == 'Nucl.P... |
def mangle_volume(citation_elements):
"""Make sure the volume letter is before the volume number
e.g. transforms 100B to B100
"""
volume_re = re.compile(ur"(\d+)([A-Z])", re.U | re.I)
for el in citation_elements:
if el['type'] == 'JOURNAL':
matches = volume_re.match(el['volume']... |
def split_citations(citation_elements):
"""Split a citation line in multiple citations
We handle the case where the author has put 2 citations in the same line
but split with ; or some other method.
"""
splitted_citations = []
new_elements = []
current_recid = None
current_doi = None
... |
def look_for_hdl(citation_elements):
"""Looks for handle identifiers in the misc txt of the citation elements
When finding an hdl, creates a new HDL element.
@param citation_elements: (list) elements to process
"""
for el in list(citation_elements):
matched_hdl = re_hdl.finditer(el['m... |
def look_for_hdl_urls(citation_elements):
"""Looks for handle identifiers that have already been identified as urls
When finding an hdl, creates a new HDL element.
@param citation_elements: (list) elements to process
"""
for el in citation_elements:
if el['type'] == 'URL':
... |
def parse_reference_line(ref_line, kbs, bad_titles_count={}, linker_callback=None):
"""Parse one reference line
@input a string representing a single reference bullet
@output parsed references (a list of elements objects)
"""
# Strip the 'marker' (e.g. [1]) from this reference line:
line_marker... |
def search_for_book_in_misc(citation, kbs):
"""Searches for books in the misc_txt field if the citation is not recognized as anything like a journal, book, etc.
"""
citation_year = year_from_citation(citation)
for citation_element in citation:
LOGGER.debug(u"Searching for book title in: %s", cit... |
def parse_references_elements(ref_sect, kbs, linker_callback=None):
"""Passed a complete reference section, process each line and attempt to
## identify and standardise individual citations within the line.
@param ref_sect: (list) of strings - each string in the list is a
reference line.
... |
def parse_tagged_reference_line(line_marker,
line,
identified_dois,
identified_urls):
""" Given a single tagged reference line, convert it to its MARC-XML representation.
Try to find all tags and extract their co... |
def map_tag_to_subfield(tag_type, line, cur_misc_txt, dest):
"""Create a new reference element"""
closing_tag = '</cds.%s>' % tag_type
# extract the institutional report-number from the line:
idx_closing_tag = line.find(closing_tag)
# Sanity check - did we find a closing tag?
if idx_closing_tag ... |
def convert_unusable_tag_to_misc(line,
misc_text,
tag_match_end,
closing_tag):
"""Function to remove an unwanted, tagged, citation item from a reference
line. The tagged item itself is put into the miscellaneou... |
def remove_leading_garbage_lines_from_reference_section(ref_sectn):
"""Sometimes, the first lines of the extracted references are completely
blank or email addresses. These must be removed as they are not
references.
@param ref_sectn: (list) of strings - the reference section lines
@retu... |
def get_plaintext_document_body(fpath, keep_layout=False):
"""Given a file-path to a full-text, return a list of unicode strings
whereby each string is a line of the fulltext.
In the case of a plain-text document, this simply means reading the
contents in from the file. In the case of a PDF how... |
def parse_references(reference_lines,
recid=None,
override_kbs_files=None,
reference_format=u"{title} {volume} ({year}) {page}",
linker_callback=None):
"""Parse a list of references
Given a list of raw reference lines (list of ... |
def build_stats(counts):
"""Return stats information from counts structure."""
stats = {
'status': 0,
'reportnum': counts['reportnum'],
'title': counts['title'],
'author': counts['auth_group'],
'url': counts['url'],
'doi': counts['doi'],
'misc': counts['mi... |
def replace_undesirable_characters(line):
"""
Replace certain bad characters in a text line.
@param line: (string) the text line in which bad characters are to
be replaced.
@return: (string) the text line after the bad characters have been
replaced.
"""
# T... |
def convert_PDF_to_plaintext(fpath, keep_layout=False):
""" Convert PDF to txt using pdftotext
Take the path to a PDF file and run pdftotext for this file, capturing
the output.
@param fpath: (string) path to the PDF file
@return: (list) of unicode strings (contents of the PDF file translated
i... |
def get_author_affiliation_numeration_str(punct=None):
"""The numeration which can be applied to author names. Numeration
is sometimes found next to authors of papers.
@return: (string), which can be compiled into a regex; identifies
numeration next to an author name.
"""
# FIXME cater for star... |
def get_initial_surname_author_pattern(incl_numeration=False):
"""Match an author name of the form: 'initial(s) surname'
Return a standard author, with a maximum of 6 initials, and a surname.
The author pattern returned will match 'Initials Surname' formats only.
The Initials MUST be uppercase, and MUS... |
def get_surname_initial_author_pattern(incl_numeration=False):
"""Match an author name of the form: 'surname initial(s)'
This is sometimes the represention of the first author found inside an author group.
This author pattern is only used to find a maximum of ONE author inside an author group.
Authors ... |
def make_auth_regex_str(etal, initial_surname_author=None, surname_initial_author=None):
"""
Returns a regular expression to be used to identify groups of author names in a citation.
This method contains patterns for default authors, so no arguments are needed for the
most reliable form of m... |
def make_collaborations_regex_str():
""" From the authors knowledge-base, construct a single regex holding the or'd possibilities of patterns
which should be included in $h subfields. The word 'Collaboration' is also converted to 'Coll', and
used in finding matches. Letter case is not considered during the ... |
def find_reference_section(docbody):
"""Search in document body for its reference section.
More precisely, find
the first line of the reference section. Effectively, the function starts
at the end of a document and works backwards, line-by-line, looking for
the title of a reference section. It stop... |
def find_numeration(docbody, title):
"""Find numeration pattern
1st try to find numeration in the title
e.g.
References [4] Riotto...
2nd find the numeration alone in the line after the title
e.g.
References
1
Riotto
3rnd find the numeration in the following line
e.g.
... |
def find_reference_section_no_title_generic(docbody, marker_patterns):
"""This function would generally be used when it was not possible to locate
the start of a document's reference section by means of its title.
Instead, this function will look for reference lines that have numeric
markers of... |
def extract_references_from_fulltext(fulltext):
"""Locate and extract the reference section from a fulltext document.
Return the extracted reference section as a list of strings, whereby each
string in the list is considered to be a single reference line.
E.g. a string could be something like:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.