Skip to main content

Utilities to be used in LibreLingo-related-packages

Project description

librelingo_utils

librelingo-utils contains utility functions that are meant to make it easier to create Python software that works with LibreLingo courses.

librelingo_utils.utils

calculate_number_of_levels

calculate_number_of_levels(nwords: int, nphrases: int) -> int

Calculates how many levels a skill should have

get_words_from_phrase

get_words_from_phrase(phrase)

Splits a phrase into its component words/terms. Note that this respects grouping with curly braces, i.e. sets of words surrounded by curly braces will not be split from each other.

remove_control_characters_for_display

remove_control_characters_for_display(phrase)

Removes characters with special LibreLingo functions from a phrase before it is displayed to the user. At the moment, this only applies to curly brackets used to group several words into a single mini-dictionary term.

clean_word

@lru_cache(maxsize=None)
clean_word(word: Word)

Remove punctuation and other special characters from a word.

get_dumb_opaque_id

get_dumb_opaque_id(name: str, id_, salt: str = "") -> str

Generate a unique, opaque ID based on a name, and id_ and a salt id

get_opaque_id

get_opaque_id(obj, salt: str = "") -> str

Generate a unique, opaque ID based on a salt and the type of the object id

audio_id

audio_id(language: Language, text: str) -> str

Generate the ID that will identify the audio file of a sentence.

iterate_phrases

iterate_phrases(course: Course)

"Flatten" a course into a sequence of phrases

iterate_words

iterate_words(course: Course)

"Flatten" a course into a sequence of words

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

librelingo_utils-2.6.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

librelingo_utils-2.6.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file librelingo_utils-2.6.2.tar.gz.

File metadata

  • Download URL: librelingo_utils-2.6.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.1-arch2-1

File hashes

Hashes for librelingo_utils-2.6.2.tar.gz
Algorithm Hash digest
SHA256 7b1f5eec34ae55566a3cee2385506c7c763a07d18435cbb823ff6ced02341267
MD5 a1ba0af9785cce5345a15b8f3a471a4f
BLAKE2b-256 965108f062003ad4a6975371f78d44b9df42e2be47dee2bbb5d676624a28d9df

See more details on using hashes here.

File details

Details for the file librelingo_utils-2.6.2-py3-none-any.whl.

File metadata

  • Download URL: librelingo_utils-2.6.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.1-arch2-1

File hashes

Hashes for librelingo_utils-2.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2635b81a0963fecae7baead52cff5a3779c2b3dded5c665c5e4270215773faa8
MD5 2af77bfc6a4a469cd903325bd22e9ee6
BLAKE2b-256 782b45f74e0c9a4bd8094a92391ae16b295519bb326cf0e63ad227d8037b03b3

See more details on using hashes here.

Supported by

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