An open API service indexing awesome lists of open source software.

https://github.com/n-y-kim/liblouis-python

how to use liblouis in Python
https://github.com/n-y-kim/liblouis-python

braille liblouis python translation

Last synced: 5 months ago
JSON representation

how to use liblouis in Python

Awesome Lists containing this project

README

          

# How to use: Added by @n-y-kim
‼️DO NOT DOWNLOAD OR CLONE THIS REPO! THIS IS READ ONLY FOR PYTHON USERS‼️


  1. Download the most recent release version from liblouis repo.(zip file)

  2. Check your environment. import louis is not supportable at arm64 architecture(v 3.21.0). Only x86_64 would be able to get the correct path.

  3. Unzip your installed file.

  4. RUN ./configure

  5. RUN make

  6. RUN sudo make install

  7. Move to python folder and RUN python setup.py install

  8. You would be able to import louis and test.


  9. EXAMPLE:

    ``` python
    import louis

    print(louis.translateString(["braille-patterns.cti", "en-us-g2.ctb"], "Hello, World!"))
    #⠠⠓⠑⠇⠇⠕⠂⠀⠠⠸⠺⠖

    print(louis.backTranslateString(["braille-patterns.cti", "en-us-g2.ctb"], "⠓⠑⠇⠇⠕"))
    #hello

    ```

## If you have this problem(issue #990)(cython OSError), follow these steps:
(I got this error when I tried deploying web server, nginx & gunicorn on Ubuntu)


  1. Go to ~/python/louis/__init__.py

  2. Add function CDLL inside from ctypes import ~

  3. Fix line 61:


  4. ``` python
    import os
    path_f = os.path.abspath( os.path.join(os.path.dirname(__file__), "liblouis.so.20"))
    liblouis = CDLL(path_f)

    ```
  5. RUN python setup.py install again

  6. Go to /usr/local/lib(your library file) and check if liblouis.so.20 and liblouis.a exist

  7. Copy those files to your python louis package folder. For example, my conda environments are: /home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/. So I used cp commands to copy.




  8. ``` shell

    cp -a liblouis* /home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/

    ```

  9. Now it should work! :)