lojbanios-0.1.0.0: Lojban teaching platform
Safe HaskellSafe-Inferred
LanguageHaskell2010

Study.Framework.Lojban.TranslationUtils

Description

This module provides utilities for manipulating translations.

Synopsis

Documentation

simplifyTerminatorsInTranslation :: Translation -> Translation Source #

Simplifies a Translation by removing elidable terminators and/or replacing them with "cu" (see simplifyTerminatorsInSentence).

simplifyTerminatorsInTranslationGenerator :: TranslationGenerator -> TranslationGenerator Source #

Simplifies a TranslationGenerator by removing elidable terminators and/or replacing them with "cu" (see simplifyTerminatorsInSentence).

expandSentence :: Text -> [Text] Source #

Expands a sentence into multiple sentences using syntax such as (x|y|z) or {x|y|z}.

Examples:

  • "lo mlatu poi {ke'a} pinxe cu melbi" -> ["lo mlatu poi pinxe cu melbi", "lo mlatu poi ke'a pinxe cu melbi"]
  • "lo ctuca (be|pe) mi" -> ["lo ctuca be mi", "lo ctuca pe mi"]

expandSentences :: [Text] -> [Text] Source #

Expands a list of sentences into a potentially larger list using syntax such as (x|y|z) or {x|y|z} (see expandSentence).

expandTranslation :: Translation -> Translation Source #

Expands the Lojban sentences in a Translation using syntax such as (x|y|z) or {x|y|z} (see expandSentence).

expandTranslationGenerator :: TranslationGenerator -> TranslationGenerator Source #

Expands the Lojban sentences in a TranslationGenerator using syntax such as (x|y|z) or {x|y|z} (see expandSentence).

narrowTranslation :: Translation -> Translation Source #

Returns a Translation containing only the first (i.e., canonical) Lojban sentence.

This function discards all Lojban sentences except for the first one. Useful if you have a Translation that you would like to display to the user, but some of its sentences in Lojban use grammatical constructs that have not yet been taught (perhaps you added them to ensure that translations made by more advanced users are still accepted by the validator). By convention, the first translation is always expected to be suitable for presentation to the user.

narrowTranslationGenerator :: TranslationGenerator -> TranslationGenerator Source #

Decorates a TranslationGenerator so that the resulting translation contains only the first (canonical) Lojban sentence (see narrowTranslation).

narrowTranslationGeneratorByExpression :: TranslationGeneratorByExpression -> TranslationGeneratorByExpression Source #

Decorates a TranslationGeneratorByExpression so that the resulting translation contains only the first (canonical) Lojban sentence (see narrowTranslation).