Image Source: Styleformer
We have seen two-part of Gramformer to detect, highlight, and correct grammatical errors.
When we want to edit, highlight, and correct active/passive or formal or informal style of writing errors, we need high-end online editing tools. Nowadays, most online editing tools using Artificial Intelligence Natural Language processing to check word sounds, writing styles, grammar errors, spell checks, active or passive, tone clarity, etc. However, if we have tools like Gramformer and Styleformer, that would help us to become pro writers.
Today, one of the most interesting frameworks we are exploring Styleformer. The Styleformer helps you to detect active/passive, formal/informal, negative/positive in Natural language text. It is an open-source tool to explore and use in our every day to edit writing errors.
We can write few simple sentences and convert from formal to casual.
I have used Google Colab for this library.
Collecting git+https://github.com/PrithivirajDamodaran/Styleformer.git Cloning https://github.com/PrithivirajDamodaran/Styleformer.git to /tmp/pip-req-build-_vf1nhl9 Running command git clone -q https://github.com/PrithivirajDamodaran/Styleformer.git /tmp/pip-req-build-_vf1nhl9 Collecting transformers Downloading https://files.pythonhosted.org/packages/b5/d5/ c6c23ad75491467a9a84e526ef2364e523d45e2b0fae28a7cbe8689e7e84/transformers-4.8.1-py3-none-any.whl (2.5MB) |████████████████████████████████| 2.5MB 6.9MB/s Collecting sentencepiece Downloading https://files.pythonhosted.org/packages/ac/aa/ 1437691b0c7c83086ebb79ce2da16e00bef024f24fec2a5161c35476f499/ sentencepiece-0.1.96-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2MB) |████████████████████████████████| 1.2MB 40.7MB/s Collecting python-Levenshtein Downloading https://files.pythonhosted.org/packages/2a/dc/ 97f2b63ef0fa1fd78dcb7195aca577804f6b2b51e712516cc0e902a9a201/python-Levenshtein-0.12.2.tar.gz (50kB) |████████████████████████████████| 51kB 6.5MB/s Collecting fuzzywuzzy Downloading https://files.pythonhosted.org/packages/43/ff/ 74f23998ad2f93b945c0309f825be92e04e0348e062026998b5eefef4c33/fuzzywuzzy-0.18.0-py2.py3-none-any.whl Requirement already satisfied: requests in /usr/local/lib/python3.7/ dist-packages (from transformers->styleformer==0.1) (2.23.0) Collecting tokenizers<0.11,>=0.10.1 Downloading https://files.pythonhosted.org/packages/d4/e2/ df3543e8ffdab68f5acc73f613de9c2b155ac47f162e725dcac87c521c11/ tokenizers-0.10.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64. manylinux2010_x86_64.whl (3.3MB) |████████████████████████████████| 3.3MB 43.9MB/s Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/ python3.7/dist-packages (from transformers->styleformer==0.1) (2019.12.20) Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from transformers->styleformer==0.1) (4.5.0) Requirement already satisfied: packaging in /usr/local/lib/python3.7/ dist-packages (from transformers->styleformer==0.1) (20.9) Requirement already satisfied: filelock in /usr/local/lib/python3.7/ dist-packages (from transformers->styleformer==0.1) (3.0.12) Collecting huggingface-hub==0.0.12 Downloading https://files.pythonhosted.org/packages/2f/ee/ 97e253668fda9b17e968b3f97b2f8e53aa0127e8807d24a547687423fe0b/huggingface_hub-0.0.12-py3-none-any.whl Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.7/dist-packages (from transformers->styleformer==0.1) (4.41.1) Collecting sacremoses Downloading https://files.pythonhosted.org/packages/75/ee/ 67241dc87f266093c533a2d4d3d69438e57d7a90abb216fa076e7d475d4a/sacremoses-0.0.45-py3-none-any.whl (895kB) |████████████████████████████████| 901kB 47.9MB/s Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/ dist-packages (from transformers->styleformer==0.1) (3.13) Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.7/ dist-packages (from transformers->styleformer==0.1) (1.19.5) Requirement already satisfied: setuptools in /usr/local/lib/python3.7/ dist-packages (from python-Levenshtein->styleformer==0.1) (57.0.0) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->transformers->styleformer==0.1) (1.24.3) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/ dist-packages (from requests->transformers->styleformer==0.1) (2021.5.30) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/ dist-packages (from requests->transformers->styleformer==0.1) (3.0.4) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/ dist-packages (from requests->transformers->styleformer==0.1) (2.10) Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->transformers->styleformer==0.1) (3.7.4.3) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/ dist-packages (from importlib-metadata; python_version < "3.8"->transformers->styleformer==0.1) (3.4.1) Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/ dist-packages (from packaging->transformers->styleformer==0.1) (2.4.7) Requirement already satisfied: six in /usr/local/lib/python3.7/ dist-packages (from sacremoses->transformers->styleformer==0.1) (1.15.0) Requirement already satisfied: joblib in /usr/local/lib/python3.7/ dist-packages (from sacremoses->transformers->styleformer==0.1) (1.0.1) Requirement already satisfied: click in /usr/local/lib/python3.7/ dist-packages (from sacremoses->transformers->styleformer==0.1) (7.1.2) Building wheels for collected packages: styleformer, python-Levenshtein Building wheel for styleformer (setup.py) ... done Created wheel for styleformer: filename=styleformer-0.1-cp37-none-any.whl size=8632 sha256=4ac6659a36b0d761498ece4b4300f6b60542611b970b4bf798ad9e2434682a7b Stored in directory: /tmp/pip-ephem-wheel-cache-n1s7eli8/wheels/af/e9/ 1e/d35e3a331aa0dd96733d02974ff420e645cb97978390b8741e Building wheel for python-Levenshtein (setup.py) ... done Created wheel for python-Levenshtein: filename= python_Levenshtein-0.12.2-cp37-cp37m-linux_x86_64.whl size=149827 sha256=717d39e3f24d86cac6f08869cc09082bf8f421ff5c2160c0cb950397d29a79d7 Stored in directory: /root/.cache/pip/wheels/b3/26/73/4b48503bac73f01cf18e52cd250947049a7f339e940c5df8fc Successfully built styleformer python-Levenshtein Installing collected packages: tokenizers, huggingface-hub, sacremoses, transformers, sentencepiece, python-Levenshtein, fuzzywuzzy, styleformer Successfully installed fuzzywuzzy-0.18.0 huggingface-hub-0.0.12 python-Levenshtein-0.12.2 sacremoses-0.0.45 sentencepiece-0.1.96 styleformer-0.1 tokenizers-0.10.3 transformers-4.8.1

Formal to Casual model loaded... [Formal] We have a lot of things to tell you. [Casual] we have lots of stuff to tell ya. ---------------------------------------------------------------------- [Formal] What is your idea? [Casual] what's your idea? ---------------------------------------------------------------------- [Formal] Good morning! How are you? [Casual] well hello nice morning and how are you? ---------------------------------------------------------------------- [Formal] Could you please get an icecream for me? [Casual] hmm... how bout an icecream for me? ---------------------------------------------------------------------- [Formal] She has decided to accept the job. [Casual] she's decided to take the job. ----------------------------------------------------------------------
To download full Styleformer library from GitHub, click here.
Further Reading
Posts on Artificial Intelligence, Deep Learning, Machine Learning, and Design Thinking articles:
Rasa X Open Source Conversational AI UI Walk-through
Artificial Intelligence Chatbot Using Neural Network and Natural Language Processing
Leave A Comment