Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/imatpot/typst-ascii-ipa

🔄 ASCII / IPA conversion for Typst
https://github.com/imatpot/typst-ascii-ipa

branner ipa praat sil typst xsampa

Last synced: 26 days ago
JSON representation

🔄 ASCII / IPA conversion for Typst

Lists

README

        

# `ascii-ipa`

🔄 ASCII / IPA conversion for Typst

This package allows you to easily convert different ASCII representations of the International Phonetic Alphabet (IPA) to and from the IPA.
It also offers some minor utilities to make phonetic transcriptions easier to use overall.
The package is being maintained [here][repo].

Note: This is an extended port of the [`ipa-translate`][ipa-translate] Rust crate by [tirimid][tirimid]'s conversion features into native Typst.
Most conversions are implemented according to [this Wikipedia article][ipa-wikipedia] which in turn relies of the official specifications of the respective ASCII representations.

## Conversion

The package supports multiple ASCII representations for the IPA with one function each:

| Notation | Function name |
|----------|-----------------|
| Branner | `#branner(...)` |
| Praat | `#praat(...)` |
| SIL | `#sil(...)` |
| X-SAMPA | `#xsampa(...)` |

They all return the converted value as a [`string`][typst-str] and accept the set of same parameters:

| Parameter | Type | Positional / Named | Default | Description |
|-----------|-----------------------|--------------------|---------|------------------------------------------------------------------------------------------------------------|
| `value` | [`string`][typst-str] | positional | | Main input to the function. Usually the transcription in the corresponsing ASCII-based notation. |
| `reverse` | [`bool`][typst-bool] | named | `false` | Reverses the conversion. Pass Unicode IPA into `value` to get the corresponsing ASCII-based notation back. |

### Examples

All examples use the Swiss German word [⟨Chuchichäschtli⟩ [ˈχʊχːiˌχæʃːtlɪ]][chuchichäschtli] for the conversion.

```typst
#import "@preview/ascii-ipa:2.0.0": *

// returns "ˈχʊχːiˌχæʃːtlɪ"
#branner("'XUX:i,Xae)S:tlI")

// returns "'XUX:i,Xae)S:tlI"
#branner("ˈχʊχːiˌχæʃːtlɪ", reverse: true)

// returns "ˈχʊχːiˌχæʃːtlɪ"
#praat("\\'1\\cf\\hs\\cf\\:f\\'2\\ae\\sh\\:ftl\\ic")

// returns "\\'1\\cf\\hs\\cf\\:f\\'2\\ae\\sh\\:ftl\\ic"
#praat("ˈχʊχːiˌχæʃːtlɪ", reverse: true)

// returns "ˈχʊχːiˌχæʃːtlɪ"
#sil("}x=u