1.1.1-alpha • Published 11 months ago

x-sampa-to-ipa v1.1.1-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

X-SAMPA to IPA Converter

Overview

A utility package for converting X-SAMPA (Extended Speech Assessment Methods Phonetic Alphabet) notation into IPA (International Phonetic Alphabet) symbols. It includes features to handle ties in IPA notation, allowing for accurate and precise representation of phonetic symbols.

Features

  • X-SAMPA to IPA Conversion: Convert standard X-SAMPA notation into IPA symbols with ease.
  • Tie Handling: Supports the tying of symbols in IPA, ensuring correct phonetic representation.

Usage

import { toIpa } from 'x-sampa-to-ipa'

const xSampa = 'dZQb'
const ipa = toIpa(xsampa)

This will give: 'd͡ʒɒb'

Unlike one-to-one translation between X-SAMPA and IPA, x-sampa-to-ipa recognises ties.


Development

It uses npm, TypeScript compiler, Jest, webpack, ESLint, Prettier, husky, pinst, commitlint. The production files include CommonJS, ES Modules, UMD version and TypeScript declaration files.

Set up tools and environment

You need to have Node.js installed. Node includes npm as its default package manager.

Open the whole package folder with a good code editor, preferably Visual Studio Code. Consider installing VS Code extensions ES Lint and Prettier.

In the VS Code top menu: Terminal -> New Terminal

Install dependencies

Install dependencies with npm:

npm i

Test

Test your code with Jest framework:

npm run test

Note: Example TypeScript Package uses husky, pinst and commitlint to automatically execute test and lint commit message before every commit.

Build

Build production (distribution) files in your dist folder:

npm run build

It generates CommonJS (in dist/cjs folder), ES Modules (in dist/esm folder), bundled and minified UMD (in dist/umd folder), as well as TypeScript declaration files (in dist/types folder).

Try it before publishing

Run:

npm link

npm link will create a symlink in the global folder, which may be {prefix}/lib/node_modules/example-typescript-package or C:\Users\\AppData\Roaming\npm\node_modules\example-typescript-package.

Create an empty folder elsewhere, you don't even need to npm init (to generate package.json). Open the folder with VS Code, open a terminal and just run:

npm link x-sampa-to-ipa

This will create a symbolic link from globally-installed example-typescript-package to node_modules/ of the current folder.

You can then create a, for example, testxsampa.ts file with the content:

import { toIpa } from 'x-sampa-to-ipa'

// ...

Whenever you want to uninstall the globally-installed example-typescript-package and remove the symlink in the global folder, run:

npm uninstall x-sampa-to-ipa -g
1.1.1-alpha

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago