Code Monkey home page Code Monkey logo

fix-common-arabic-mistakes's Introduction

FCAM script (Fix Common Arabic Mistakes).

Open/LibreOffice macros (Basic and Python) use Regex to fix common Arabic mistakes. For now both of Basic and Python versions do the same thing, but I will go with Python from now on.

What's it doing?

  • Removes any empty lines.
  • Removes Arabic Kashida (Tatweel "ـ").
  • Removes whitespaces after single WAW letter (و).
  • Removes whitespaces before Arabic punctuation (؛،.؟:!).
  • Removes any sequence of question and exclamation marks and replace them with one only (e.g. "!!!" and "??").
  • Removes whitespaces in inside brackets "()" and "[]".
  • Removes any sequence of whitespaces and whitespaces at end of lines.
  • Replaces Latin comma (decimal separator) "," after Arabic words to Arabic comma "،".
  • Replaces Latin semicolon ";" after Arabic words to Arabic semicolon "؛".

Basic version.

Just copy the code into built-in macros editor.

Python version.

By default Open/LibreOffice supports Basic natively, and if you want to use python macros, you have to install an extra package.

For Ubuntu:

sudo apt-get install libreoffice-script-provider-python

Install

Copy the macro to scripts path.

Global path to make it available for all users:

/usr/lib/libreoffice/share/Scripts/python/

OR under your home:

~/.config/libreoffice/4/user/Scripts/python/

Run

From the menu:

Tools ▸ Macros ▸ Run Macro ▸ LibreOffice Macros ▸ FixCommonArabicMistakes-Python

Standalone version.

I made a Standalone version of script too, it useful with bulk files or so, it maybe not that cool, but maybe help someone :-)

This script not works as a macro but will start Opne/LibreOffice on a specific local port and connect to it, then open the file passed to it, and fix common mistakes. It will not save the file automatically, but it will wait you to do save as a final action.

Run:

./FixCommonArabicMistakes-Standalone.py file_name.odt

fix-common-arabic-mistakes's People

Contributors

aabouzaid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

linuxscout

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.