Tanya  Shields

Tanya Shields

1597994280

Regex in Real Time(Pig Latin Translator)

A Quick and to the Point, Real World Example of how Regex Comes in Handy.

Once again, the sandman lost my address last week so I found myself starting to experiment with a new late night project. On the menu this time was a React Native app that translates Pig Latin. I called it…

Image for post

link to the finished Porker App at the bottom of this article if you want to to test the functionality of the app yourself! Or scan the barcode with your phone camera.

Why Regex

After doing some research on how I was going to efficiently check the user input for a series of conditions, I came to the conclusion this was the day I really embraced Regex.

What is Regex?

You may already know what regex is. But for those of you who put this on your “someday” list(like me), here is the gist.

Regex — short for regular expression, is defined as a sequence of characters that dictate a search pattern. But what does that even mean?! Basically Regex is like a library of symbols that each tell your code something specific to keep an eye out for. You could be validating a users name, and make a decision to to look only for a case that’s sensitive or insensitive. Or maybe you’re scanning a document for certain keywords. You can dictate under what conditions you get those words back. You may chose to ignore the word if it’s hyphenated, or if it’s not capitalized.

#react-native #react #javascript #regex #algorithms #programming

What is GEEK

Buddha Community

Regex in Real Time(Pig Latin Translator)
Ian  Robinson

Ian Robinson

1621644000

4 Real-Time Data Analytics Predictions for 2021

Data management, analytics, data science, and real-time systems will converge this year enabling new automated and self-learning solutions for real-time business operations.

The global pandemic of 2020 has upended social behaviors and business operations. Working from home is the new normal for many, and technology has accelerated and opened new lines of business. Retail and travel have been hit hard, and tech-savvy companies are reinventing e-commerce and in-store channels to survive and thrive. In biotech, pharma, and healthcare, analytics command centers have become the center of operations, much like network operation centers in transport and logistics during pre-COVID times.

While data management and analytics have been critical to strategy and growth over the last decade, COVID-19 has propelled these functions into the center of business operations. Data science and analytics have become a focal point for business leaders to make critical decisions like how to adapt business in this new order of supply and demand and forecast what lies ahead.

In the next year, I anticipate a convergence of data, analytics, integration, and DevOps to create an environment for rapid development of AI-infused applications to address business challenges and opportunities. We will see a proliferation of API-led microservices developer environments for real-time data integration, and the emergence of data hubs as a bridge between at-rest and in-motion data assets, and event-enabled analytics with deeper collaboration between data scientists, DevOps, and ModelOps developers. From this, an ML engineer persona will emerge.

#analytics #artificial intelligence technologies #big data #big data analysis tools #from our experts #machine learning #real-time decisions #real-time analytics #real-time data #real-time data analytics

Jessica Smith

Jessica Smith

1612606870

REAL TIME CHAT SOLUTIONS SERVICES FOR MOBILE APPS

Build a Real Time chat application that can integrated into your social handles. Add more life to your website or support portal with a real time chat solutions for mobile apps that shows online presence indicators, typing status, timestamp, multimedia sharing and much more. Users can also log into the live chat app using their social media logins sparing them from the need to remember usernames and passwords. For more information call us at +18444455767 or email us at hello@sisgain.com or Visit: https://sisgain.com/instant-real-time-chat-solutions-mobile-apps

#real time chat solutions for mobile apps #real time chat app development solutions #live chat software for mobile #live chat software solutions #real time chat app development #real time chat applications in java script

Tanya  Shields

Tanya Shields

1597994280

Regex in Real Time(Pig Latin Translator)

A Quick and to the Point, Real World Example of how Regex Comes in Handy.

Once again, the sandman lost my address last week so I found myself starting to experiment with a new late night project. On the menu this time was a React Native app that translates Pig Latin. I called it…

Image for post

link to the finished Porker App at the bottom of this article if you want to to test the functionality of the app yourself! Or scan the barcode with your phone camera.

Why Regex

After doing some research on how I was going to efficiently check the user input for a series of conditions, I came to the conclusion this was the day I really embraced Regex.

What is Regex?

You may already know what regex is. But for those of you who put this on your “someday” list(like me), here is the gist.

Regex — short for regular expression, is defined as a sequence of characters that dictate a search pattern. But what does that even mean?! Basically Regex is like a library of symbols that each tell your code something specific to keep an eye out for. You could be validating a users name, and make a decision to to look only for a case that’s sensitive or insensitive. Or maybe you’re scanning a document for certain keywords. You can dictate under what conditions you get those words back. You may chose to ignore the word if it’s hyphenated, or if it’s not capitalized.

#react-native #react #javascript #regex #algorithms #programming

Virgil  Hagenes

Virgil Hagenes

1603047600

How to translate text with python

Introduction

In this tutorial, we will explore different possibilities to translate a text or word using python. From my experience, this is very helpful if you want to automate the translation of many paragraphs, sentences or words.

Furthermore, you can have a backend worker, which receives new data constantly and can either return a request with the translation or store different translations in a database (this is very useful in NLP tasks).

One of the reasons to choose Python apart from the clear syntax and the extensive library is the great community that works extensively on the development of the language itself or extending the functionality with third party modules.

Precisely, one of the modules that makes it straightforward to translate texts is the deep_translator, which provides support for multiple famous translators.

#python #google-translate #translation #translators #translate

Royce  Reinger

Royce Reinger

1658891580

Ruby-gettext: A Pure Ruby Localization(L10n) Library & tool

gettext

gettext for Ruby

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.

This library was called as "Ruby-GetText-Package". Since 2.3.0, this library is called just "gettext". You can call this library as "gettext gem" or "Ruby gettext" to distinguish from GNU gettext.

This library translates original messages to localized messages using client-side locale information(environment variable or CGI variable).

The tools for developers support creating, useing, and modifying localized message files(message catalogs).

Rails support has been removed.

Features

  • Translate singular/plural messages with simple APIs (similar to GNU gettext)
  • Thread safety. Message resources are shared from all threads, but returns translated messages of the current thread's locale.
  • Tools to find message IDs
    • Extract message IDs to po-files using rxgettext from
      • ruby scripts
      • glade-2 XML file (.glade)
      • ERB file (.rhtml, .erb)
      • Anything (with your own parsers)
      • The po-files are compatible with GNU gettext.
    • rmsgfmt creates a mo-file from a po-file. The mo-file is compatible with GNU gettext (msgfmt).
    • Using rxgettext/rmsgfmt as Rake tasks
  • textdomain's scope is adapt to ruby class/module mechanism.
    • A class/module can have plural textdomains.
    • a message is looked up in its class/module and ancestors.
  • CGI support (gettext/cgi)
    • Locale is retrieved from client informations using Ruby-Locale. (HTTP_ACCEPT_LANGUAGE, HTTP_ACCEPT_CHARSET, QUERY_STRING (lang), Cookies (lang)).

Requirements

gem install locale

For development:

  • Racc 1.4.3 or later (for compiling src/rmsgfmt.ry only)

Installation

Uninstall old gettext if exists. (You need to do this when updating 1.93.0 -> 2.0.1)

# sudo/su on POSIX system
gem uninstall gettext

RubyGems

# sudo/su on POSIX system
gem install gettext

Download tar-ball

# De-Compress archive and enter its top directory.
# sudo/su on POSIX system
ruby setup.rb

You can also install files in your favorite directory by supplying setup.rb some options. Try ruby setup.rb --help.

Usage

Translation

_() or gettext(): basic translation method

Translates the message, using the msgid if a translation is not found.

_("Hello") => "Bonjour"  # Found

This translation will appear in the po or pot file as:

msgid: "Hello"
msgstr: "Bonjour"

When a translation is not found it, it will return the msgid. This is a core benefit of gettext and applies to all its translation methods.

_("Hello") => "Hello"  # Not Found

Additional gettext methods come in 3 combinable flavors:

n_() or ngettext(): pluralized

Returns singular or plural form, depending on how many you have.

n_("Apple", "%{num} Apples", n) => "3 Pommes"  # When n = 3
n_("Apple", "%{num} Apple", n)  => "Pomme"     # When n = 1
n_(["Apple", "%{num} Apple"], n)  => "Pomme"   # 2 arg variation

This translation will appear in the po or pot file as:

msgid "Apple"
msgid_plural "%{num} Apples"
msgstr[0] "Pomme"
msgstr[1] "#{num} Pommes"

p_() or pgettext(): context aware

A context is a prefix to your translation, useful when one word has different meanings, depending on its context.

p_("Printer","Open") => "Öffnen" #translation found
p_("Printer","Open") => "Open"   #translation not found

This translation will appear in the po or pot file as:

msgctxt "Printer"
msgid "Open"
msgstr "Öffnen"

Note that the parser when sorting by msgid will strictly sort by the msgid ignoring the msgctxt. If you prefer to sort with the msgctxt you should consider the s_() method.

s_() or sgettext(): without context

The s_() method is very similar to the p_() method except that the context is inside the msgid.

s_("Printer|Open") => "Öffnen" #translation found
s_("Printer|Open") => "Open"   #translation not found
msgid "Printer|Open"
msgstr "Öffnen"

Note the the parser when sorting by msgid will take the context into consideration as it is part of the msgid unlike the p_() method.

Your preference of using s_() or p_() will depend on your translation workflow and process.

Combinations

You can combine n_() with either p_() or s_().

np_() or npgettext(): context aware pluralized

np_("Fruit", "Apple", "%{num} Apples", 3)
np_(["Fruit","Apple","%{num} Apples"], 3) # 2 arg variation
msgctxt "Fruit"
msgid "Apple"
msgid_plural "%{num} Apples"
msgstr[0] ""
msgstr[1] ""

sp_() or spgettext(): context aware pluralized

ns_("Fruit|Apple","%{num} Apples", 3)
ns_(["Fruit|Apple","%{num} Apples"], 3) # 2 arg variation
msgid "Fruit|Apple"
msgid_plural "%{num} Apples"
msgstr[0] ""
msgstr[1] ""

N_() and Nn_(): makes dynamic translation messages readable for the gettext parser

_(fruit) cannot be understood by the gettext parser. To help the parser find all your translations, you can add fruit = N_("Apple") which does not translate, but tells the parser: "Apple" needs translation.

fruit = N_("Apple")   # same as fruit = "Apple"
_(fruit)              # does a normal translation

fruits = Nn_("Apple", "%{num} Apples")
n_(fruits, 3)

Interpolating translations

This is not a feature of gettext but worth noting. You can interpolate translated strings without the ruby String % operator.

N_("active"); N_("inactive"); N_("paused") # possible value of status for parser to find.
_("Your account is #{account_state}.") % { account_state: _(status) }

Bind textdomains to the classes

A textdomain has a translation file in each language. A module/class can have multiple textdomains. This means the libraries/applications can have their own textdomains.

class Foo
  include GetText
  bindtextdomain "your_app_domain_name"
end

class Book
  include GetText
  bindtextdomain "general"
  bindtextdomain "book"
end

Locale

If you need to set the locale by yourself, then use:

GetText.locale = "en_US" # translate into english from now on
GetText.locale # => en_US

Or

include GetText
set_locale "en_US"

For more details and options, have a look at the samples folder.

License

This program is licenced under the same licence as Ruby (See doc/text/ruby-license.txt) or LGPL (Lesser General Public License: doc/text/lgpl-3.0.txt or http://www.gnu.org/licenses/lgpl-3.0.txt).

mofile.rb

Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>
Copyright (C) 2001,2002 Masahiro Sakai <s01397ms at sfc.keio.ac.jp>

gettext.rb

Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>
Copyright (C) 2001,2002 Masahiro Sakai <s01397ms at sfc.keio.ac.jp>

rxgettext

Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>
Copyright (C) 2001,2002 Yasushi Shoji <yashi at atmark-techno.com>

Others

Copyright (C) 2001-2009 Masao Mutoh <mutoh at highwhay.ne.jp>

Translators

LanguageTranslatorStatus
Bosnian (bs)Sanjin Sehic <saserr at gmail.com>1.90.0 (old)
Bulgarian (bg)Sava Chankov <sava.chankov at gmail.com>2.0.1
Catalan (ca)Ramon Salvadó <rsalvado at gnuine.com>2.0.1
Chinese (Simplified)(zh_CN)Yang Bob <bob.yang.dev at gmail.com> (current) 
Yingfeng <blogyingfeng at gmail.com>
2.0.1
Chinese (Traditional)(zh_TW)Yang Bob <bob.yang.dev at gmail.com> (current) 
Lin Chung-Yi <xmarsh at gmail.com>
2.0.1
Croatian (hr)Sanjin Sehic <saserr at gmail.com>1.90.0 (old)
Czech (cs)Karel Miarka <kajism at yahoo.com>1.9.0 (old)
Dutch (nl)Menno Jonkers <ruby-gettext at jonkers.com>1.90.0 (old)
English (default) 2.1.0
Esperanto (eo)Malte Milatz <malte at gmx-topmail.de>2.0.1
Estonian (et)Erkki Eilonen <erkki at itech.ee>2.0.1
French (fr)Vincent Isambart <vincent.isambart at gmail.com> (current) 
David Sulc <davidsulc at gmail.com> 
Laurent Sansonetti <laurent.sansonetti at gmail.com>
2.0.1
German (de)Patrick Lenz <patrick at limited-overload.de> (current) 
Detlef Reichl <detlef.reichl at gmx.org> 
Sven Herzberg <herzi at abi02.de> 
Sascha Ebach <se at digitale-wertschoepfung.de>
2.0.1
Greek (el)Vassilis Rizopoulos <damphyr at gmx.net>2.0.1
Hungarian (hu)Tamás Tompa <tompata at gmail.com>2.0.1
Italian (it)Marco Lazzeri <marco.lazzeri at gmail.com> 
Gabriele Renzi <surrender_it at yahoo.it>
1.6.0 (old)
Japanese (ja)Masao Mutoh <mutomasa at gmail.com>2.1.0
Korean (ko)Gyoung-Yoon Noh <nohmad at gmail.com>1.9.0 (old)
Latvian (lv)Aivars Akots <aivars.akots at gmail.com>2.0.1
Norwegian (nb)Runar Ingebrigtsen <runar at mopo.no>2.0.1
Portuguese (Brazil)(pt_BR)Antonio S. de A. Terceiro <terceiro at softwarelivre.org> (current) 
Joao Pedrosa <joaopedrosa at gmail.com>
2.0.1
Russian (ru)Yuri Kozlov <kozlov.y at gmail.com>2.0.1
Serbian (sr)Slobodan Paunović <slobodan.paunovic at gmail.com>2.0.1
Spanish (es)David Espada <davinci at escomposlinux.org> (current) 
David Moreno Garza <damog at damog.net>
2.0.1
Swedish (sv)Nikolai Weibull <mailing-lists.ruby-talk at rawuncut.elitemail.org>0.8.0 (very old)
Ukrainian (uk)Alex Rootoff <rootoff at pisem.net>2.0.1
Vietnamese (vi)Ngoc Dao Thanh <ngocdaothanh at gmail.com>2.0.1

Maintainer

  • Kouhei Sutou <kou@clear-code.com>

Old maintainer

  • Masao Mutoh <mutomasa at gmail.com>

Links

NOTE: Gettext gem 3.0.0 removed many deprecated APIs and improves internal APIs. We want to keep backward compatibility as much as possible but some existing codes may be broken by gettext gem API change. If your code breaks by gettext gem 3.0.0, please report your problem. We will fix the problem and release a new version.

https://github.com/ruby-gettext/gettext is the official gettext gem repository. It is moved from https://github.com/mutoh/gettext . Mutoh agreed with the move.

Author: Ruby-gettext
Source Code: https://github.com/ruby-gettext/gettext 
License: 

#ruby #localization #text