User:PagesBot
Jump to navigation
Jump to search
This user account is a bot with a bot flag. The bot is operated by Aluxosm. |
This bot was approved on March 22nd after going through the approvals process. |
Notes[edit]
The code used to run tests in the sandbox (like this) can be found on Github.
Daniel Mietchen has been working on a similar thing using manual queries and QuickStatements — See: github.com/WDscholia/scholia/issues/2152
Description[edit]
This bot infers number of pages (P1104) (type: page (Q1069725)) from page(s) (P304) statements on items where instance of (P31) is equal to scholarly article (Q13442814), it them adds a reference with based on heuristic (P887) equal to inferred from page(s) (Q110768064).
For example, a scholarly article that only has:
page(s) |
| ||||||||||
add value |
Would have the following statement added:
number of pages |
| ||||||||||
add value |
Regular expression used[edit]
^([a-zA-Z]*)(\d+)\s*(-|‐|‑|‒|–|—|―|−)\s*([a-zA-Z]*)(\d+)$
This results in five groups:
- The first prepended character
- The first page
- The 'to' symbol (hyphen-minus, hyphen, non-breaking hyphen, figure dash, en dash, em dash, horizontal bar, or a minus sign)
- The last prepended character
- The last page
View on RegExr
Calculation used[edit]
last_page - first_page + 1