paperminertoolkit 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. paperminertoolkit/__init__.py +10 -0
  2. paperminertoolkit/_version.py +11 -0
  3. paperminertoolkit/cli.py +1053 -0
  4. paperminertoolkit/corpus/__init__.py +1 -0
  5. paperminertoolkit/corpus/database.py +1542 -0
  6. paperminertoolkit/corpus/documents.py +313 -0
  7. paperminertoolkit/corpus/filtering.py +1390 -0
  8. paperminertoolkit/corpus/metadata.py +532 -0
  9. paperminertoolkit/extraction/__init__.py +1 -0
  10. paperminertoolkit/extraction/compression.py +486 -0
  11. paperminertoolkit/extraction/extract.py +573 -0
  12. paperminertoolkit/extraction/models.py +784 -0
  13. paperminertoolkit/extraction/recipes.py +241 -0
  14. paperminertoolkit/extraction/scrape.py +737 -0
  15. paperminertoolkit/extraction/store.py +244 -0
  16. paperminertoolkit/extraction/tokenizer.py +313 -0
  17. paperminertoolkit/providers/__init__.py +1 -0
  18. paperminertoolkit/providers/arxiv.py +760 -0
  19. paperminertoolkit/providers/base.py +514 -0
  20. paperminertoolkit/providers/biorxiv.py +561 -0
  21. paperminertoolkit/providers/chemrxiv.py +1115 -0
  22. paperminertoolkit/providers/core.py +423 -0
  23. paperminertoolkit/providers/crossref.py +649 -0
  24. paperminertoolkit/providers/elsevier.py +455 -0
  25. paperminertoolkit/providers/medrxiv.py +548 -0
  26. paperminertoolkit/providers/openalex.py +471 -0
  27. paperminertoolkit/providers/pubmed.py +1272 -0
  28. paperminertoolkit/providers/registry.py +521 -0
  29. paperminertoolkit/providers/rxiv.py +936 -0
  30. paperminertoolkit/providers/unpaywall.py +162 -0
  31. paperminertoolkit/resources/recipes.json +1670 -0
  32. paperminertoolkit/settings.py +661 -0
  33. paperminertoolkit/workflows/__init__.py +1 -0
  34. paperminertoolkit/workflows/download.py +1748 -0
  35. paperminertoolkit/workflows/enrichment.py +1906 -0
  36. paperminertoolkit/workflows/imports.py +121 -0
  37. paperminertoolkit/workflows/search.py +877 -0
  38. paperminertoolkit/workflows/topics.py +2837 -0
  39. paperminertoolkit/workflows/utilities.py +73 -0
  40. paperminertoolkit-1.0.0.dist-info/METADATA +126 -0
  41. paperminertoolkit-1.0.0.dist-info/RECORD +45 -0
  42. paperminertoolkit-1.0.0.dist-info/WHEEL +5 -0
  43. paperminertoolkit-1.0.0.dist-info/entry_points.txt +2 -0
  44. paperminertoolkit-1.0.0.dist-info/licenses/LICENSE +21 -0
  45. paperminertoolkit-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,73 @@
1
+ """Small maintenance utilities for the PaperMinerToolkit corpus.
2
+
3
+ These helpers back CLI commands for resetting pipeline status and printing a
4
+ progress summary for the SQLite paper corpus.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from os import PathLike
10
+
11
+ from paperminertoolkit.corpus.database import PIPELINE_COLUMNS, connect, paper_rows, upsert_paper
12
+
13
+
14
+ def reset(db_path: str | PathLike[str] = 'papers.db') -> None:
15
+ """Reset all corpus pipeline columns.
16
+
17
+ Parameters
18
+ ----------
19
+ db_path : str or os.PathLike[str], optional
20
+ Corpus database to reset.
21
+
22
+ Raises
23
+ ------
24
+ RuntimeError
25
+ If the corpus schema is newer than this package supports.
26
+ """
27
+ with connect(db_path) as conn:
28
+ for paper in paper_rows(conn):
29
+ for column, default in PIPELINE_COLUMNS.items():
30
+ paper[column] = default
31
+ paper['metadata_status'] = 'retrieved'
32
+ upsert_paper(conn, paper)
33
+
34
+
35
+ def status(db_path: str | PathLike[str] = 'papers.db') -> None:
36
+ """Print a compact corpus progress summary.
37
+
38
+ Parameters
39
+ ----------
40
+ db_path : str or os.PathLike[str], optional
41
+ Corpus database to summarize.
42
+
43
+ Raises
44
+ ------
45
+ RuntimeError
46
+ If the corpus schema is newer than this package supports.
47
+ """
48
+ with connect(db_path) as conn:
49
+ papers = paper_rows(conn)
50
+ print('\nPaperMinerToolkit Progress Summary')
51
+ print('---------------------------')
52
+ print(f'Total papers: {len(papers)}')
53
+ rows = [
54
+ ('Metadata retrieved', 'metadata_status', 'retrieved'),
55
+ ('Metadata enriched', 'enrichment_status', 'succeeded'),
56
+ ('Text downloaded', 'text_download_status', 'succeeded'),
57
+ ('PDFs downloaded', 'pdf_download_status', 'succeeded'),
58
+ ('Text scraped', 'text_scrape_status', 'succeeded'),
59
+ ('Images scraped', 'image_scrape_status', 'succeeded'),
60
+ ('Stored', 'store_status', 'stored'),
61
+ ('Failed text downloads', 'text_download_status', 'failed'),
62
+ ('Failed PDF downloads', 'pdf_download_status', 'failed'),
63
+ ('Failed text scrapes', 'text_scrape_status', 'failed'),
64
+ ('Failed image scrapes', 'image_scrape_status', 'failed'),
65
+ ]
66
+ for label, column, value in rows:
67
+ count = sum(1 for paper in papers if paper.get(column) == value)
68
+ print(f'{label}: {count}')
69
+ text_materials = sum(int(paper.get('num_text_materials') or 0) for paper in papers)
70
+ image_materials = sum(int(paper.get('num_image_materials') or 0) for paper in papers)
71
+ print(f'Text material rows extracted: {text_materials}')
72
+ print(f'Image material rows extracted: {image_materials}')
73
+ print('---------------------------\n')
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: paperminertoolkit
3
+ Version: 1.0.0
4
+ Summary: A package for extracting structured information from scientific papers with configurable language and vision models.
5
+ Author-email: Oskar Soulas <oskar.soulas@gmail.com>, Louie <louies@hotmail.co.uk>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/SMTG-Bham/PaperMinerToolkit
8
+ Project-URL: Repository, https://github.com/SMTG-Bham/PaperMinerToolkit
9
+ Project-URL: Issues, https://github.com/SMTG-Bham/PaperMinerToolkit/issues
10
+ Keywords: research,scientific-papers,materials,text-mining,llm
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
18
+ Classifier: Topic :: Text Processing
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: click
23
+ Requires-Dist: headroom-ai[image,ml]<0.36,>=0.35
24
+ Requires-Dist: openai
25
+ Requires-Dist: numpy
26
+ Requires-Dist: pandas
27
+ Requires-Dist: pillow
28
+ Requires-Dist: pymupdf
29
+ Requires-Dist: pypdf
30
+ Requires-Dist: requests
31
+ Requires-Dist: regex
32
+ Requires-Dist: scipy
33
+ Requires-Dist: joblib
34
+ Requires-Dist: matplotlib
35
+ Requires-Dist: scikit-learn
36
+ Requires-Dist: tiktoken>=0.13.0
37
+ Requires-Dist: tqdm
38
+ Requires-Dist: transformers
39
+ Provides-Extra: test
40
+ Requires-Dist: pytest; extra == "test"
41
+ Requires-Dist: pytest-cov; extra == "test"
42
+ Requires-Dist: ruff; extra == "test"
43
+ Provides-Extra: docs
44
+ Requires-Dist: myst-nb<2,>=1.2; extra == "docs"
45
+ Requires-Dist: pydata-sphinx-theme<0.21,>=0.16; extra == "docs"
46
+ Requires-Dist: sphinx<10,>=8; extra == "docs"
47
+ Requires-Dist: sphinx-click<7,>=6; extra == "docs"
48
+ Requires-Dist: sphinxcontrib-mermaid<2,>=1; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ <p align="center">
52
+ <picture>
53
+ <source media="(prefers-color-scheme: dark)" srcset="assets/Paper_Miner_Toolkit_banner_dark.svg">
54
+ <img src="assets/Paper_Miner_Toolkit_banner_light.svg" alt="PaperMinerToolkit banner" width="640">
55
+ </picture>
56
+ </p>
57
+
58
+ <p align="center">
59
+ <a href="https://github.com/SMTG-Bham/PaperMinerToolkit/actions/workflows/tests.yml"><img src="https://github.com/SMTG-Bham/PaperMinerToolkit/actions/workflows/tests.yml/badge.svg?branch=main" alt="Tests"></a>
60
+ <a href="https://codecov.io/gh/SMTG-Bham/PaperMinerToolkit"><img src="https://codecov.io/gh/SMTG-Bham/PaperMinerToolkit/branch/main/graph/badge.svg" alt="Coverage"></a>
61
+ <a href="https://pypi.org/project/paperminertoolkit/"><img src="https://img.shields.io/pypi/v/paperminertoolkit?logo=pypi&amp;logoColor=white" alt="PyPI version"></a>
62
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.11%2B-3776AB?logo=python&amp;logoColor=white" alt="Python 3.11 or newer"></a>
63
+ <a href="https://paperminertoolkit.readthedocs.io/en/latest/"><img src="https://img.shields.io/badge/Docs-Read%20the%20Docs-8CA1AF?logo=readthedocs&amp;logoColor=white" alt="Documentation"></a>
64
+ </p>
65
+
66
+ # PaperMinerToolkit
67
+
68
+ PaperMinerToolkit builds scientific-paper corpora and extracts structured, recipe-defined data with configurable text and vision models. It searches Elsevier/Scopus, CORE, OpenAlex, PubMed, arXiv, medRxiv, bioRxiv, and chemRxiv; supplements paper metadata from Crossref, OpenAlex, PubMed, arXiv, medRxiv, bioRxiv, and chemRxiv, and imports an author's works from Crossref; downloads abstracts, full text, and PDFs; supports persistent regex and LDA topic filters; and stores source content and pipeline state in SQLite.
69
+
70
+ The complete user guide, CLI reference, Python API, HPC instructions, and rendered notebooks live in the [documentation source](https://paperminertoolkit.readthedocs.io/en/latest/). The repository is ready for Read the Docs; a hosted link will be added after the project is imported.
71
+
72
+ ## Installation
73
+
74
+ PaperMinerToolkit requires Python 3.11 or newer:
75
+
76
+ ```bash
77
+ git clone https://github.com/SMTG-Bham/PaperMinerToolkit.git
78
+ cd PaperMinerToolkit
79
+ python -m pip install -e .
80
+ ```
81
+
82
+ ## Quickstart
83
+
84
+ Configure a text model and any search/download credentials you need, then run a small workflow:
85
+
86
+ ```bash
87
+ pmt config model text --provider openai --model YOUR_TEXT_MODEL
88
+
89
+ pmt search "lithium solid electrolyte" papers.db \
90
+ --source openalex --count 25
91
+ pmt enrich papers.db
92
+ pmt download papers.db --format abstract
93
+
94
+ pmt scrape papers.db sse \
95
+ --mode abstract \
96
+ --output temp_scraped_materials.csv
97
+
98
+ pmt store papers.db \
99
+ temp_scraped_materials.csv \
100
+ materials.csv \
101
+ sse \
102
+ --assume-yes
103
+ ```
104
+
105
+ Use `pmt corpus stats papers.db` to inspect stored content and `pmt status papers.db` to inspect pipeline progress.
106
+
107
+ ## Documentation
108
+
109
+ Install and build the Sphinx site locally:
110
+
111
+ ```bash
112
+ python -m pip install -e '.[docs]'
113
+ make -C docs html
114
+ ```
115
+
116
+ Open `docs/_build/html/index.html`. Notebook templates for OpenAI, Anthropic, local Qwen/vLLM, LDA model selection, temporal trends, and hybrid filtering are under `docs/examples/`.
117
+
118
+ ## Testing
119
+
120
+ ```bash
121
+ python -m pip install -e '.[test]'
122
+ ruff check paperminertoolkit tests
123
+ pytest
124
+ ```
125
+
126
+ PaperMinerToolkit is currently alpha software. Keep the corpus database, recipe, model configuration, intermediate extraction CSV, and final results together so a workflow can be reviewed and reproduced.
@@ -0,0 +1,45 @@
1
+ paperminertoolkit/__init__.py,sha256=aan5tQEFSRt8FvfYxEoYUCKjN_IVb9tPXGJybTgNpRk,426
2
+ paperminertoolkit/_version.py,sha256=Lpuy10GiCkSmH0oBwnjPWYKuQpeAD_IE12chzRSoHa4,419
3
+ paperminertoolkit/cli.py,sha256=QqWUam3srErwbTwEBAjDMyv-psd5btVSV16Wo01ek74,47894
4
+ paperminertoolkit/settings.py,sha256=5yMAIcQ8G3ICMkOWtnX4iBq4vWXGOVyaI3xQnSEuzU0,21109
5
+ paperminertoolkit/corpus/__init__.py,sha256=ED517_CsHwlatj65ts9ogCzQ1VO_lIGLF-WEceKm8bE,66
6
+ paperminertoolkit/corpus/database.py,sha256=iSi9KSKmIl2wnFY2InE8LFskEmRFkR067YSxD4giyUU,49484
7
+ paperminertoolkit/corpus/documents.py,sha256=a-9HyleSGohm28S5eP-hu1yI7Wyu1KcFaKD7g4O9Cwc,8777
8
+ paperminertoolkit/corpus/filtering.py,sha256=Gh9N0FF7AZGhdFv2UEseCkN8QHFl4h7w_YkZzsPTTjM,48975
9
+ paperminertoolkit/corpus/metadata.py,sha256=GciNaNSRl5q6pGu_DWz_FzzGVcsahoOb1NMREZgxRV4,16492
10
+ paperminertoolkit/extraction/__init__.py,sha256=_vqi5AA6UC7kjZgMUwperOnNZnKMzteeKttrW-We9hA,64
11
+ paperminertoolkit/extraction/compression.py,sha256=gwYcmTHA2_FeuxWteykjBO2bgUfspgxBQEsRewc4tFI,15601
12
+ paperminertoolkit/extraction/extract.py,sha256=4lGIbbp0u-fmmYlabcO-RSTf3gUmxPg0TTRkV4ee7JQ,20768
13
+ paperminertoolkit/extraction/models.py,sha256=0sPkuLMq1_A6DjWx8Qyf3gXWA2LaKui1yPLbS1E8DAc,26264
14
+ paperminertoolkit/extraction/recipes.py,sha256=KyPMyY2myxAH2zIMtGfD6x2EzrvWqhSbzU5DKIGedS0,8127
15
+ paperminertoolkit/extraction/scrape.py,sha256=t16lE92HUtX4Ee7lfhubu5Pp09HR3G1DSfhu4s2YFTI,30172
16
+ paperminertoolkit/extraction/store.py,sha256=-oezvYhQLVsNE-xcg_rRKdKAY8SYIwfAc2Boc-uBByI,8422
17
+ paperminertoolkit/extraction/tokenizer.py,sha256=r08tqXUjR_kv9qAGbBD7x0qa6v4-s3o2UeglUK6n56w,9236
18
+ paperminertoolkit/providers/__init__.py,sha256=7Zrj4ExC_7hdPam3-yA38bXtTrS_raaiK0L9doTYGdo,67
19
+ paperminertoolkit/providers/arxiv.py,sha256=zJcvkFBIlQNBvQTS3jdNZ44UbrZ3jJPFG_hyHJTTti4,26096
20
+ paperminertoolkit/providers/base.py,sha256=tqjOy0Ed7iZmSGh0aY4BXcBCaY2AERYVcYRtyrmNiOY,16385
21
+ paperminertoolkit/providers/biorxiv.py,sha256=P3CBdQfYESYbswkjD_rGJeO9VbCOp0fqaOVbebOU4LI,17568
22
+ paperminertoolkit/providers/chemrxiv.py,sha256=K7LcQi7g0Wfo7ogrolQ2wGSCPe9gXfSCvRQIdH3_hJk,39174
23
+ paperminertoolkit/providers/core.py,sha256=Hygrr_WYnqo5cHHplYOkhPjeLsFykC0EUCdzLFdH9vg,12467
24
+ paperminertoolkit/providers/crossref.py,sha256=i3UzWsi-eAAl9SIfN2E_bKvyn6xl0ZCwhaWxn7XTJBY,21098
25
+ paperminertoolkit/providers/elsevier.py,sha256=SQ9RSwC_GM1NFQBwS3ZrRmjZDkzZCAWh8pQo7_9fO6s,13959
26
+ paperminertoolkit/providers/medrxiv.py,sha256=7dY6tiE0AR347ZDrcZNB_jPGeEOXz9zth7gcpyrfFgU,16737
27
+ paperminertoolkit/providers/openalex.py,sha256=anpUWzyrZfrZSoE3iyYPnRcJiFyh1yK2r-qHZdODNeg,15435
28
+ paperminertoolkit/providers/pubmed.py,sha256=gkp_0UKocF1OZ33fh5RxGkK4peE-Dp9XUg2GVazUmpE,41512
29
+ paperminertoolkit/providers/registry.py,sha256=OXgt2EYsPTHTGyxZT9eOG_tanIMRfZ7qHu92NdoLSH8,21788
30
+ paperminertoolkit/providers/rxiv.py,sha256=HE5MpYp9qKA_AM4sDtRKor5x9CxWeOd0Oa2qM0yMhK0,32676
31
+ paperminertoolkit/providers/unpaywall.py,sha256=vpratTRRYO6YUSM1o0f06Jrgf6Uk0n6R5PLlmTa9a_Y,5025
32
+ paperminertoolkit/resources/recipes.json,sha256=8wQjrqsZvrVC12uT0NNApU5XjM7A7uOc-6NfvXrbyXY,81445
33
+ paperminertoolkit/workflows/__init__.py,sha256=oAg4My0P-TvO544KQIGO7pUXLkau4NxM_Uns18UPJ2A,73
34
+ paperminertoolkit/workflows/download.py,sha256=jO7Evzm-W5hgSbYJxRahma7l9Ez71Lcc6MXpiVDyIik,60028
35
+ paperminertoolkit/workflows/enrichment.py,sha256=w3-UDh-LTFv9MNcQesrURqITt46AiFap4MrDuzP7Bno,82078
36
+ paperminertoolkit/workflows/imports.py,sha256=Y-FjzpiXiQ3GNxxMDsRIEHhzyd0duindF2vL-D8jXa4,4498
37
+ paperminertoolkit/workflows/search.py,sha256=ZCAY8kiEP0FOXyz2hyN08HapxUYXZZ6p2WuavQrBTMA,34309
38
+ paperminertoolkit/workflows/topics.py,sha256=A4QmzX0GEQFHmxC6EiD5oRIvzv4_Smobkr6l9grEwGs,107853
39
+ paperminertoolkit/workflows/utilities.py,sha256=3MBnJBTkfNVMfnNHVlTH9ad3SCzHOdiUjGROEVOuEfk,2707
40
+ paperminertoolkit-1.0.0.dist-info/licenses/LICENSE,sha256=3m4zMu0tTVLoKLJHS0Xnf9eDuYYUEi5XUQh4m_D3SDA,1066
41
+ paperminertoolkit-1.0.0.dist-info/METADATA,sha256=z4GJ4pIucliKJ-m7skZFowEAK0E2lrdCN8jtY08CEnY,5382
42
+ paperminertoolkit-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
43
+ paperminertoolkit-1.0.0.dist-info/entry_points.txt,sha256=0DWJexNYok3mmwP1vFrC43gBqJNgfyIfKtPvri6FKvs,51
44
+ paperminertoolkit-1.0.0.dist-info/top_level.txt,sha256=eP49gPag_JiP6REB2HygSL7kNbbh7eMaHwz3mCLbG0E,18
45
+ paperminertoolkit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pmt = paperminertoolkit.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SMTG-Bham
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ paperminertoolkit