alphabetify
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "alphabetify", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Learn a new alphabet by reading a good text in your native alphabet with more and more foreign letters.", | ||
@@ -18,2 +18,3 @@ "author": "David Pomerenke", | ||
"scripts": { | ||
"start": "cd docs && bundle exec jekyll serve", | ||
"build": "webpack", | ||
@@ -28,7 +29,7 @@ "postinstall": "node alphabets/preprocess.mjs", | ||
"devDependencies": { | ||
"c8": "^7.1.0", | ||
"codecov": "^3.6.5", | ||
"webpack": "^4.42.1", | ||
"c8": "^7.1.2", | ||
"codecov": "^3.7.0", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11" | ||
} | ||
} |
@@ -44,6 +44,6 @@ # Alphabetify | ||
The code string specifying the target alphabet: | ||
The code string specifying the target alphabet: | ||
| Code | Alphabet | Quality | | ||
|------------|-------------------|--------------------------| | ||
| ---------- | ----------------- | ------------------------ | | ||
| `cyrl-ru` | Russian | :star::star: | | ||
@@ -57,3 +57,3 @@ | `grek-el` | Modern Greek | :star::star::star: | | ||
The code string specifying the original *language*. (Eurocentrically, the original *alphabet* is always Latin.) | ||
The code string specifying the original *language*. (Eurocentrically, the original *alphabet* is always Latin.) | ||
@@ -65,3 +65,3 @@ Specifying the original language adds some minor language-specific rules. For example, in English the letter *v* will be processed in a similar way to the letter *w*, while in German *v* will be processed in a similar way to *f*. | ||
| Code | Language | | ||
|--------|-------------| | ||
| ------ | ----------- | | ||
| de | German | | ||
@@ -72,32 +72,33 @@ | **en** | **English** | | ||
The integer specifying the proportion of text at the beginning of the `text` string which should not be transliterated at all. 0 by default. | ||
The number 0 ≤ n < 1 specifying the proportion of text at the beginning of the `text` string which should not be transliterated at all. 0 by default. | ||
**`post`** *optional* | ||
The integer specifying the proportion of text at the end of the `text` string which should not be transliterated at all. 0 by default. | ||
The number 0 ≤ n < 1 specifying the proportion of text at the end of the `text` string which should not be transliterated at all. 0 by default. | ||
### Return value | ||
A promise, which on resolution returns the string with the increasingly transliterated text. You can process it by appending something like `.then(output => process(output)).catch(error => throw error)` to the function call. | ||
A promise, which on resolution returns the string with the increasingly transliterated text. You can process it by appending something like `.then(output => process(output)).catch(error => throw error)` to the function call. | ||
### Usage in browser | ||
This module makes use of the `fs` module, which is available in Node JS, but not in the browser. For usage in the browser, use bundling with [Webpack](https://webpack.js.org/) or an equivalent tool and have a look at the configuration in `webpack.config.js`, `docs/webpack-entry.js` and `docs/index.js`. | ||
This module makes use of the `fs` module, which is available in Node JS, but not in the browser. For usage in the browser, use bundling with [Webpack](https://webpack.js.org/) or an equivalent tool and have a look at the configuration in this repository in `webpack.config.js`, `docs/webpack-entry.js` and `docs/index.js`. | ||
## Development | ||
Transliteration rules are converted from a short form (e. g., only involving lowercase letters) in `alphabets/src/` to a long form in `alphabets/build`. This is done with the `alphabets/preprocess` module, which is run by `npm run preprocess`. The code, including the resulting long form rules, is bundled for web use by running `npm run bundle`. | ||
Transliteration rules are converted from a short form (e. g., only involving lowercase letters) in `alphabets/src/` to a long form in `alphabets/build`. This is done with the `alphabets/preprocess` module, which is run by `npm run preprocess`. The code, including the resulting long form rules, is bundled for web use by running `npm run bundle`. | ||
### Transliteration rules | ||
This may be a bit abstract. Have a look into some of the JSON files in the `alphabets` folder to get a better understanding of the notation. | ||
This may be a bit abstract. Have a look into some of the JSON files in the `alphabets` folder to get a better understanding of the notation. | ||
#### Short form | ||
The short form files are found in the folder `alphabets/src`. If you would like to improve the rule sets, this is the place to look at. The files consist of a specification of the alphabet in regex terms (e. g., `a-z` for Latin), some optional macros (that is rules to be run on the rules) and of the list of rule blocks. Each rule block consists of rules in the short form. | ||
The short form files are found in the folder `alphabets/src`. If you would like to improve the rule sets, this is the place to look at. The files consist of a specification of the alphabet in regex terms (e. g., `a-z` for Latin), some optional macros (that is rules to be run on the rules) and of the list of rule blocks. Each rule block consists of rules in the short form. | ||
The short form is a tuple `[a, b, lang]`: | ||
The short form is a tuple `[a, b, lang]`: | ||
- `a` is a regular expression string, `b` is a regular expression replacement string. | ||
- `a` is a regular expression string, `b` is a regular expression replacement string. | ||
- `lang` is an optional specifier of the language to which the rule is restricted, such as `en` or `de`. | ||
- `lang` is an optional specifier of the language to which the rule is restricted, such as `en` or `de`. | ||
@@ -108,3 +109,3 @@ - Only lowercase letters are used in `a` and `b`. Uppercase and mixed-case will be handled automatically. | ||
- The tuples are grouped into array fields. All tuples of one field will always be applied together. That means: Either none of them will be applied or all of them will be applied. | ||
- The tuples are grouped into array fields. All tuples of one field will always be applied together. That means: Either none of them will be applied or all of them will be applied. | ||
@@ -117,13 +118,13 @@ #### Long form | ||
- The pairs are organized in lists, where each element contains all the rules that apply at a transliteration level. | ||
- The pairs are organized in lists, where each element contains all the rules that apply at a transliteration level. | ||
**E. g.:** *There is a text of 100 words. There are 5 (short-form) transliteration rule groups.* | ||
- For the first 20 words, the first element of the (long-form) list will be applied. It contains simply the rules from the first (short-form) rule group. | ||
- For the first 20 words, the first element of the (long-form) list will be applied. It contains simply the rules from the first (short-form) rule group. | ||
- For the next 20 words, the second element of the (long-form) list will be applied. It contains both the rules from the first and the second rule group, in the correct order of their priority. | ||
- For the next 20 words, the second element of the (long-form) list will be applied. It contains both the rules from the first and the second rule group, in the correct order of their priority. | ||
- For words 41-60, the third element of the (long-form) list will be applied. It contains rules from the first, second, and third (short-form) rule group. | ||
- For words 41-60, the third element of the (long-form) list will be applied. It contains rules from the first, second, and third (short-form) rule group. | ||
- Etc. pp. The crucial point is that at each step where an additional rule group is used, the rules have to be sorted again. | ||
- Etc. pp. The crucial point is that at each step where an additional rule group is used, the rules have to be sorted again. | ||
@@ -134,5 +135,5 @@ - There is a separate folder for each source language in the `alphabets/build` folder. | ||
- The aim of the transliteration is not to achieve phonetic equivalence, but rather to establish a simple set of one-to-one (or a-few-to-one) character matchings: I believe this is the easiest way for the reader to spot patterns and to memorize the new alphabet. | ||
- The aim of the transliteration is not to achieve phonetic equivalence, but rather to establish a simple set of one-to-one (or a-few-to-one) character matchings: I believe this is the easiest way for the reader to spot patterns and to memorize the new alphabet. | ||
- However, when there are script-specific concepts which could not be expressed by such simple non-phonetic matchings, phonetics may be taken into account. | ||
- However, when there are script-specific concepts which could not be expressed by such simple non-phonetic matchings, phonetics may be taken into account. | ||
@@ -143,2 +144,2 @@ **E. g.:** the ancient greek *Omega* would probably be omitted in a simple non-phonetic matching, and the English *O* would be matched with *Omikron*. But the reader also wants to learn the letter *Omega*. A replacement rule set which distinguishes *Omikron* from *Omega* must take phonetics into account. | ||
- It is aimed to achieve a balance between keeping the rule set small, and introducing special phonetics-related concepts in a sufficiently accurate way. | ||
- It is aimed to achieve a balance between keeping the rule set small, and introducing special phonetics-related concepts in a sufficiently accurate way. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
883603
15
138