Parse RIS files into dictionaries and providetheme via generator.
Project description
It reads RIS files and provides Python dictionaries via a generator. This works also for very larg ris files.
Usage
>>> import os >>> from RISparser import readris >>> from pprint import pprint >>> filepath = 'tests/example_full.ris' >>> entries = readris(filepath) >>> for entry in entries: ... pprint(entry) {'A1': ['Marx, Karl', 'Lindgren, Astrid', 'Glattauer, Daniel'], 'CY': 'United States', 'ID': '12345', 'IS': '3', 'JA': 'lorem', 'JF': 'Lorem', 'KW': ['Pippi', 'Nordwind', 'Piraten'], 'L2': 'http://example.com', 'M1': '1008150341', 'N2': 'BACKGROUND: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.', 'PB': ['Fun Factory', 'Fun Factory USA'], 'SN': '1932-6208', 'SP': 'e0815', 'T1': 'Title of reference', 'TY': 'JOUR', 'VL': '9', 'Y1': '2014//'} {'A1': ['Marxus, Karlus', 'Lindgren, Astrid', 'Glattauer, Daniel'], 'CY': 'Germany', 'ID': '12345', 'IS': '3', 'JA': 'lorem', 'JF': 'Lorem', 'KW': ['Pippi Langstrumpf', 'Nordwind', 'Piraten'], 'L2': 'http://example2.com', 'M1': '1228150341', 'N2': 'BACKGROUND: Lorem dammed ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.', 'PB': ['Dark Factory', 'Dark Factory GER'], 'SN': '1732-4208', 'SP': 'e0815341', 'T1': 'The title of the reference', 'TY': 'JOUR', 'VL': '6', 'Y1': '2006//'} >>> entries = readris(filepath) >>> entries_list = list(entries) >>> print(len(entries_list)) 2
Example entry
RIS entry
1. TY - JOUR ID - 12345 T1 - Title of reference A1 - Marx, Karl A1 - Lindgren, Astrid A1 - Glattauer, Daniel Y1 - 2014// N2 - BACKGROUND: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. KW - Pippi KW - Nordwind KW - Piraten JF - Lorem JA - lorem VL - 9 IS - 3 SP - e0815 CY - United States PB - Fun Factory PB - Fun Factory USA SN - 1932-6208 M1 - 1008150341 L2 - http://example.com ER -
DICT entry
{ 'A1': ['Marx, Karl', 'Lindgren, Astrid', 'Glattauer, Daniel'], 'CY': 'United States', 'ID': '12345', 'IS': '3', 'JA': 'lorem', 'JF': 'Lorem', 'KW': ['Pippi', 'Nordwind', 'Piraten'], 'L2': 'http://example.com', 'M1': '1008150341', 'N2': 'BACKGROUND: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. RESULTS: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. CONCLUSIONS: Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.', 'PB': ['Fun Factory', 'Fun Factory USA'], 'SN': '1932-6208', 'SP': 'e0815', 'T1': 'Title of reference', 'TY': 'JOUR', 'VL': '9', 'Y1': '2014//' }
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
RISparser-0.1.tar.gz
(6.5 kB
view details)
File details
Details for the file RISparser-0.1.tar.gz
.
File metadata
- Download URL: RISparser-0.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0250ad6caef00e49a9c2662cd55e74a3ef9ce292fbc4a87f186e9664e4cea39 |
|
MD5 | 7be360b1d631640b13a197f1561fcff0 |
|
BLAKE2b-256 | 63a38bf5824250b3b3210e86b6c03628b07e5c1a544e56ae1553918cacc69f93 |