# greek conversion > A TypeScript library that converts Ancient, Byzantine, and Modern Greek between Greek script, Beta Code, and Latin script, with atomic options composed into standards-based presets, and information-loss diagnostics. **Installation** ```sh npm install @humanities/greek-conversion # npm npx jsr add @humanities/greek-conversion # JSR, which gives the command for each runtime ``` The package is ESM-only and ships its own type declarations. CommonJS code loads it with `require()`, as Node.js loads ES modules; TypeScript resolves its types there from version 5.8, under `module: "nodenext"`. The unscoped npm package `greek-conversion` is the `0.14.x` series, which is deprecated; its source is on the [`legacy`](https://github.com/defense-humanites/greek-conversion/tree/legacy) branch, and the [migration guide](https://github.com/defense-humanites/greek-conversion/blob/main/MIGRATION.md#from-014x) shows how to move from it. **Main functions** | You want to… | Use | | ------------------------------------------------------------------------ | --------------------------------------------------------------------- | | Convert a string | `convert(input, from, to, options?)` | | Normalize or restyle a string without changing its format | `reencode(input, format, options?)` | | Know whether the conversion loses information, and where each token went | `convertDetailed(input, from, to, options?)` | | Convert only the Greek of a text in another language | `convertGreekPassages(input, to, options?)` | | Add characters, or restrict them to a list or to a preset's | the `characters` option of the functions above | | Inspect or edit the parsed text itself | `parse()` and `encode()` from `@humanities/greek-conversion/document` | | Bundle only the formats and presets a web page uses | `convert()` from `@humanities/greek-conversion/core` | Every page of this site is also in Markdown: add `index.md` to its address, as the links below do. ## Start here - [Getting started](https://greek-conversion.humanites.fr/guide/getting-started/index.md): Install greek-conversion, convert a first text, and set a conversion with options and presets. - [How it works](https://greek-conversion.humanites.fr/guide/how-it-works/index.md): The three formats, the canonical document, the option groups, and which function to use. - [Glossary](https://greek-conversion.humanites.fr/guide/glossary/index.md): The terms this documentation uses for Greek writing, its romanizations, and the library's own notions. ## Your Greek - [Ancient Greek](https://greek-conversion.humanites.fr/guide/ancient-greek/index.md): Convert polytonic Greek to and from Beta Code and the scholarly and library romanizations, and know which of them convert back. - [Byzantine and Medieval Greek](https://greek-conversion.humanites.fr/guide/byzantine-greek/index.md): Convert Byzantine texts: the conventions that cover the period, breathings written before a capital, the lunate sigma, numerals, uncial-style output, signs for several letters, the overline and the expansion of abbreviations, and punctuation. - [Modern Greek](https://greek-conversion.humanites.fr/guide/modern-greek/index.md): Romanize Modern Greek names and texts after ISO 843, ELOT 743, or ALA-LC, read them back, and turn polytonic text into monotonic. ## Standards and presets - [Choosing a preset](https://greek-conversion.humanites.fr/guide/presets/index.md): The presets that implement published conventions, what each one loses, and how to refine them. - [Preset reference](https://greek-conversion.humanites.fr/reference/presets/index.md): A preset is a named, coherent set of ordinary `ConversionOptions`. ## Information loss - [What formats and options lose](https://greek-conversion.humanites.fr/guide/format-and-option-losses/index.md): Which distinctions each format and each option can lose, which changes are not losses, and where the contract states them. - [Knowing what a conversion loses](https://greek-conversion.humanites.fr/guide/losses/index.md): Find out what a conversion cannot keep, and where. ## Recipes - [Diacritics and Unicode output](https://greek-conversion.humanites.fr/guide/recipes/diacritics-and-unicode/index.md): Remove all or some diacritics, produce monotonic Greek, and choose how Greek is encoded. - [Transliteration and Beta Code](https://greek-conversion.humanites.fr/guide/recipes/transliteration-and-beta-code/index.md): Choose transliteration spellings, restyle a transliteration, and write Beta Code the TLG way. - [Letters and text](https://greek-conversion.humanites.fr/guide/recipes/letters-and-text/index.md): Keep or fold letter forms, write the iota on the line, aspirate an elided consonant, normalize case and whitespace, convert the Greek of a text in another language, and build a search key. ## Going further - [Options, characters, and errors](https://greek-conversion.humanites.fr/guide/options/index.md): Check options, prepare them once, add or restrict characters, and hold a text to the characters of a preset. - [The canonical document](https://greek-conversion.humanites.fr/guide/document/index.md): Parse a text once, read its letters and marks, validate it, and encode it in any format. - [Smaller bundles](https://greek-conversion.humanites.fr/guide/smaller-bundles/index.md): Bundle only the formats and presets a web application uses, with the core entry point, readers and writers, and prepared options. - [Performance](https://greek-conversion.humanites.fr/guide/performance/index.md): How fast the library converts, what each call costs, and how to keep conversions fast on long texts, on many short strings, and in memory. ## Reference - [Guarantees and limits](https://greek-conversion.humanites.fr/reference/guarantees/index.md): This document states what every conversion guarantees, what the library deliberately leaves to the caller, and where each behavior is specified in detail. - [Conversion options](https://greek-conversion.humanites.fr/reference/options/index.md): Every conversion function takes the same `ConversionOptions`; those of the `core` and `document` entry points take `StyleOptions`, the same options without `characters`. - [Greek output](https://greek-conversion.humanites.fr/reference/greek-unicode/index.md): Greek accentuation and Unicode representation are independent stages. - [Punctuation and numerals](https://greek-conversion.humanites.fr/reference/punctuation-and-numerals/index.md): Greek writes a few signs otherwise than Latin script does, and counts with letters marked by a keraia. - [Information-loss contract](https://greek-conversion.humanites.fr/reference/information-loss/index.md): Conversion is defined as parsing a source string into the canonical `Document` model, applying target orthography, and encoding one canonical spelling. - [Conversion-analysis contract](https://greek-conversion.humanites.fr/reference/conversion-analysis/index.md): `convertDetailed()` returns the converted text together with an analysis of the information retained by the target representation. - [Character extensions and repertoires](https://greek-conversion.humanites.fr/reference/character-extensions/index.md): The conversion functions use a closed, standards-oriented Greek alphabet. - [Document API contract](https://greek-conversion.humanites.fr/reference/document-api/index.md): The `@humanities/greek-conversion/document` entry point is for applications that need to inspect, validate, or transform one parsed Greek representation. - [Validation contract](https://greek-conversion.humanites.fr/reference/validation/index.md): `validateDocument()` checks that a canonical document is well-formed Greek. - [Stability policy](https://greek-conversion.humanites.fr/reference/stability/index.md): The library follows Semantic Versioning. ## Python The Python package, `greek-conversion` on PyPI, runs the library in Python, with its functions and option keys in snake_case. Its documentation has an index of its own: [python/llms.txt](https://greek-conversion.humanites.fr/python/llms.txt). - [Getting started](https://greek-conversion.humanites.fr/python/guide/getting-started/index.md): Install greek-conversion for Python, convert a first text, set a conversion with options and presets, and convert a corpus in one call. - [How it works](https://greek-conversion.humanites.fr/python/guide/how-it-works/index.md): The three formats, the canonical document, the option groups, and which function to use. - [Glossary](https://greek-conversion.humanites.fr/python/guide/glossary/index.md): The terms this documentation uses for Greek writing, its romanizations, and the library's own notions. - [Ancient Greek](https://greek-conversion.humanites.fr/python/guide/ancient-greek/index.md): Convert polytonic Greek to and from Beta Code and the scholarly and library romanizations, and know which of them convert back. - [Byzantine and Medieval Greek](https://greek-conversion.humanites.fr/python/guide/byzantine-greek/index.md): Convert Byzantine texts: the conventions that cover the period, breathings written before a capital, the lunate sigma, numerals, uncial-style output, signs for several letters, the overline and the expansion of abbreviations, and punctuation. - [Modern Greek](https://greek-conversion.humanites.fr/python/guide/modern-greek/index.md): Romanize Modern Greek names and texts after ISO 843, ELOT 743, or ALA-LC, read them back, and turn polytonic text into monotonic. - [Choosing a preset](https://greek-conversion.humanites.fr/python/guide/presets/index.md): The presets that implement published conventions, what each one loses, and how to refine them. - [Preset reference](https://greek-conversion.humanites.fr/python/reference/presets/index.md): A preset is a named, coherent set of ordinary `ConversionOptions`. - [Preset behavior audit](https://greek-conversion.humanites.fr/python/reference/preset-behavior-audit/index.md): This is a targeted audit of diacritics, punctuation, and numerals beyond the character repertoire audit. - [Preset character repertoire audit](https://greek-conversion.humanites.fr/python/reference/preset-repertoire-audit/index.md): This audit compares the semantic letters built into the engine with the character repertoire supported by each preset's cited references. - [ALA-LC conformance corpus](https://greek-conversion.humanites.fr/python/reference/ala-lc-conformance-corpus/index.md): The executable examples in `tests/ala_lc_conformance_test.ts` are checked against the Library of Congress's published Ancient and Medieval Greek and Modern Greek tables, which the `ala-lc-ancient` and `ala-lc-modern` presets implement. - [BnF, ISO 843, and BGN/PCGN conformance corpus](https://greek-conversion.humanites.fr/python/reference/preset-conformance-corpus/index.md): The spellings in the executable cases in `tests/preset_conformance_test.ts` come from the cited tables and examples. - [What formats and options lose](https://greek-conversion.humanites.fr/python/guide/format-and-option-losses/index.md): Which distinctions each format and each option can lose, which changes are not losses, and where the contract states them. - [Knowing what a conversion loses](https://greek-conversion.humanites.fr/python/guide/losses/index.md): Find out what a conversion cannot keep, and where. - [Diacritics and Unicode output](https://greek-conversion.humanites.fr/python/guide/recipes/diacritics-and-unicode/index.md): Remove all or some diacritics, produce monotonic Greek, and choose how Greek is encoded. - [Transliteration and Beta Code](https://greek-conversion.humanites.fr/python/guide/recipes/transliteration-and-beta-code/index.md): Choose transliteration spellings, restyle a transliteration, and write Beta Code the TLG way. - [Letters and text](https://greek-conversion.humanites.fr/python/guide/recipes/letters-and-text/index.md): Keep or fold letter forms, write the iota on the line, aspirate an elided consonant, normalize case and whitespace, convert the Greek of a text in another language, and build a search key. - [The Python package](https://greek-conversion.humanites.fr/python/package/index.md): The Python package runs the TypeScript library in an embedded engine: the same results and versions, Python's names and positions, the engines and their speed, processes, threads, and types. - [Options, characters, and errors](https://greek-conversion.humanites.fr/python/guide/options/index.md): Check options, prepare them once, add or restrict characters, and hold a text to the characters of a preset. - [Performance](https://greek-conversion.humanites.fr/python/guide/performance/index.md): How fast the Python package converts on each engine, what a call costs, which engine to choose, and how to keep conversions fast on many short strings, on long texts, and across processes. - [Guarantees and limits](https://greek-conversion.humanites.fr/python/reference/guarantees/index.md): This document states what every conversion guarantees, what the library deliberately leaves to the caller, and where each behavior is specified in detail. - [Conversion options](https://greek-conversion.humanites.fr/python/reference/options/index.md): Every conversion function takes the same `ConversionOptions`. - [Greek output](https://greek-conversion.humanites.fr/python/reference/greek-unicode/index.md): Greek accentuation and Unicode representation are independent stages. - [Punctuation and numerals](https://greek-conversion.humanites.fr/python/reference/punctuation-and-numerals/index.md): Greek writes a few signs otherwise than Latin script does, and counts with letters marked by a keraia. - [Information-loss contract](https://greek-conversion.humanites.fr/python/reference/information-loss/index.md): Conversion is defined as parsing a source string into the canonical `Document` model, applying target orthography, and encoding one canonical spelling. - [Conversion-analysis contract](https://greek-conversion.humanites.fr/python/reference/conversion-analysis/index.md): `convert_detailed()` returns the converted text together with an analysis of the information retained by the target representation. - [Character extensions and repertoires](https://greek-conversion.humanites.fr/python/reference/character-extensions/index.md): The conversion functions use a closed, standards-oriented Greek alphabet. - [Stability policy](https://greek-conversion.humanites.fr/python/reference/stability/index.md): The library follows Semantic Versioning. - [API reference](https://greek-conversion.humanites.fr/python/reference/api/index.md): Every function, class, constant, and type of the Python package, from its docstrings. ## Optional - [Conformance: Preset behavior audit](https://greek-conversion.humanites.fr/reference/preset-behavior-audit/index.md): This is a targeted audit of diacritics, punctuation, and numerals beyond the character repertoire audit. - [Conformance: Preset character repertoire audit](https://greek-conversion.humanites.fr/reference/preset-repertoire-audit/index.md): This audit compares the semantic letters built into the engine with the character repertoire supported by each preset's cited references. - [Conformance: ALA-LC conformance corpus](https://greek-conversion.humanites.fr/reference/ala-lc-conformance-corpus/index.md): The executable examples in `tests/ala_lc_conformance_test.ts` are checked against the Library of Congress's published Ancient and Medieval Greek and Modern Greek tables, which the `ala-lc-ancient` and `ala-lc-modern` presets implement. - [Conformance: BnF, ISO 843, and BGN/PCGN conformance corpus](https://greek-conversion.humanites.fr/reference/preset-conformance-corpus/index.md): The spellings in the executable cases in `tests/preset_conformance_test.ts` come from the cited tables and examples. - [API: entry points](https://greek-conversion.humanites.fr/api/readme/index.md): Most programs need only the first of the package's two main entry points. - [API: @humanities/greek-conversion](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/readme/index.md): Convert Ancient, Byzantine, and Modern Greek between Greek script, Beta Code, and Latin script, with atomic options composed into standards-based presets, and information-loss diagnostics. - [API: @humanities/greek-conversion/core](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/core/readme/index.md): Conversions that bring into a bundle only the formats and the options they are given. - [API: @humanities/greek-conversion/greek](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/greek/readme/index.md): The Greek reader and writer, for the functions of the `./core` entry point. - [API: @humanities/greek-conversion/presets](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/presets/readme/index.md): The presets as prepared options, for the functions of the `./core` entry point. - [API: @humanities/greek-conversion/document](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/document/readme/index.md): Advanced access to the canonical document used by the conversion engine. - [API: @humanities/greek-conversion/beta-code](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/beta-code/readme/index.md): The Beta Code reader and writer, for the functions of the `./core` entry point. - [API: @humanities/greek-conversion/transliteration](https://greek-conversion.humanites.fr/api/humanities/greek-conversion/transliteration/readme/index.md): The transliteration reader and writer, for the functions of the `./core` entry point. - [Project: Changelog](https://raw.githubusercontent.com/defense-humanites/greek-conversion/main/CHANGELOG.md) - [Project: Migration guide](https://raw.githubusercontent.com/defense-humanites/greek-conversion/main/MIGRATION.md) - [Project: Contributing](https://raw.githubusercontent.com/defense-humanites/greek-conversion/main/CONTRIBUTING.md)