<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Masoud Javadi</title>
    <description>The latest articles on DEV Community by Masoud Javadi (@masoudjavadi).</description>
    <link>https://dev.to/masoudjavadi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4086247%2F0a15a082-e304-410d-ab5e-2edbda145917.jpg</url>
      <title>DEV Community: Masoud Javadi</title>
      <link>https://dev.to/masoudjavadi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masoudjavadi"/>
    <language>en</language>
    <item>
      <title>Testing Persian Text Tools with Real-World Edge Cases</title>
      <dc:creator>Masoud Javadi</dc:creator>
      <pubDate>Thu, 20 Aug 2026 08:48:10 +0000</pubDate>
      <link>https://dev.to/expronal/testing-persian-text-tools-with-real-world-edge-cases-4m7e</link>
      <guid>https://dev.to/expronal/testing-persian-text-tools-with-real-world-edge-cases-4m7e</guid>
      <description>&lt;p&gt;When testing text-processing tools, simple examples are usually not enough.&lt;/p&gt;

&lt;p&gt;A sentence like "Hello world" can show that a basic counter works, but it does not reveal how a tool behaves with real content.&lt;/p&gt;

&lt;p&gt;Real Persian text brings many edge cases that are easy to miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why simple test cases fail
&lt;/h2&gt;

&lt;p&gt;Many text tools are first tested with clean examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A few words separated by spaces&lt;/li&gt;
&lt;li&gt;Short sentences&lt;/li&gt;
&lt;li&gt;Simple numbers&lt;/li&gt;
&lt;li&gt;Plain English text&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These examples are useful, but real documents are much more complicated.&lt;/p&gt;

&lt;p&gt;A Persian article may contain Persian words, English technical terms, URLs, email addresses, numbers, emojis, and invisible Unicode characters at the same time.&lt;/p&gt;

&lt;p&gt;A tool that works perfectly on simple examples may produce unexpected results on real content.&lt;/p&gt;

&lt;h2&gt;
  
  
  ZWNJ and the half-space problem
&lt;/h2&gt;

&lt;p&gt;One of the most common Persian text challenges is the zero-width non-joiner, also known as ZWNJ.&lt;/p&gt;

&lt;p&gt;Persian writers use it in many words to create the correct visual structure.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;می‌روم&lt;/p&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;خانه‌ها&lt;/p&gt;

&lt;p&gt;look different from versions written with normal spaces.&lt;/p&gt;

&lt;p&gt;A text tool needs to understand that these are not just ordinary spaces. Otherwise, word counting and text analysis can become inconsistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mixed Persian and English content
&lt;/h2&gt;

&lt;p&gt;Modern Persian content is rarely only Persian.&lt;/p&gt;

&lt;p&gt;Technical articles often include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Programming terms&lt;/li&gt;
&lt;li&gt;Product names&lt;/li&gt;
&lt;li&gt;URLs&lt;/li&gt;
&lt;li&gt;Email addresses&lt;/li&gt;
&lt;li&gt;File names&lt;/li&gt;
&lt;li&gt;Numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a single sentence may contain:&lt;/p&gt;

&lt;p&gt;example.com&lt;/p&gt;

&lt;p&gt;&lt;a href="mailto:test@example.com"&gt;test@example.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and a number like 2.5&lt;/p&gt;

&lt;p&gt;A good text-processing tool needs to understand the difference between a sentence-ending period and a period that belongs to another structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers and Unicode characters
&lt;/h2&gt;

&lt;p&gt;Persian content can include Persian digits, Arabic digits, and English digits together.&lt;/p&gt;

&lt;p&gt;For humans, these differences may look small.&lt;/p&gt;

&lt;p&gt;For software, they are different Unicode characters.&lt;/p&gt;

&lt;p&gt;This is why testing different number formats and Unicode cases is important when building reliable text tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  Copying content from real sources
&lt;/h2&gt;

&lt;p&gt;Another common challenge appears when content is copied from applications like Microsoft Word or web pages.&lt;/p&gt;

&lt;p&gt;Copied content may include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Formatting information&lt;/li&gt;
&lt;li&gt;Hidden characters&lt;/li&gt;
&lt;li&gt;Links&lt;/li&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;li&gt;Tables&lt;/li&gt;
&lt;li&gt;Different paragraph structures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A text analyzer should be tested against these situations, not only clean manually written text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building realistic test cases
&lt;/h2&gt;

&lt;p&gt;This is why we started collecting more realistic Persian text analysis test cases.&lt;/p&gt;

&lt;p&gt;Instead of testing only perfect examples, we focus on situations that actually happen during content creation and publishing workflows.&lt;/p&gt;

&lt;p&gt;Our test cases repository on GitHub contains examples related to Persian text processing, Unicode behavior, mixed content, and edge cases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Expronal/persian-text-analysis-tests" rel="noopener noreferrer"&gt;Persian text analysis test cases&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The lesson
&lt;/h2&gt;

&lt;p&gt;Reliable text processing is not only about counting characters or splitting text by spaces.&lt;/p&gt;

&lt;p&gt;The difficult part is defining expected behavior and testing it against real-world content.&lt;/p&gt;

&lt;p&gt;Languages like Persian show why small details such as invisible characters, mixed writing systems, and formatting differences matter.&lt;/p&gt;

&lt;p&gt;Good tools are built by understanding the problems users actually face.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>textprocessing</category>
      <category>opensource</category>
      <category>unicode</category>
    </item>
  </channel>
</rss>
