Package: auto-labeler
auto-labelerauto-labeleris a tool for automatically labeling and archiving emails based on how you've
labeled emails in the past. This is useful for emails which are not strictly spam but also
don't require you to look at them. For example:tagging and auto-archiving terms of service updates with "terms"tagging recruiting emails with "recruiting" and archiving them after a daytagging and auto-archiving sales emails with "sales"Currentlyauto-labeleronly supports Gmail.To label emails,auto-labelerfine-tunes a custom text classification model on your machine
using your already labeled or unlabeled emails. Your data and the resulting model never leaves
your computer.UsageLabel emails that you want auto-labeledBefore using auto-labler you need to have at least one existing label that has been applied to
your emails. To do this, just create a label and tag at least 5 emails with that label. Make
sure you apply the label to any relevant emails in your recent emails, since any unlabeled emails
will be used as examples of emails that shouldn't be labeled.Install auto-labelerThe simplest way to installauto-lableris via pippython3 -m pip install auto-labelerTrain auto-labelerTo trainauto-lablerthe following command:auto-labeler train <label 1> <label 2>The auto-archive duration is how long after emails are auto-labeled they should be archived from
your inbox in hours. Set it to0to archive emails as soon as they are labeled, or-1to never
archive them automatically. Otherwise it should be a positive number that represents hours to wait
until archiving. Delaying archiving can beThis will prompt you to link with your Gmail account if you haven't linked it already. Once you've
successfully linked your account it will fetch relevant emails and train a model with the contents
of those emails.The resulting model will be stored in the default data directory for the current user on your platform.
You can change where this is stored by setting theAUTO_LABELER_DATA_DIRenvironment variable.Configuring auto-archivingBy default auto-labeled emails are not archived, meaning you will still see them in your inbox. To
change that run theauto-archivecommand.auto-labeler auto-archive <label name> <archive delay in hours>You can setauto-labelerto auto-archive immediately by using a delay of0. Otherwise it should
be a positive integer that represents the delay in hours. Set it to-1to set it back to the
default behavior of not auto-archiving.Having a delay is useful for emails that you want to see but dissapear automatically if no action
is taking after some time, or to monitor the quality of the automatic labels. Fixing mislabled emails
will improve the quality of models on future trainings.To set the behavior for all labels use the specialalllabel. For example, to automatically
auto-archive all labeled emails immediately after being labeled run the following command.auto-labeler auto-archive all 0Emails only get auto-archived when running thelabelcommand (below), so make sure you're running
that command regular as part of a cron job.To see the configured auto-archive settings runauto-labeler auto-archive.Auto-labeling emailsTo automatically label emails run the following command:auto-labeler labelThis will fetch emails that you've received since the last time the command has been run and
auto-archive any emails that are due to be archived. To run this every hour you can add this
entry to your crontab.0 * * * * auto-labeler labelUnlinking auto-lablerIf you no longer want to useauto-labelerand want to unlink from Gmail and clean up any
trained models, run theunlinkcommand.auto-labeler unlinkRunning on a remote computerBecauseauto-labeleris a local application, you can only connect it to Gmail from your local
computer. In order to runauto-labeleron a remote host, you need to do the following:Installauto-labeleron both your local computer and the host you want to run training
and/or labeling on.Runauto-labeler linkon your local computer. This will go through the OAuth process and
link your Gmail account toauto-labeler.Copy theauto-labelerdata dir to the host you want to train and runauto-labeleron. You
can get the location of the data dir by runningauto-labeler data-dir.On the remote host, put the data you copied from your intoauto-labeler's data dir. You can
get this value on the remote host by runningauto-labeler data-dirlike you did on your local
computer.Once you've done that, you can now runauto-labelerremotely.