Skip to main content

Riksdagens Protokoll Part-Of-Speech Tagging

This package implements part-of-speech tagging of Riksdagens Protokoll Parla-CLARIN XML files.

Update riksprot tagger system

If pyriksprot_tagger repository folder already exists:

% cd "pyriksprot-tagger-folder"
% git pull

If repository folder doesn't exist:

% cd "some-folder"
% git clone git@github.com:welfare-state-analytics/pyriksprot_tagger.git

Update configuration

Update configurational elements in "pyriksprot-tagger-folder"/.env:

Environment variable Description
RIKSPROT_DATA_FOLDER Parent folder (location) of Riksdagens corpus data folder
RIKSPROT_REPOSITORY_URL https://github.com/welfare-state-analytics/riksdagen-corpus.git
RIKSPROT_REPOSITORY_TAG Target corpus version. Must be a valid Github tag
SPARV_DATADIR Sparv data folder
STANZA_DATADIR Stanza data folder
OMP_NUM_THREADS Number of threads to use
RIKSPROT_DATA_FOLDER="/data/riksdagen_corpus_data"
RIKSPROT_REPOSITORY_URL="https://github.com/welfare-state-analytics/riksdagen-corpus.git"
RIKSPROT_REPOSITORY_TAG="v0.4.5"
SPARV_DATADIR="/data/sparv"
STANZA_DATADIR="/data/sparv/models/stanza"
OMP_NUM_THREADS=10

Create or update Riksdagens Corpus data repository

% cd "pyriksprot-tagger-folder"
# If you want to create a new clone of the repository:
% make full-clone-repository
# If you want to update existing repository:
% make full-pull-repository
# If you want to save space a do a shallow clone
% make shallow-update-repository
# Update timestamp of repository work folder files to match last commit timestamp (important!):
% make update-repository-timestamps

Update / tag a new version of RIKSPROT:

Prerequisites:

  • Pull latest version of welfare-state-analytics/pyriksprot_tagger
  • Update configuration (see above)

If you want to use snakemake:

  • Edit options (target name) in workflow/config/config.yml
  • Run make annotate (ca: 10 hours run time)

If you want to use tag-it script (preferred, faster):

  • Run PYTHONPATH=. nohup ./tag-it.sh > tag-it.version.log &

Create metadata database:

  • Pull or clone latest version of welfare-state-analytics/pyriksprot
  • Update configuration (specify tag) to use in pyriksprot/.env
  • Run make metadata

Create speech corpus

  • Pull or clone latest version of welfare-state-analytics/pyriksprot
  • Update configuration (specify tag) to use in pyriksprot/.env
  • Run make extract-speeches-to-feather

How to annotate protocols using snakemake (not recommended)

  • Annotate using default settings.
make annotate
  • Update a single year (and set cpu count).
make annotate YEAR=1960 CPU_COUNT=1
  • Call snakemake directly:
$ nohup make annotate PROCESSES_COUNT=4 >& run.log &
or
$ nohup poetry run snakemake -j4 --keep-going --keep-target-files &
nohup poetry run snakemake --config -j4 --keep-going --keep-target-files &

Install from PyPI (not recommended)

Verify current Python version (pyenv is recommended for easy switch between versions).

  • Create a new Python virtual environment (sandbox):
cd /some/folder
mkdir riksprot_tagging
cd riksprot_tagging
python -m venv .venv
source .venv/bin/activate
  • Install the pipeline and run setup script.
pip install pyriksprot_tagger
setup-pipeline

To tag protocols you first need to activate the installed environment, and then follow steps above on how to tag protocols using snakemake.

cd /some/folder/pyriksprot
source .venv/bin/activate

Metadata

Release files for pyriksprot-tagger 2023.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyriksprot-tagger 2023.4.2
File Size Uploaded
pyriksprot_tagger-2023.4.2.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyriksprot-tagger 2023.4.2
File Interpreter ABI Platform
pyriksprot_tagger-2023.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.7 kB

Release files / pyriksprot_tagger-2023.4.2.tar.gz

Download URL pyriksprot_tagger-2023.4.2.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
11e42843f2d81ecfdefb9976e752f16789b845302d8dfc2c66414953bd128441
BLAKE2b-256 checksum
How to use checksums
a5bf8a31318e53afe6b1dfba7ff7942186c4930225ad27ebd91d483adddecb4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.1 Linux/5.4.0-144-generic

Release files / pyriksprot_tagger-2023.4.2-py3-none-any.whl

Download URL pyriksprot_tagger-2023.4.2-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7cfe8363a3a62ee6a5a9df9c0bbfc5ad055c6bc1a0495345c4f84a1a40fcbd0
BLAKE2b-256 checksum
How to use checksums
ff703aa2291baab6564c7c45bd328ab64c92e35ed17ece7cccd46b3f9c372f03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.1 Linux/5.4.0-144-generic

Release history Release notifications | RSS feed

This release

2023.4.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page