Right-to-left detector (proof-of-concept)

The goal of this exercise is to detect the correct writing direction, LTR or RTL, based on the writing system . It uses a sample of the text and finds the Unicode code point of each letter. If there are more characters from an RTL system, RTL wins and vice-versa.

This is a proof-of-concept and should not be used for production. If you intend to develop this further and are looking for larger text bodies, this repository contains copies of The Universal Declaration of Human Rights in a number of languages in text format.

Latin
Lorem ipsum dolor sit amet, consectetur pharetra hendrerit adipiscing elit. Duis viverra, eros et porta convallis, felis urna luctus eros, pharetra hendrerit diam velit sed tortor. Sed viverra, augue eum luctus.
Cyrillic
Лорем ипсум долор сит амет, ан аетерно салутатус нец, ет ферри ирацундиа сцрипторем вим. Ад сеа деленити сенсерит, ет фугит денияуе фиерент цум опортере интеллегебат.
Devanagari
गयेगया यन्त्रालय पुष्टिकर्ता बनाने होभर मानसिक मुश्किल सार्वजनिक प्राण बदले समजते संभव शुरुआत पहोचाना समूह संस्था दर्शाता बनाना संदेश अधिक तकरीबन गटकउसि विषय मुख्यतह स्वतंत्र विवरन रखति देखने
Arabic
كان ان الأول معارضة معزّزة, معقل الأثنان مع بحق, دارت معقل دنو ٣٠. جورج وبعد وتنامت عدد عن. تم تعد فبعد سبتمبر, و ولم أراض مدينة وقامت. ترتيب إتفاقية والنرويج عن تحت, بـ وصل وكسبت قبضتهم, ضرب مرجع بخطوط بمباركة قد.
Hebrew
מוסיקה המקושרים סוציולוגיה את כדי, מה מדע ביוני המלחמה. שער לכאן באגים הבקשה אל, דת רקטות גרמנית צרפתית עזה, ואלקטרוניקה ביוטכנולוגיה שכל של. צרפתית תקשורת שימושיים ויש אם, שתפו למתחילים על זאת.
Hanzi
岸取耳作日断述事子使加読。写土験類紙王討完感医測線針月。主最一面詳収能御体高重歳生。辺来選房想能辛本語婦日寄月市付。断肌岩達厳層景済余来栗紹充。口関話大乙