Skip to main content

Build static sites for paralex lexicons

Project description

This package is currently in beta. It is meant to render paralex lexicon files in mkdocs sites.

Installing

pip install mkdocs_paralex_plugin

Quick start

Create a configuration file for mkdocs, compatible with mkdocs-material.

It needs a special paralex section, with minimally a paralex_package_path (to the json file), lists of feature labels to use to separate tables, rows and columns. It can contain

site_name: "My site name"
docs_dir: docs
plugins:
  - paralex:
      paralex_package_path: "<name>.package.json"
      layout_tables:
        - mood
      layout_rows:
        -  person/number
      layout_columns:
        - tense
repo_url: https://gitlab.com/<user>/<repo>

Large datasets

If your lexicon is massive, the generated site might exceed the free hosting capacity on gitlab or github. There is then two options: compressing some assets (should still work with most browsers), and if that is still not enough, serving just a sample of the data.

Compressing some assets

An easy way for the static site to take less space is to compress some assets. Just add a compress: true key:

site_name: "My site name"
docs_dir: docs
plugins:
  - paralex:
      paralex_package_path: "<name>.package.json"
      compress: true
      layout_tables:
        - mood
      layout_rows:
        -  person/number
      layout_columns:
        - tense
repo_url: https://gitlab.com/<user>/<repo>

Presenting only a sample of the data

To limit the site generation to a sample of the data, you need two more keys under the paralex section. If sample_size is set, the corresponding number of lexemes will be selected, and the site will only show that sample. If frequency_sample is set to true, then the chosen lexemes will be the most frequent.

site_name: "My site name"
docs_dir: docs
plugins:
  - paralex:
      paralex_package_path: "<name>.package.json"
      sample_size: 5000
      frequency_sample: true
      layout_tables:
        - mood
      layout_rows:
        -  person/number
      layout_columns:
        - tense
repo_url: https://gitlab.com/<user>/<repo>

Hosting on gitlab

To generate the site, add a plain text file called .gitlab-ci.yml, with the following content. The site will then be served at https://<username>.gitlab.io/<repository-name>. For more on gitlab pages, see the gitlab pages docs.

image: python:3.8

pages:
  stage: deploy
  script:
    - mkdir -p docs/
    - pip install pandas mkdocs>=1.1.2 mkdocs-material mkdocs_paralex_plugin
    - mkdocs build -d public/ --strict --verbose
  artifacts:
    paths:
      - public/
  only:
    - master

Github pages

To generate for github pages, see the mkdocs documentation. In brief, checkout the main or master branch of your project, locally install the needed packages, then run the github pages builder:

mkdir -p docs/
pip install pandas mkdocs>=1.1.2 mkdocs-material mkdocs_paralex_plugin
mkdocs gh-deploy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_paralex_plugin-0.1.14b0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_paralex_plugin-0.1.14b0-py2.py3-none-any.whl (27.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mkdocs_paralex_plugin-0.1.14b0.tar.gz.

File metadata

  • Download URL: mkdocs_paralex_plugin-0.1.14b0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for mkdocs_paralex_plugin-0.1.14b0.tar.gz
Algorithm Hash digest
SHA256 f9b44d42172f53e5fcb898eb6aa2c6be55188dbde5877c280712cb7936e7d113
MD5 201528485c066607fc74ab15cae3e56f
BLAKE2b-256 f2817fc0a467f9cf70fa9e7f1cf5d0c5c2a965578378911384ae17c702257a86

See more details on using hashes here.

File details

Details for the file mkdocs_paralex_plugin-0.1.14b0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_paralex_plugin-0.1.14b0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a6e4910629460c0997cca057630b1c33d5be5bc2b70ffea8ea95eca3e95ff63c
MD5 f5822295f2067d809be3efee201b49de
BLAKE2b-256 e443643c5d6ef1923bcc51eff427d4affddb75a63077b70ed50400a5b0a8acb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page