Browse Source

Rebrand to ScriptShifter.

Stefano Cossu 1 year ago
parent
commit
58cd0be0fd
49 changed files with 36 additions and 36 deletions
  1. 2 2
      Dockerfile
  2. 3 3
      NOTES.md
  3. 3 3
      README.md
  4. 4 4
      doc/config.md
  5. 5 5
      doc/hooks.md
  6. 1 1
      doc/rest_api.md
  7. 2 2
      entrypoint.sh
  8. 0 0
      scriptshifter/__init__.py
  9. 0 0
      scriptshifter/exceptions.py
  10. 0 0
      scriptshifter/hooks/__init__.py
  11. 1 1
      scriptshifter/hooks/test.py
  12. 2 2
      scriptshifter/rest_api.py
  13. 0 0
      scriptshifter/static/milligram.min.css
  14. 0 0
      scriptshifter/static/milligram.min.css.map
  15. 0 0
      scriptshifter/static/normalize.css
  16. 2 2
      scriptshifter/tables/__init__.py
  17. 0 0
      scriptshifter/tables/data/_cyrillic_base.yml
  18. 0 0
      scriptshifter/tables/data/_ignore_base.yml
  19. 0 0
      scriptshifter/tables/data/armenian.yml
  20. 0 0
      scriptshifter/tables/data/asian_cyrillic.yml
  21. 0 0
      scriptshifter/tables/data/azerbaijani.yml
  22. 0 0
      scriptshifter/tables/data/belarusian.yml
  23. 0 0
      scriptshifter/tables/data/bulgarian.yml
  24. 0 0
      scriptshifter/tables/data/chinese.yml
  25. 0 0
      scriptshifter/tables/data/church_slavonic.yml
  26. 0 0
      scriptshifter/tables/data/ethiopic.yml
  27. 0 0
      scriptshifter/tables/data/georgian.yml
  28. 0 0
      scriptshifter/tables/data/hindi.yml
  29. 0 0
      scriptshifter/tables/data/index.yml
  30. 0 0
      scriptshifter/tables/data/kazakh.yml
  31. 0 0
      scriptshifter/tables/data/kyrgyz.yml
  32. 0 0
      scriptshifter/tables/data/mongolian.yml
  33. 0 0
      scriptshifter/tables/data/mongolian_mongol_bichig.yml
  34. 0 0
      scriptshifter/tables/data/russian.yml
  35. 0 0
      scriptshifter/tables/data/serbian_macedonian.yml
  36. 0 0
      scriptshifter/tables/data/tajik.yml
  37. 0 0
      scriptshifter/tables/data/tatar.yml
  38. 0 0
      scriptshifter/tables/data/turkmen.yml
  39. 0 0
      scriptshifter/tables/data/ukrainian.yml
  40. 0 0
      scriptshifter/tables/data/uzbek.yml
  41. 0 0
      scriptshifter/templates/index.html
  42. 0 0
      scriptshifter/templates/layout.html
  43. 0 0
      scriptshifter/templates/navbar.html
  44. 0 0
      scriptshifter/templates/transliterate.html
  45. 2 2
      scriptshifter/trans.py
  46. 3 3
      tests/test01_cfg.py
  47. 5 5
      tests/test02_transliteration.py
  48. 0 0
      transliterator/convert.py
  49. 1 1
      wsgi.py

+ 2 - 2
Dockerfile

@@ -3,13 +3,13 @@ FROM python:3.9-alpine3.15
 RUN apk add --no-cache -t buildtools build-base
 RUN apk add --no-cache -t buildtools build-base
 RUN apk add --no-cache linux-headers
 RUN apk add --no-cache linux-headers
 
 
-ENV _workroot "/usr/local/transliterator/src"
+ENV _workroot "/usr/local/scriptshifter/src"
 
 
 WORKDIR ${_workroot}
 WORKDIR ${_workroot}
 COPY requirements.txt ./
 COPY requirements.txt ./
 RUN pip install -r requirements.txt
 RUN pip install -r requirements.txt
 COPY entrypoint.sh uwsgi.ini wsgi.py ./
 COPY entrypoint.sh uwsgi.ini wsgi.py ./
-COPY transliterator ./transliterator/
+COPY scriptshifter ./scriptshifter/
 RUN chmod +x ./entrypoint.sh
 RUN chmod +x ./entrypoint.sh
 
 
 RUN addgroup -S www && adduser -S www -G www
 RUN addgroup -S www && adduser -S www -G www

+ 3 - 3
NOTES.md

@@ -3,7 +3,7 @@
 ## `.cfg` files
 ## `.cfg` files
 
 
 The `.cfg` format seems to follow a INI-like syntax that is ad-hoc-parsed by
 The `.cfg` format seems to follow a INI-like syntax that is ad-hoc-parsed by
-the Transliterator.
+the ScriptShifter.
 
 
 Unicode points are expressed as `U+????` rather than `\x????` of the standard
 Unicode points are expressed as `U+????` rather than `\x????` of the standard
 INI syntax.
 INI syntax.
@@ -54,7 +54,7 @@ A (RB): Yes.
 ## `ReRomanizeRecord.bas`
 ## `ReRomanizeRecord.bas`
 
 
 Much of the code deals with MARC records. No need to concern about that since
 Much of the code deals with MARC records. No need to concern about that since
-the new Transliterator is meant to convert text strings to text strings.
+the new ScriptShifter is meant to convert text strings to text strings.
 
 
 Q: Is it possible (and desirable) to determine the S2R/R2S direction from user
 Q: Is it possible (and desirable) to determine the S2R/R2S direction from user
 prompt rather than guessing it from the text as the legacy software seems to
 prompt rather than guessing it from the text as the legacy software seems to
@@ -248,7 +248,7 @@ HTML or Markdown, so this may need to be taken into account.)
 Q: It seems like several characters are parsed and added to the text to denote
 Q: It seems like several characters are parsed and added to the text to denote
 MARC markers. Do we need to deal with these manually as indicators related to
 MARC markers. Do we need to deal with these manually as indicators related to
 the script/language handled, or shall we expect any text string input in the
 the script/language handled, or shall we expect any text string input in the
-new Transliterator to be clean from MARC flags? 
+new ScriptShifter to be clean from MARC flags? 
 
 
 A (RB): Most  MARC markers are obsolete; but there may be other  markers that
 A (RB): Most  MARC markers are obsolete; but there may be other  markers that
 are not easily transliterated, e.g. BIBFRAME markers. More discussion is needed
 are not easily transliterated, e.g. BIBFRAME markers. More discussion is needed

+ 3 - 3
README.md

@@ -1,4 +1,4 @@
-# transliterator
+# ScriptShifter
 
 
 REST API service to convert non-Latin scripts to Latin, and vice versa.
 REST API service to convert non-Latin scripts to Latin, and vice versa.
 
 
@@ -7,13 +7,13 @@ REST API service to convert non-Latin scripts to Latin, and vice versa.
 Build container in current dir:
 Build container in current dir:
 
 
 ```
 ```
-docker build -t transliterator:latest .
+docker build -t scriptshifter:latest .
 ```
 ```
 
 
 Start container:
 Start container:
 
 
 ```
 ```
-docker run -e TXL_FLASK_SECRET=changeme -p 8000:8000 transliterator:latest
+docker run -e TXL_FLASK_SECRET=changeme -p 8000:8000 scriptshifter:latest
 ```
 ```
 
 
 For running in development mode, add `-e FLASK_ENV=development` to the options.
 For running in development mode, add `-e FLASK_ENV=development` to the options.

+ 4 - 4
doc/config.md

@@ -1,4 +1,4 @@
-# Transliterator configuration file format
+# ScriptShifter configuration file format
 
 
 Language transliteration is made according to set of rules contained in static
 Language transliteration is made according to set of rules contained in static
 files. Generally, each file represents one script and one language, but there
 files. Generally, each file represents one script and one language, but there
@@ -6,7 +6,7 @@ may be exception to this rule in cases of multiple languages sharing the same
 script.
 script.
 
 
 Configuration files, also called transliteration tables, are contained in the
 Configuration files, also called transliteration tables, are contained in the
-[`/transliterator/tables/data`](../transliterator/tables/data) directory.
+[`/scriptshifter/tables/data`](../scriptshifter/tables/data) directory.
 
 
 ## Types of configuration files
 ## Types of configuration files
 
 
@@ -189,7 +189,7 @@ Each key in this section is one of the predefined hook names and is paired with
 a list of functions that shall be run when the life cycle point designated for
 a list of functions that shall be run when the life cycle point designated for
 the hook is reached. Each function definition is a list of one or two elements.
 the hook is reached. Each function definition is a list of one or two elements.
 The first is the function path including the path, relative to the
 The first is the function path including the path, relative to the
-`transliterator.hooks` package. The second, optional element, is a map of
+`scriptshifter.hooks` package. The second, optional element, is a map of
 key-value pairs provding additional keyword arguments for the function. These
 key-value pairs provding additional keyword arguments for the function. These
 arguments are fixed for all the calls to this function made by this hook.
 arguments are fixed for all the calls to this function made by this hook.
 
 
@@ -207,7 +207,7 @@ script_to_roman:
 ```
 ```
 
 
 runs the function `myfn(ctx, x=32, y="hello")` in
 runs the function `myfn(ctx, x=32, y="hello")` in
-`transliterator.hooks.my_module` (`ctx` is always provided by the application)
+`scriptshifter.hooks.my_module` (`ctx` is always provided by the application)
 for the `pre_tx_token` hook.
 for the `pre_tx_token` hook.
 
 
 ### `script_to_roman`
 ### `script_to_roman`

+ 5 - 5
doc/hooks.md

@@ -1,4 +1,4 @@
-# Transliterator life cycle hooks
+# ScriptShifter life cycle hooks
 
 
 This is a guide for language specialists with some Python development skills,
 This is a guide for language specialists with some Python development skills,
 or who can partner with Python developers to create new, complex
 or who can partner with Python developers to create new, complex
@@ -98,12 +98,12 @@ Hook functions may be defined for each language/script in the corresponding
 configuration file. See [`config.md`](./config.md) for details.
 configuration file. See [`config.md`](./config.md) for details.
 
 
 The function name takes the form of `<module name>.<function name>` and must
 The function name takes the form of `<module name>.<function name>` and must
-correspond to an existing module and function under the `transliterator.hooks`
-package. Check the [`rot3.yml`](../transliterator/tables/data/rot3.yml) test
+correspond to an existing module and function under the `scriptshifter.hooks`
+package. Check the [`rot3.yml`](../scriptshifter/tables/data/rot3.yml) test
 configuration and the referred functions for a working example.
 configuration and the referred functions for a working example.
 
 
 Each hook requires some arguments to be defined in each function associated
 Each hook requires some arguments to be defined in each function associated
-with it: `ctx`, an instance of `transliterator.trans.Context` which carries
+with it: `ctx`, an instance of `scriptshifter.trans.Context` which carries
 information about the current scanner status and can be manipulated by the hook
 information about the current scanner status and can be manipulated by the hook
 function; and `**kw`, optional keyword-only arguments, whose values can be
 function; and `**kw`, optional keyword-only arguments, whose values can be
 defined in the configuration.
 defined in the configuration.
@@ -112,7 +112,7 @@ Each function must also return an output that the process is able to handle as
 expected. the output may instruct the application to make a specific decision
 expected. the output may instruct the application to make a specific decision
 after the hook function is executed. Possible return values are defined below
 after the hook function is executed. Possible return values are defined below
 for each hook. Some special return values, such as `BREAK` and `CONT`, are
 for each hook. Some special return values, such as `BREAK` and `CONT`, are
-registered as constants under `transliterator.exceptions`.
+registered as constants under `scriptshifter.exceptions`.
 
 
 **[TODO]** These hooks are being implemented in a vacuum, without much of a
 **[TODO]** These hooks are being implemented in a vacuum, without much of a
 real-world use case. Modifications to these capabilities may change as actual
 real-world use case. Modifications to these capabilities may change as actual

+ 1 - 1
doc/rest_api.md

@@ -1,4 +1,4 @@
-# Transliterator REST API
+# ScriptShifter REST API
 
 
 ## `GET /health`
 ## `GET /health`
 
 

+ 2 - 2
entrypoint.sh

@@ -1,8 +1,8 @@
 #!/bin/sh
 #!/bin/sh
 
 
 export PYTHONPATH=$PYTHONPATH:.
 export PYTHONPATH=$PYTHONPATH:.
-export WEBAPP_PIDFILE="/run/transliterator_webapp.pid"
-export FLASK_APP="transliterator.rest_api"
+export WEBAPP_PIDFILE="/run/scriptshifter_webapp.pid"
+export FLASK_APP="scriptshifter.rest_api"
 if [ "${TXL_APP_MODE}" == "development" ]; then
 if [ "${TXL_APP_MODE}" == "development" ]; then
     export FLASK_ENV="development"
     export FLASK_ENV="development"
 else
 else

+ 0 - 0
transliterator/__init__.py → scriptshifter/__init__.py


+ 0 - 0
transliterator/exceptions.py → scriptshifter/exceptions.py


+ 0 - 0
transliterator/hooks/__init__.py → scriptshifter/hooks/__init__.py


+ 1 - 1
transliterator/hooks/test.py → scriptshifter/hooks/test.py

@@ -1,6 +1,6 @@
 import logging
 import logging
 
 
-from transliterator.exceptions import CONT
+from scriptshifter.exceptions import CONT
 
 
 
 
 __doc__ = """ Test hook functions. """
 __doc__ = """ Test hook functions. """

+ 2 - 2
transliterator/rest_api.py → scriptshifter/rest_api.py

@@ -3,8 +3,8 @@ from os import environ
 
 
 from flask import Flask, Response, jsonify, render_template, request
 from flask import Flask, Response, jsonify, render_template, request
 
 
-from transliterator.tables import list_tables, load_table
-from transliterator.trans import transliterate
+from scriptshifter.tables import list_tables, load_table
+from scriptshifter.trans import transliterate
 
 
 
 
 def create_app():
 def create_app():

+ 0 - 0
transliterator/static/milligram.min.css → scriptshifter/static/milligram.min.css


+ 0 - 0
transliterator/static/milligram.min.css.map → scriptshifter/static/milligram.min.css.map


+ 0 - 0
transliterator/static/normalize.css → scriptshifter/static/normalize.css


+ 2 - 2
transliterator/tables/__init__.py → scriptshifter/tables/__init__.py

@@ -11,7 +11,7 @@ try:
 except ImportError:
 except ImportError:
     from yaml import Loader
     from yaml import Loader
 
 
-from transliterator.exceptions import ConfigError
+from scriptshifter.exceptions import ConfigError
 
 
 
 
 __doc__ = """
 __doc__ = """
@@ -39,7 +39,7 @@ HOOKS = (
     "post_assembly",
     "post_assembly",
 )
 )
 # Package path where hook functions are kept.
 # Package path where hook functions are kept.
-HOOK_PKG_PATH = "transliterator.hooks"
+HOOK_PKG_PATH = "scriptshifter.hooks"
 
 
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 
 

+ 0 - 0
transliterator/tables/data/_cyrillic_base.yml → scriptshifter/tables/data/_cyrillic_base.yml


+ 0 - 0
transliterator/tables/data/_ignore_base.yml → scriptshifter/tables/data/_ignore_base.yml


+ 0 - 0
transliterator/tables/data/armenian.yml → scriptshifter/tables/data/armenian.yml


+ 0 - 0
transliterator/tables/data/asian_cyrillic.yml → scriptshifter/tables/data/asian_cyrillic.yml


+ 0 - 0
transliterator/tables/data/azerbaijani.yml → scriptshifter/tables/data/azerbaijani.yml


+ 0 - 0
transliterator/tables/data/belarusian.yml → scriptshifter/tables/data/belarusian.yml


+ 0 - 0
transliterator/tables/data/bulgarian.yml → scriptshifter/tables/data/bulgarian.yml


+ 0 - 0
transliterator/tables/data/chinese.yml → scriptshifter/tables/data/chinese.yml


+ 0 - 0
transliterator/tables/data/church_slavonic.yml → scriptshifter/tables/data/church_slavonic.yml


+ 0 - 0
transliterator/tables/data/ethiopic.yml → scriptshifter/tables/data/ethiopic.yml


+ 0 - 0
transliterator/tables/data/georgian.yml → scriptshifter/tables/data/georgian.yml


+ 0 - 0
transliterator/tables/data/hindi.yml → scriptshifter/tables/data/hindi.yml


+ 0 - 0
transliterator/tables/data/index.yml → scriptshifter/tables/data/index.yml


+ 0 - 0
transliterator/tables/data/kazakh.yml → scriptshifter/tables/data/kazakh.yml


+ 0 - 0
transliterator/tables/data/kyrgyz.yml → scriptshifter/tables/data/kyrgyz.yml


+ 0 - 0
transliterator/tables/data/mongolian.yml → scriptshifter/tables/data/mongolian.yml


+ 0 - 0
transliterator/tables/data/mongolian_mongol_bichig.yml → scriptshifter/tables/data/mongolian_mongol_bichig.yml


+ 0 - 0
transliterator/tables/data/russian.yml → scriptshifter/tables/data/russian.yml


+ 0 - 0
transliterator/tables/data/serbian_macedonian.yml → scriptshifter/tables/data/serbian_macedonian.yml


+ 0 - 0
transliterator/tables/data/tajik.yml → scriptshifter/tables/data/tajik.yml


+ 0 - 0
transliterator/tables/data/tatar.yml → scriptshifter/tables/data/tatar.yml


+ 0 - 0
transliterator/tables/data/turkmen.yml → scriptshifter/tables/data/turkmen.yml


+ 0 - 0
transliterator/tables/data/ukrainian.yml → scriptshifter/tables/data/ukrainian.yml


+ 0 - 0
transliterator/tables/data/uzbek.yml → scriptshifter/tables/data/uzbek.yml


+ 0 - 0
transliterator/templates/index.html → scriptshifter/templates/index.html


+ 0 - 0
transliterator/templates/layout.html → scriptshifter/templates/layout.html


+ 0 - 0
transliterator/templates/navbar.html → scriptshifter/templates/navbar.html


+ 0 - 0
transliterator/templates/transliterate.html → scriptshifter/templates/transliterate.html


+ 2 - 2
transliterator/trans.py → scriptshifter/trans.py

@@ -1,8 +1,8 @@
 import logging
 import logging
 import re
 import re
 
 
-from transliterator.exceptions import BREAK, CONT
-from transliterator.tables import load_table
+from scriptshifter.exceptions import BREAK, CONT
+from scriptshifter.tables import load_table
 
 
 
 
 # Match multiple spaces.
 # Match multiple spaces.

+ 3 - 3
tests/test01_cfg.py

@@ -4,7 +4,7 @@ from importlib import reload
 from os import environ
 from os import environ
 
 
 from tests import TEST_DATA_DIR
 from tests import TEST_DATA_DIR
-import transliterator.tables
+import scriptshifter.tables
 
 
 
 
 class TestConfig(TestCase):
 class TestConfig(TestCase):
@@ -12,8 +12,8 @@ class TestConfig(TestCase):
 
 
     def test_ordering(self):
     def test_ordering(self):
         environ["TXL_CONFIG_TABLE_DIR"] = TEST_DATA_DIR
         environ["TXL_CONFIG_TABLE_DIR"] = TEST_DATA_DIR
-        reload(transliterator.tables)  # Reload new config dir.
-        from transliterator import tables
+        reload(scriptshifter.tables)  # Reload new config dir.
+        from scriptshifter import tables
         tables.list_tables.cache_clear()
         tables.list_tables.cache_clear()
         tables.load_table.cache_clear()
         tables.load_table.cache_clear()
 
 

+ 5 - 5
tests/test02_transliteration.py

@@ -7,8 +7,8 @@ from importlib import reload
 from os import environ, path
 from os import environ, path
 
 
 from tests import TEST_DATA_DIR
 from tests import TEST_DATA_DIR
-from transliterator.trans import transliterate
-import transliterator.tables
+from scriptshifter.trans import transliterate
+import scriptshifter.tables
 
 
 
 
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
@@ -32,7 +32,7 @@ class TestTrans(TestCase):
         This function name won't start with `test_` otherwise will be
         This function name won't start with `test_` otherwise will be
         automatically run without parameters.
         automatically run without parameters.
         """
         """
-        config = transliterator.tables.load_table(self.tbl)
+        config = scriptshifter.tables.load_table(self.tbl)
         if "script_to_roman" in config:
         if "script_to_roman" in config:
             txl = transliterate(self.script, self.tbl)
             txl = transliterate(self.script, self.tbl)
             self.assertEqual(txl, self.roman)
             self.assertEqual(txl, self.roman)
@@ -44,7 +44,7 @@ class TestTrans(TestCase):
         This function name won't start with `test_` otherwise will be
         This function name won't start with `test_` otherwise will be
         automatically run without parameters.
         automatically run without parameters.
         """
         """
-        config = transliterator.tables.load_table(self.tbl)
+        config = scriptshifter.tables.load_table(self.tbl)
         if "roman_to_script" in config:
         if "roman_to_script" in config:
             txl = transliterate(self.roman, self.tbl, r2s=True)
             txl = transliterate(self.roman, self.tbl, r2s=True)
             self.assertEqual(txl, self.script)
             self.assertEqual(txl, self.script)
@@ -76,6 +76,6 @@ def make_suite():
 
 
 if "TXL_CONFIG_TABLE_DIR" in environ:
 if "TXL_CONFIG_TABLE_DIR" in environ:
     del environ["TXL_CONFIG_TABLE_DIR"]
     del environ["TXL_CONFIG_TABLE_DIR"]
-    reload(transliterator.tables)
+    reload(scriptshifter.tables)
 
 
 TextTestRunner().run(make_suite())
 TextTestRunner().run(make_suite())

+ 0 - 0
transliterator/convert.py


+ 1 - 1
wsgi.py

@@ -1,4 +1,4 @@
-from transliterator.rest_api import app
+from scriptshifter.rest_api import app
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":