{"id":22025870,"url":"https://github.com/digitallinguistics/scription2dlx","last_synced_at":"2025-05-07T09:41:54.543Z","repository":{"id":34865946,"uuid":"175907357","full_name":"digitallinguistics/scription2dlx","owner":"digitallinguistics","description":"A JavaScript library that converts scription text files to the Data Format for Digital Linguistics","archived":false,"fork":false,"pushed_at":"2025-02-19T18:16:50.000Z","size":772,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T08:43:46.142Z","etag":null,"topics":["digital-humanities","digital-linguistics","dlx","documentary-linguistics","language","language-documentation","linguistics","scription"],"latest_commit_sha":null,"homepage":"https://developer.digitallinguistics.io/scription2dlx","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitallinguistics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-16T00:18:50.000Z","updated_at":"2024-10-11T02:18:40.000Z","dependencies_parsed_at":"2023-01-15T09:42:39.016Z","dependency_job_id":"f555caa9-e3b8-4f36-9097-62486e576712","html_url":"https://github.com/digitallinguistics/scription2dlx","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":0.09589041095890416,"last_synced_commit":"99e8516657d69186fb072e1bd2db22eed0c737e4"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitallinguistics%2Fscription2dlx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitallinguistics%2Fscription2dlx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitallinguistics%2Fscription2dlx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitallinguistics%2Fscription2dlx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitallinguistics","download_url":"https://codeload.github.com/digitallinguistics/scription2dlx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252852486,"owners_count":21814365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["digital-humanities","digital-linguistics","dlx","documentary-linguistics","language","language-documentation","linguistics","scription"],"created_at":"2024-11-30T07:20:16.216Z","updated_at":"2025-05-07T09:41:54.510Z","avatar_url":"https://github.com/digitallinguistics.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scription2dlx\n\n[![GitHub version](https://img.shields.io/github/v/release/digitallinguistics/scription2dlx?label=version)][releases]\n[![downloads](https://img.shields.io/npm/dt/@digitallinguistics/scription2dlx.svg)][npm]\n[![GitHub issues](https://img.shields.io/github/issues/digitallinguistics/scription2dlx.svg)][issues]\n[![tests status](https://github.com/digitallinguistics/scription2dlx/workflows/tests/badge.svg)][actions]\n[![license](https://img.shields.io/github/license/digitallinguistics/scription2dlx.svg)][license]\n[![DOI](https://zenodo.org/badge/175907357.svg)][Zenodo]\n[![GitHub stars](https://img.shields.io/github/stars/digitallinguistics/scription2dlx.svg?style=social)][GitHub]\n\nA JavaScript library that converts linguistic texts in [scription format][scription] to the [Data Format for Digital Linguistics (DaFoDiL)][DaFoDiL]. This library is useful for language researchers who want to work with their data in text formats that are simple to type and read ([scription][scription]), but want to convert their data for use in other [Digital Linguistics][DLx] tools.\n\n## Quick Links\n\n* [Report a bug or request a feature][issues]\n* [View project on GitHub][GitHub]\n* [View project on npm][npm]\n* [Download the latest release][releases]\n\n## Contents\n\n\u003c!-- TOC --\u003e\n\n* [Basic Usage](#basic-usage)\n* [Notes](#notes)\n* [Options](#options)\n\n\u003c!-- /TOC --\u003e\n\n## Basic Usage\n\n1. Install the library using npm or yarn:\n\n  ```cmd\n  npm i @digitallinguistics/scription2dlx\n  yarn add @digitallinguistics/scription2dlx\n  ```\n\n  Or download the latest release from the [releases page][releases].\n\n1. Import the library into your project:\n\n  **Node:**\n\n  ```js\n  import convert from '@digitallinguistics/scription2dlx';\n  ```\n\n  **HTML:**\n\n  ```html\n  \u003cscript src=scription2dlx.js type=module\u003e\u003c/script\u003e\n  ```\n\n1. The library exports a single function which accepts a string and returns a [DaFoDiL Text Object][Text].\n\n  **data.txt**\n\n  ```\n  ---\n  title: How the world began\n  ---\n  waxdungu qasi\n  one day a man\n  ```\n\n  **script.js**\n\n  ```js\n  const data = await fetch(`data.txt`);\n  const text = scription2dlx(data);\n\n  console.log(text.utterances.transcription); // \"waxdungu qasi\"\n  ```\n\n  You may also pass an options hash as the second option. See the [Options](#options) section below.\n\n  ```js\n  const text = scription2dlx(data, { /* options */ });\n  ```\n\n## Notes\n\n* If your project does not support ES modules and/or the latest JavaScript syntax, you may need to transpile this library using tools like [Babel][Babel], and possibly bundle the library using a [JavaScript bundler][bundlers].\n\n* The `scription2dlx` library does **not** perform validation on the text data. You should use another validator like [AJV][AJV] to validate your data against the [DLx DaFoDiL format][DaFoDiL].\n\n* In order to keep this library small and dependency-free, `scription2dlx` does **not** automatically parse the YAML header of a scription document. Instead, the header string is returned as a `header` property on the text object. If you would like `scription2dlx` to parse the header, pass a YAML parser to the `parser` option when calling the `scription2dlx` function:\n\n  ```js\n  import yaml from 'yaml'; // use your preferred YAML parsing library\n\n  const text = scription2dlx(data, { parser: yaml.parse });\n  ```\n\n## Options\n\n| Option              | Default     | Description                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| ------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `codes`             | `{}`        | This option allows you to use custom backslash codes in your interlinear glosses. It should be a hash containing the scription code as a key (without a leading backslash), and the custom code as the value; ex: `\"txn\": \"t\"` will allow you to write `\\t` instead of `\\txn` for transcription lines.                                                                                                                         |\n| `emphasis`          | `true`      | This option specifies whether emphasis should be passed through as-is (`true`, default), or stripped from the data (`false`).\n| `errors`            | `\"warn\"`    | This option allows you to specify how to handle errors. If set to `\"warn\"\"` (the default), an utterance which throws an error is skipped and a warning is logged to the console. If set to `\"object\"`, an error object with information is returned in the results array. If set to `false`, utterances with errors will be skipped silently. If set to `true`, utterances with errors will throw and stop further processing. |\n| `orthography`       | `\"default\"` | An abbreviation for the default orthography to use for transcriptions when one is not specified.                                                                                                                                                                                                                                                                                                                               |\n| `parser`            | `undefined` | A YAML parser to use in parsing the header of a scription document. If none is present, the header will be provided as a string in the `header` property of the returned object.                                                                                                                                                                                                                                               |\n| `utteranceMetadata` | `true`      | Whether to parse the utterance metadata line (the first line when it begins with `#`). If set to `true`, a `metadata` property will be added to each utterance that has it.                                                                                                                                                                                                                                                    |\n\n[actions]:   https://github.com/digitallinguistics/scription2dlx/actions/\n[AJV]:       https://www.npmjs.com/package/ajv\n[Babel]:     https://babeljs.io/\n[bundlers]:  https://blog.bitsrc.io/choosing-the-right-javascript-bundler-in-2020-f9b1eae0d12b\n[DaFoDiL]:   https://format.digitallinguistics.io\n[DLx]:       https://digitallinguistics.io\n[GitHub]:    https://github.com/digitallinguistics/scription2dlx\n[license]:   https://github.com/digitallinguistics/scription2dlx/blob/master/LICENSE.md\n[issues]:    https://github.com/digitallinguistics/scription2dlx/issues\n[npm]:       https://www.npmjs.com/package/@digitallinguistics/scription2dlx\n[releases]:  https://github.com/digitallinguistics/scription2dlx/releases\n[scription]: https://scription.digitallinguistics.io\n[Text]:      https://format.digitallinguistics.io/schemas/Text.html\n[Zenodo]:    https://zenodo.org/badge/latestdoi/175907357\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitallinguistics%2Fscription2dlx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitallinguistics%2Fscription2dlx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitallinguistics%2Fscription2dlx/lists"}