This is a set of JavaScript/Python3/PHP functions (unified over the three implementations, a Rust Version could be foubnd in this repository: https://github.com/ecomp-shONgit/string-thing) that represent a minimum of text normalization (cleaning) for the work with Latin and polytonic Greek digital texts (UTF8). You can realize different levels of text normalization. There is a documented set of functions to be called on text or tokens (a set of tokens is created by a .split( " " ) on a string considered to be a space separated text).
Definition: A text normalization is everything done to equalize encoding, appearance and composition of a sequence of signs called a text. There are two goals of normalization. The first is a common ground of signs and the second is a reduction of differences between two sequences of signs. Not every normalization step is useful for every comparison task! Remember: Sometimes it is important to not equalize word forms and sometimes it is important.
Include it to your website: <script type="text/javascript" src="textnorm.js"></script>
Or use the example: Download the github repository, unzip it and open textnorm.html, see JavaScript file for the demUsage( ) function.
Demo JS: http://www.ecomparatio.net/~khk/textnorm/textnorm.html (input own text)
Demo PHP: http://www.ecomparatio.net/~khk/textnorm/textnorm.php (output as txt: http://www.ecomparatio.net/~khk/textnorm/test_out_strnorm.txt)
Note: we cover very view ligatures and no abbreviations. The list of ligatures and abbreviations will be very long. Often ligatures and abbreviations broken down through the transcription process. If work on this is needed let us know.
For the purpose of text analysis it is suitable to use the NFD and for the purpose display the NFC is better (typography).
Setter for global variable of analysis UTF8-normalform string.
Setter for the global variable of display UTF8-normalform.
Return String with replaced diacritics.
Normalizes the key strings of a dictionary.
Splits the fist string into words and calls norm fkt with second stroing as normalization parameter ("NFD").
Calles norm fkt on whole frist string with second string as normalization parameter.
takes a string, replaces diakritica to have them equaly encoded, return string
Takes array of letters and returns array of array of diacritics and array of letters.
Replaces aspiration in the transliteration of greek to roman letters.
Input a word (string), if it is an elusion it will be expanded.
Takes greek utf8 string and returns transliterated in roman letters utf8 string.
Escapes angle brackets to html encoding.
Basic equalisation and hypenation reversal.
Takes a word utf8 greek and splits the alpha privativum and copulativum from wordform.
Takes greek utf8 string and repleces jota subscriptum with jota adscriptum.
Replaces diacritics.
First letter of string capitalized rest lowercase.
Combination of diacritics removal and jota subscriptum conversion.
Deletes UV, brackets, sigma, grkl, linebreaks, ligatures, punctuation, edition numbering, unknown signs, diacritics.
Takes a string and returns string without the edition numbering i.e. [2].
Takes a string and returns string with ligatures turned to single letters.
Like nodiakinword().
Takes a string and returns the string without punctuation.
Delete some, to the programmer unknown, signs from string.
Input a string and get it back with linebreaks removed.
Input a string and get it back with markup removed.
Input a string and get it back with all small case letters.
Equalize tailing sigma in string.
Input string and get it back with no brackets.
Repaces all u with v.
Input array of words and get it back as array of words with removed hyphenation.
Input a string and get back a string with newlines replaces by spaces.
Input array of words and have the punctuation separated from each word.
Same as delklammern() but on array of words.
Same as iotasubiotoad() but on array of words.
Input a string and get a combination of diacritics disambiguation, normalization, hyphenation removal, linebreak to space, punctuation separation and bracket removal.