Coder Social home page Coder Social logo

virastar's Introduction


#ویراستار نوشته‌های فارسی شما را ویرایش می‌کند


Virastar (in Persian:ویراستار)

Specifications

###Virastar

  • should add persian_cleanup method to String class
  • should replace Arabic kaf with its Persian equivalent
  • should replace Arabic Yeh with its Persian equivalent
  • should replace Arabic numbers with their Persian equivalent
  • should replace English numbers with their Persian equivalent
  • should replace English comma and semicolon with their Persian equivalent
  • should correct :;,.?! spacing (one space after and no space before)
  • should replace English quotes with their Persian equivalent
  • should replace three dots with ellipsis
  • should convert ه ی to هٔ
  • should replace double dash to ndash and triple dash to mdash
  • should replace more than one space with just a single one
  • should remove unnecessary zwnj chars that are succeeded/preceded by a space
  • should fix spacing for () [] {} “” «» (one space outside, no space inside)
  • should replace English percent sign to its Persian equivalent
  • should replace more that one line breaks with just one
  • should not replace line breaks
  • should put zwnj between word and prefix/suffix (ha haye* tar* tarin mi* nemi*)
  • should not replace English numbers in English phrases
  • should not destroy urls in the text

aggressive editing

  • should replace more than one ! or ? mark with just one
  • should remove all kashidas

Install

gem install virastar

Usage

"فارسي را كمی درست تر می نويسيم".persian_cleanup   # => "فارسی را کمی درست‌تر می‌نویسیم"

virastar comes with a list of flags to control its behavior, all flags are turned on by default but you can turn them off by passing an options hash to the persian_cleanup method

"سلام 123".persian_cleanup(:fix_english_numbers => false) # => "سلام 123"

here is the list of all flags:

  • fix_dashes
  • fix_three_dots
  • fix_english_quotes
  • fix_hamzeh
  • cleanup_zwnj
  • fix_spacing_for_braces_and_quotes
  • fix_arabic_numbers
  • fix_english_numbers
  • fix_misc_non_persian_chars
  • fix_perfix_spacing
  • fix_suffix_spacing
  • aggresive
  • cleanup_kashidas
  • cleanup_extra_marks
  • cleanup_spacing
  • cleanup_begin_and_end

Acknowledgment

Virastar is highly inspired by Virasbaz.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2011 Allen A. Bargi. See LICENSE for details.

virastar's People

Contributors

aziz 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

virastar's Issues

پشتیبانی از پیشوندها و پسوندهای جدید

سلام.

در انشعابی که آقای سوزن‌چی از این پروژه گرفته‌اند، دو قابلیت جدید به «ویراستار» اضافه کرده‌اند:

پشتیبانی از پیشوندها [ام|ات|اش|ای|اید|ایم|اند|هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان] مثل (نمی‌توانم، پی‌ام‌هایت، خانه‌‌ام، خانه‌هایتان، خانه‌‌اید)

پشتیبانی از پسوندهای [بی] مثل (بی‌تفاوتی، بی‌شرافت)

آیا ممکن است که این دو قابلیت به این پروژه نیز اضافه شوند؟

متشکرم.

۱۴۰۰/۱/۱۲

فاصله‌ی مجازی اضافی

وقتی دو جداکننده با عرض صفر (ZWNJ) پشت سر هم می‌آیند یکی باید حذف شود
وقتی جداکننده با عرض صفر قبل از حرفی که به قبلی نمی‌چسبد می‌چسبد می‌آید باید حذف شود.

این مدتی که به عنوان ویراستار فعالیت می‌کنم بین نویسنده‌هایی که به تازگی با جداکننده آشنا شده‌اند وسواس عجیبی دیده‌ام که باعث می‌شود از جداکننده‌ی اضافی استفاده کنند. این از آنجایی که پیداکردن این‌ها با چشم آسان نیست ویرایش ظاهری این متن‌ها به مراتب سخت‌تر می‌شود!

مثال: بین رود و ها و ی در کلمه‌ی رودهای

php version

سلام عزیز
نسخه پی اچ پی این پروژه رو آماده نداری؟

تكميل بحث نيم فاصله

اين كتابخانه يك اصلاحيه كوچك ديگر هم در مورد نيم فاصله نياز دارد. براي مثال «به خوبي» بايد تبديل به «به‌خوبي» شود و مواردي از اين دست؛ با اين عبارت باقاعده:
(\S)(ه\s)(\S)

var phase3 = Regex.Replace(phase2, @"(\S)(ه\s)(\S)", "$1ه‌$3");

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.