Setup - ArtOfCode-/TagSuggestions GitHub Wiki

To set the script up, you'll need to follow a few steps.

  1. Dependencies
  2. Command line
  3. Application

1. Dependencies

TagSuggestions has one dependency: the requests module for Python. If you have pip installed, installing this is easy: simply run the command below.

pip install requests --upgrade

This will install requests on your system, or upgrade it if you've got an old copy.

2. Command line

TagSuggestions must be launched from the command line, since it has a number of configuration options. This is the general syntax of the launch command:

python main.py [-a | -i <ids>] [-s <site>] [--db-host <host> --db-name <name> --db-user <user>]

Breaking that down a little:

Suggestion Mode

The first two command line options control what questions the script suggests tags for. If, at launch, you specify the -a or --all switch, the script will suggest tags on the last 1000 questions (10 pages of 100).

You can alternatively specify the -i or --ids option, which will make the script suggest tags for a set of IDs that you specify after the switch. You should provide a space-delimited list of IDs enclosed in square brackets after the switch, i.e. --ids [31874 21904 77329] or -i [31874 21904 77329].

Suggestion Site

You can specify which site the script suggests tags for questions on using the -s or --site switch, immediately followed by the API site parameter. For example, this switch would suggest tags for questions on Stack Overflow:

--site stackoverflow

and this for Software Recommendations:

-s softwarerecs

Blacklist Database

In the root of the GitHub repo, there is a db_setup.sql file. This file contains the SQL necessary to create a table that the bot can use to blacklist tags that it should never suggest.

If you set up a database for this purpose, you will need to tell the bot how to access it, so that it can retrieve the tag information. You will need to know:

  • the DB host
  • the DB name
  • a username that has SELECT access to the DB
  • the password for that user

The first three can be specified on the command line with these switches:

  • DB host: --db-host
  • DB name: --db-name
  • username: --db-user

You must specify all or none of these options.

Once you've specified these details, the script will prompt you for the password, which is obscured as you type so that you don't reveal it in clear text.

3. Application

Congratulations, you've set up the script! It will now suggest tags. However, those more observant of you may have noticed that there's nothing in the codebase to actually suggest the edits. This is deliberate - I don't want this script automatically suggesting edits without human monitoring until I'm sure it's good. So: you'll need to apply the edits manually.

There are two possible ways to do this. If you've got 2k+ reputation on the Stack Exchange site you want to use this for, then you can - technically - apply the edits instantly. However, I recommend creating a new account to use this script with, as it then becomes possible to get statistics on how many of the edits would be community-approved. (If you do compile statistics, I'd appreciate it if you'd share them with me so I can see how the script's doing - though it's not essential.)

Once you've got an account to suggest the edits with, you need to apply the edits manually as you would if you were editing questions normally.

⚠️ **GitHub.com Fallback** ⚠️