Virastar Library

Cleaning-up Persian Texts!

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/527228/1538801/Virastar%20Library.js

作者
Amm1rr
版本
0.21.0
建立日期
2025-02-17
更新日期
2025-02-17
尺寸
33.4 KB
授權條款
MIT

Virastar is a JavaScript library designed to process and standardize Persian text, enhancing its readability and ensuring compatibility across various platforms. It offers a comprehensive suite of functions that address common typographical and formatting issues in Persian writing.

Key Features:

  • Normalization of End-of-Line Characters: Converts Windows-style line breaks to Unix-style, ensuring consistent text formatting.

  • HTML Entity Decoding: Transforms numeric and selected HTML character entities into their corresponding characters, preserving the integrity of the text.

  • Dash Correction: Replaces triple dashes with an em dash and double dashes with an en dash, adhering to proper punctuation standards.

  • Ellipsis Standardization: Removes spaces between dots and replaces multiple dots with a single ellipsis character, maintaining typographical accuracy.

  • Date Formatting: Reorders date components and replaces delimiters with slashes, aligning with standard Persian date conventions.

  • Quotation Mark Replacement: Substitutes English quotation marks with their Persian equivalents, ensuring consistency in punctuation.

  • Hamzeh Correction: Addresses common issues with the Persian letter 'ه' followed by 'ی' or 'ء', replacing them with the standard 'هٔ'.

  • Arabic Character Conversion: Converts Arabic characters to their Persian counterparts, standardizing the script.

  • Zero-Width Non-Joiner (ZWNJ) Management: Cleans unnecessary ZWNJ characters, particularly around numbers, English words, spaces, and punctuation marks, to prevent unwanted word breaks.

  • Number Conversion: Replaces Arabic and English numerals with their Persian equivalents, ensuring numerical consistency.

  • Punctuation Standardization: Replaces English punctuation marks with their Persian counterparts, maintaining typographical consistency.

  • Spacing Adjustments: Removes unnecessary spaces before and after punctuation marks, parentheses, and braces, adhering to proper spacing conventions.

  • Diacritic Management: Cleans up diacritic characters, ensuring they are correctly placed and do not interfere with text readability.

  • Preservation Options: Allows for the preservation of frontmatter, HTML tags, comments, entities, URIs, and specific brackets or braces, providing flexibility in text processing.

By integrating Virastar into your projects, you can automate the cleaning and standardization of Persian text, leading to improved readability and consistency across your applications.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址