Wikipedia:Bots/Requests for approval/HasteurBot 4
- The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was
Withdrawn by operator.
Operator: Hasteur (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 01:18, Wednesday September 4, 2013 (UTC)
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python/Pywikibot
Source code available: Customized pywikipedia (soon)
Function overview: To evaluate articles that have at least one {{NRISref}}
to see if there are other reference tags. If there are no references that are not NRIS based, add {{NRIS-only}}
(and date it) to indicate that there's an effective "single source" problem.
Links to relevant discussions (where appropriate): Wikipedia:BOTREQ#Bot_to_tag_articles_only_sourced_to_National_Register_Information_System
Edit period(s): Daily
Estimated number of pages affected: Initially, there will be a great many pages evaluated due to a backlog of pages that qualify under this criterion. Afterwords, the bot will still crawl all the pages and re-evalute ones that have recently become eligible for the maint tag.
Exclusion compliant (Yes/No): Yes
Already has a bot flag (Yes/No): Yes
Function details: Working off the pagegenerator-search logic to find the records I need to see. Also trying to come up with positive and negative test cases for verification. More details soonish.
Discussion
edit@Dudemanfellabra, Doncram, Coal town guy, TheCatalyst31, and Nyttend: Ping as this will be the location for the bot request. If you could point me at some examples where the page should be tagged, that would be great. I've compiled a list (User:HasteurBot/NRSIref) that shows every invocation that starts with {{NRISref Hasteur (talk) 01:18, 4 September 2013 (UTC)[reply]
- Your list seems to be full of a lot of WP:NRHP's list articles, which should not be tagged with this template (although my guess is that all of them have multiple references anyway). This could be achieved by putting an exception in for any page that has "National Register of Historic Places listings" in the title. Your list seems not to include any of the pages on which {{NRISref}} is transcluded, though (See here). Any ideas why? One example of a page that should be tagged with the template is Ridge Trail Historic District. There are probably on the order of thousands out there haha, and I'm not willing to scour the encyclopedia looking for them (in fact, that's kind of the purpose of making the bot do it).--Dudemanfellabra (talk) 22:15, 8 September 2013 (UTC)[reply]
- Herp a derp... I did a search of the content of the page and not a list of transclusion of the template... Stand by for a better list Hasteur (talk) 22:26, 8 September 2013 (UTC)[reply]
- Ok, my understanding is Flag down any page where the only true reference on the page is the NRSIref tag. I did some poking and found Belmont, New York which only has one canonical <ref> tag but 2
{{GR}}
tags. Technically these don't evaluate as refs in the strictest sense (becasue the ref doesn't match the pattern <ref*</ref>. Should the GR tags be accepted as an exclusion? Hasteur (talk) 23:34, 8 September 2013 (UTC)[reply]- Yes. And also exclude any other template that does something similar to GR. A good place to look for these exceptions might be Category:Specific-source templates, although most of them probably don't have any overlap with NRHP articles anyway.--Dudemanfellabra (talk) 23:42, 8 September 2013 (UTC)[reply]
- Kauffman's Distillery Covered Bridge is showing up on the list, even though it has eight references. My immediate suspicion is that it's an issue with named refs, since I think every reference in that article is named. TheCatalyst31 Reaction•Creation 00:17, 9 September 2013 (UTC)[reply]
- I'll check how the page showed up, but the pattern I set would match named references as well as unnamed references. Hasteur (talk) 00:23, 9 September 2013 (UTC)[reply]
- (edit conflict)I'm still doing the list population with (No more than 1 ref tag). I'll do annother pass excluding the GR meta-template. Once we get the logic for identifying a qualifying page, the addition should be simple. Hasteur (talk) 00:20, 9 September 2013 (UTC)[reply]
- (edit conflict) Disregard my original theory. Theodore Roosevelt Inaugural National Historic Site is on there too, and its second reference isn't named. Either it's not catching the additional references at all, or it's an issue with references that span multiple lines. TheCatalyst31 Reaction•Creation 00:23, 9 September 2013 (UTC)[reply]
- Valley Lee, Maryland is in the category too, and its other reference has a ref tag, is on one line, and isn't named. I'm not sure what the issue with that is. TheCatalyst31 Reaction•Creation 00:35, 9 September 2013 (UTC)[reply]
- Kauffman's Distillery Covered Bridge is showing up on the list, even though it has eight references. My immediate suspicion is that it's an issue with named refs, since I think every reference in that article is named. TheCatalyst31 Reaction•Creation 00:17, 9 September 2013 (UTC)[reply]
- Yes. And also exclude any other template that does something similar to GR. A good place to look for these exceptions might be Category:Specific-source templates, although most of them probably don't have any overlap with NRHP articles anyway.--Dudemanfellabra (talk) 23:42, 8 September 2013 (UTC)[reply]
- (edit conflict) Disregard my original theory. Theodore Roosevelt Inaugural National Historic Site is on there too, and its second reference isn't named. Either it's not catching the additional references at all, or it's an issue with references that span multiple lines. TheCatalyst31 Reaction•Creation 00:23, 9 September 2013 (UTC) Reaction•Creation 00:23, 9 September 2013 (UTC)[reply]
−
- Ok, that's enough errors to cause me to abort the fact finding run. I'm coding some more to try and refine the list. Hasteur (talk) 00:38, 9 September 2013 (UTC)[reply]
- While I'm making suggestions, can the code be written to exclude talk pages (or anything outside of article space, for that matter)? Apparently a bunch of talk pages have transclusions of NRISref for some reason. TheCatalyst31 Reaction•Creation 01:04, 9 September 2013 (UTC)[reply]
- Ok, that's enough errors to cause me to abort the fact finding run. I'm coding some more to try and refine the list. Hasteur (talk) 00:38, 9 September 2013 (UTC)[reply]
- Ok, simplified the logic in determining a match. So far I've found Portageville, New York as a correct (and appropriate) hit. I'm having the base identification process run overnight to help us identify any further refinements to the procedure. Hasteur (talk) 02:44, 10 September 2013 (UTC)[reply]
- Hrm... Problem. USS Massachusetts (BB-2) shows up on the list because there are zero canonical ref tags, but a bunch of
{{sfn}}
tags. Coding in all these exceptions is a royal pain. I'm inclined to leave the sfn tag off the list to encourage more standardized citing as the majority of the pages are showing up with ref tags than not. But it's the WP:NRHP's call as to which citing/referencing versions they'd like to use. Hasteur (talk) 02:59, 10 September 2013 (UTC)[reply]- Note: I've since added another reference to the Portageville article, in case anyone's confused by why it was considered a correct hit. Sorry for messing up the example, but I want to get the non-NRHP articles out of the way sooner rather than later so they don't clog the category. TheCatalyst31 Reaction•Creation 03:52, 10 September 2013 (UTC)[reply]
- I'm pretty sure we don't need to tag a featured article as relying on a single reference. I realize coding exceptions is a pain (it always is), but I really think that any tag like this should be made an explicit exception. Maybe instead of hard-coding these exceptions, there is some other way to find single-sourced articles? One option might be to parse the wikitext of each page and look for spans with class="reference-text", which I believe applies to all references (correct me if I'm wrong). If that string appears more than once in the parsed HTML, throw the page out. Parsing the wikitext, though, will probably increase the run time of the bot drastically. Trade-offs.
- Pretty much what we're looking for are very short stubs that only have one reference tag to the NRIS (and not necessarily just using the NRISref template, as I said in the original post at WP:BOTREQ). If the article has more than one ref, regardless of what the second/third/other refs are, it shouldn't be tagged. To be honest, while the Portageville article technically meets the criteria, that's not even really the type of article we're looking for haha. It would be fine to tag it because it needs more sources regardless (and wouldn't be counted anyway by the script we use to update project statistics at WP:NRHPPROGRESS), but really we're looking for articles like the aforementioned Ridge Trail Historic District--articles about places that are actually listed on the National Register.--Dudemanfellabra (talk) 03:54, 10 September 2013 (UTC)[reply]
- The wikitext doesn't include the span class, so I'll code annother exception for the sfn tag, the talk pages exception mentioned above and the "National Register of Historic Places listings in" exception and start the list generation again. We'll continue whittling down the exceptions untill all are happy before I use the list to do the tagging. Hasteur (talk) 04:00, 10 September 2013 (UTC)[reply]
- Note: I've since added another reference to the Portageville article, in case anyone's confused by why it was considered a correct hit. Sorry for messing up the example, but I want to get the non-NRHP articles out of the way sooner rather than later so they don't clog the category. TheCatalyst31 Reaction•Creation 03:52, 10 September 2013 (UTC)[reply]
- Hrm... Problem. USS Massachusetts (BB-2) shows up on the list because there are zero canonical ref tags, but a bunch of
Hrm... Dudemanfellabra your prefered example doesn't show up on the list. When I peaked in I saw that there's a commented out reference in the text. I am unsure how you and the project would like to handle exceptions such as these. Hasteur (talk) 16:50, 11 September 2013 (UTC)[reply]
Based on how long generating the qualified list takes, when the bot comes along to tag, it's going to re-verify that the page is still valid (nobody snuck in during the night and improved the page). Note: Make sure to add a exception to the list generation if a {{NRIS-only}}
tag is already on the page. Hasteur (talk) 17:33, 11 September 2013 (UTC)[reply]
- Would it be possible to modify the regex (which is what I assume you're using?) to only count refs which are not commented out? Apparently Doncram included the commented refs in multiple articles he created where the NRHP nomination form was not online. If an article like Ridge Trail doesn't show up, the bot really is useless to find what we actually want to find.--Dudemanfellabra (talk) 18:05, 11 September 2013 (UTC)[reply]
- Not so. The tagging can be useful to direct editor attention to articles that can be improved. The Ridge Trail article is one where the tag should not be applied, because an editor has already reviewed the article and searched for additional references (and found none) and considered the possibility that there could be errors introduced by inexpert interpretation of NRIS database info (and there are no likely errors of that sort, for this one). That one has been "processed", in a good way. There's no use for Wikipedia readers to include alarming notice that the article may contain errors. There needs to be a way to opt out of the explicit tagging, i.e. don't tag if a certain category is already included, or include the tag but have a switch so that it does not display. For Dudemanfellabra's purposes, if he wishes to identify NRIS-only items including the Ridge Trail one, he can still do that, using the category or other indication that indeed there is just the NRIS source used. --doncram 19:00, 11 September 2013 (UTC)[reply]
- The tag is to label all articles which are sourced only to NRIS, regardless of the availability of other sources. The Ridge Trail article is sourced only to NRIS; ergo, it should be tagged. When other sources become available and are added to the article, the tag will be removed. If you couldn't find sources, you probably shouldn't have created the article.--Dudemanfellabra (talk) 19:09, 11 September 2013 (UTC)[reply]
- Besides, if the original editor couldn't find any other sources, how exactly did they verify that there weren't any errors in the NRIS info? TheCatalyst31 Reaction•Creation 21:36, 11 September 2013 (UTC)[reply]
- To Hasteur, there are indeed multiple NRHP articles where there exists a commented-out reference. And if the bot could include these it should. Then editors can manually review, and remove the tag where it is not helpful, such as in the Ridge Trail example, and somehow indicate that the bot should not again re-tag.
- Out of the identified articles, it is clear to me that many about geographical places or persons should indeed get some tag, perhaps {{refimprove}} or {{No footnotes}} another, but an alarmist message about the NRIS is NOT helpful on many of these. It would seem ridiculous, in fact, on many of these articles. There needs to be a way to opt out of the NRHP-focused tagging. Note WikiProject NRHP does not own every article that has a reference to NRIS.
- Consider an article about a geographical place, that has plenty of text but no explicit footnotes, and has a correct statement that "Such-And-Such House, on 4th Street, is listed on the U.S. National Register of Historic Places", with NRIS reference fully and accurately supporting that. We have to be able to over-rule the tagging, by use of a hidden category or somehow. --doncram 19:34, 11 September 2013 (UTC)[reply]
- (edit conflict)@Doncram: Please feel free to establish/negotiate a consensus for what criteria the bot should be excluded on, but in the BOTREQ discussion I seem to recall a request that if the tag was removed without fixing the problem, the bot was supposed to re-tag. I could see a change to the NRIS-only template that reduces the commentary about errors from the database and pushes a "Additional sources are needed for verification" angle. But that's a discussion to have at the template, not on this bot task. Hasteur (talk) 19:46, 11 September 2013 (UTC)[reply]
- As the editor who will probably end up fixing most of them, I don't have a problem with tagging community (and other non-NRHP) articles with this template. While it's not the original intent of the template to tag these, if an article on a non-NRHP topic only has a reference to the NRIS, it almost certainly has referencing issues anyway. TheCatalyst31 Reaction•Creation 21:32, 11 September 2013 (UTC)[reply]
- I agree that initially tagging the geographical/not-strictly-NRHP articles is the way to go to bring them out of obscurity, but I also agree that Doncram has a point that the articles don't technically "rely almost entirely on the NRIS". It is kind of a conundrum, but I don't see any other way around it. Allowing people to remove the tag and replace it with something like refimprove would open the door to people simply removing the tag on articles about actual NRHP listings and bypassing the system. In other words, allowing one exception for these articles opens the door to abuse.
- According to how the bot is set up, though, simply finding one more ref (e.g. GNIS or some history page) and adding it to the text in these articles (not even adding new information) will allow the user to remove the tag on that geographical article and not get reverted by the bot. I don't think this is too much to ask, and it actually improves the encyclopedia outside of WP:NRHP, which is good community outreach IMO :).--Dudemanfellabra (talk) 22:22, 11 September 2013 (UTC)[reply]
- As the editor who will probably end up fixing most of them, I don't have a problem with tagging community (and other non-NRHP) articles with this template. While it's not the original intent of the template to tag these, if an article on a non-NRHP topic only has a reference to the NRIS, it almost certainly has referencing issues anyway. TheCatalyst31 Reaction•Creation 21:32, 11 September 2013 (UTC)[reply]
- (edit conflict)@Doncram: Please feel free to establish/negotiate a consensus for what criteria the bot should be excluded on, but in the BOTREQ discussion I seem to recall a request that if the tag was removed without fixing the problem, the bot was supposed to re-tag. I could see a change to the NRIS-only template that reduces the commentary about errors from the database and pushes a "Additional sources are needed for verification" angle. But that's a discussion to have at the template, not on this bot task. Hasteur (talk) 19:46, 11 September 2013 (UTC)[reply]
- Consider an article about a geographical place, that has plenty of text but no explicit footnotes, and has a correct statement that "Such-And-Such House, on 4th Street, is listed on the U.S. National Register of Historic Places", with NRIS reference fully and accurately supporting that. We have to be able to over-rule the tagging, by use of a hidden category or somehow. --doncram 19:34, 11 September 2013 (UTC)[reply]
- There's somewhere like 54k transclusions of the NRIS template. I'm going to try some tweaks to the code to move into additional pages of results. Hasteur (talk) 22:13, 11 September 2013 (UTC)[reply]
Adding the "commented out refs" regex (matches the patern <!-.*?<ref.*?</ref>.*?0-!> where .*? matches zero or more characters (selecting the minimum characters necessary to match the pattern)) has immensely slowed down the throughput of the list generation. The bot is processing them as fast as possible. I'm also running a back end log of every single transclusion and if it evaluated as include/not. I'll post the log to a pastebin so those who want the absolute list of which pages were in the NRIS-ref list can eat to their hearts content. Hasteur (talk) 12:30, 12 September 2013 (UTC)[reply]
- Not sure if you're still generating the list or not, but you may want to abort it and come up with a better regex or other method of finding commented out references. It appears from the very first article on the generated list, Williams Air Force Base, that there is a problem. That article has two references, but there are also a lot of comments on the page. In fact, the first place the "<!-" string shows up is right after the "==Historic sites==" header for a simple editorial comment. Farther down the page a reference is included, and then there are some other text comments below. Because the ref is technically between a "<!-" and a "->", the regex triggers a positive. What needs to be adjusted (although my regex skills are not that great) is to make sure that the "end comment" string matches the "begin comment" string, i.e. the ref is commented out and not just between two comments.
- That's the only article I looked at, but where there's one, there's bound to be others. Just letting you know.--Dudemanfellabra (talk) 15:11, 12 September 2013 (UTC)[reply]
- I aborted the list run. I'm going to have to come up with some way of looking at the context of the comment. How about this: Count the number of reference tags (initial regex). Do a second regex to extract terminated comments. For each matched comment, if there's a ref tag in it, deduct 1 from the overall ref count. If the reduced count of refs is 1 (meaning just the NRIS) then add to the list. Hasteur (talk) 15:47, 12 September 2013 (UTC)[reply]
- Sounds like a good algorithm to me. If I might ask, how do you plan on extracting terminated comments? I don't know Python, but in Javascript (my language of choice) what I would do is treat the entire wikitext as one big string. Then I would
- Count the number of references, call that var numrefs.
- In a repeat loop, find all instances of "<!--" via wikitext.indexOf() and store their index locations in some array, call it StartArray.
- Do the same thing for "-->" and put the positions in EndArray.
- Generate an array of strings using StartArray and EndArray which would then include all of the comments as elements of an array, e.g. CommentsArray[i]=wikitext.substr(StartArray[i],EndArray[i]-StartArray[i]).
- Run through the array and check to see if "<ref" appeared in any CommentsArray[i]. If it does, subtract one from numrefs.
- After this process, numrefs should be the total number of refs that are not inside comments. If that can be easily translated to Python, maybe try that? If you would like, I could probably work up a script that fetches the wikitext of a given page and does that so that you could look at actual code instead of the pseudocode above. If what you're planning on doing works, though, feel free to ignore this comment haha. Just trying to help as much as possible. Thanks again for all you're doing for WP:NRHP!--Dudemanfellabra (talk) 16:10, 12 September 2013 (UTC)[reply]
comment_list = re.findall('\<\!--.*?--\>',page_text)
(which uses the "match as few characters as possible method) is how I'm thinking of implementing the search for terminated comment list. Then it's a simple string search to see if the string <ref is anywhere inside. I believe in the "customer integration" aspect of Agile software development, so having active customers who can provide feedback to help refine the process allows all of us to feel like we're making forward progress. Hasteur (talk) 16:31, 12 September 2013 (UTC)[reply]- I realized that refs that are commented out are just a special subset of the refs overall. I did some coding from my tablet and started the list generation. We'll see if this works better. Hasteur (talk) 17:18, 12 September 2013 (UTC)[reply]
- Sounds like a good algorithm to me. If I might ask, how do you plan on extracting terminated comments? I don't know Python, but in Javascript (my language of choice) what I would do is treat the entire wikitext as one big string. Then I would
- I aborted the list run. I'm going to have to come up with some way of looking at the context of the comment. How about this: Count the number of reference tags (initial regex). Do a second regex to extract terminated comments. For each matched comment, if there's a ref tag in it, deduct 1 from the overall ref count. If the reduced count of refs is 1 (meaning just the NRIS) then add to the list. Hasteur (talk) 15:47, 12 September 2013 (UTC)[reply]
Of note, one of the thing we're missing at this point for a full live run is an authorization by the Bot Approval Group for a test/full approval. Before too long we're probably going to want to flag down a BAG member to get a trial authorization. Just giving you a realistic idea on where we are on getting the bot task approved, because I'd prefer not to have the bot's full authorization revoked because we went around the BAG on this task. Because the page edits so far have been to the bot's own user space we don't have to secure major authorization. Hasteur (talk) 16:31, 12 September 2013 (UTC)[reply]
Withdrawn by operator. Editors bringing the project cannot get a consensus in the project that would be most affected by this task. Withdrawing this request until such time that the project can clean it's own house or a consensus of all the editors is established as there is a no-win situation that the bot's actions will be either reverted or called as against consensus as soon as it begins the tag run. Hasteur (talk) 22:48, 16 September 2013 (UTC)[reply]
Closing per botop. — HELLKNOWZ ▎TALK 22:50, 16 September 2013 (UTC)[reply]
- The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.