Editing Wikiq

From CommunityData

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 4: Line 4:


We have recently added a general-purpose pattern matching (regular expressions) feature to wikiq. The design doc can be seen [[Wikiq Pattern Matching | here]] and more information is given in the Command Line Arguments and Codebook below.
We have recently added a general-purpose pattern matching (regular expressions) feature to wikiq. The design doc can be seen [[Wikiq Pattern Matching | here]] and more information is given in the Command Line Arguments and Codebook below.
== ! New Wikiq in 2018 ==
If you want the new wikiq, with improved persistence measures, use <code> wikiq_new </code>.
There will be some breaking changes to wikiq in summer 2018. Currently, the stable version of the new wikiq is called <code>wikiq_new</code> on hyak. At some point we will switch to calling the old version <code>wikiq_old</code> and the new version will be <code> wikiq </code>.


See Also: [[CommunityData:Dataset_And_Tools_Release_2018]]
See Also: [[CommunityData:Dataset_And_Tools_Release_2018]]
Line 64: Line 69:
<code>minor</code> : Whether the edit is minor
<code>minor</code> : Whether the edit is minor


<code>namespace</code> : A namespace is the type of whose names begin with a particular reserved word followed by a colon. For example, User:mkross (see https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces)
<code>namespace</code> : Id of the namespace. (see https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces)


<code>revert</code> : The edit identity reverts one or more other edits.  
<code>revert</code> : The edit identity reverts one or more other edits.  
Line 102: Line 107:
== Bugs ==  
== Bugs ==  


* Not all anonymous edits get flagged as anon. Editor name being an IP Address seems to work  (Not confirmed). (Note: I've never seen a bug with this and I've done a lot of work with anon edits. -kc)
* Not all anonymous edits get flagged as anon. Editor name being an IP Address seems to work  (Not confirmed).
*
*
== Samples ==
Kaylea likes to use a script-generating script for wikiq.
Step 1: Create a script-generating script like this:
<nowiki>
#!/usr/bin/env python3
from os import path
import os
import stat
import glob
## this script makes wikiq scripts for a given dump path
dumpHome = '/gscratch/comdata/raw_data/'
outPath = '/gscratch/comdata/output/'
langDump = dumpHome + enwiki_20230401 #customize if needed
## customize output path
outPath = outPath + "wikiq_enwiki_name_this_something_useful/"
archives = glob.glob(langDump + "/*pages-meta-hist*.7z") #makes a list of all the files, about 800 of them
if not os.path.exists(outPath): #makes the dir for storing the output
    os.makedirs(outPath)
with open('run_wikiq.sh', 'w') as fh: #creates a script
        for item in archives: #select options to customize the below as needed
                # as you see above, wikiq has a ton of options.
                # note that -o requires next field to be outPath; if more cmdline args are added, place before the -o.
                # if you wanted to regex match misinf or disinf in the edit comment field, this is how you'd do it:
                #fh.write(f"wikiq -u  -CP '.*(misinf|disinf).*' -CPl comment -n 0 -n 1 -o {outPath} {item}\n")
                # a more normal wikiq invocation is this:
                fh.write(f"wikiq --collapse-user -u -o {outPath} {item}\n") </nowiki>
Step 2: use the split command to turn your giant run_wikiq.sh script into a bunch of smaller files, named automatically things like xaa, xab, xac. For example, to make 40 lines per smaller script, do:
<nowiki>
split -l 40 run_wikiq.sh</nowiki>
After running split, if you type ls, you'll see the autonamed files, each containing part of your run_wikiq.sh script.
Step 3: you can now run the subchunks of your script, e.g. use tmux to log in to the same node 10-15 times, running sh xaa in the first one, sh xab in the second one, and so on. This is more hands-on and not really a proper batch approach, but it lets you sail through certain kinds of disruptions while still getting your output quickly.
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)