Decide which differences matter

Before sending text to AI, an application often converts strings to a consistent form. But searching for a name and comparing an exact product code serve different purposes. Applying one rule to an entire document can silently change data before the model responds. First, decide which differences the application is allowed to remove.

Start by describing the fields. For a collection name, combining different technical representations of the same letter may be acceptable. For a product code, the script, letter case, separators, and leading zeros may matter. The decision should follow the catalog owner's rules rather than the visual similarity of strings.

For each field, record the permitted transformation, the comparison purpose, and what happens when an unexpected character appears. For example: names permit canonical normalization; product codes remain unchanged; unfamiliar entries require review. The practical result is a short field processing specification that can be checked independently of the model.

Keep the original alongside a working copy

Do not replace the original string with the prepared version. Microsoft explains that normalization generally cannot be reversed to recover the initial text representation. If an application needs that representation, it must store it separately. In this proposed method, the original remains the basis for checking and restoring exact values.

Connect the original and working fields through a record identifier. A transformation log can contain the field, original value, working value, applied rule, and rule version. Add a reason for each changed string. This lets a reviewer distinguish permitted name preparation from an accidental change to a product code.

Also consider how extracted passages will connect to the source. Normalization can change the number of code points, so positions in the working string cannot automatically be transferred to the original. If an answer must highlight a passage, retain a position mapping or return a reference to the complete original field.

Separate Unicode normalization from catalog rules

MDN describes NFC as the canonical composed form. For example, ñ can be represented by one code point or by n followed by a combining tilde; NFC brings these variants to a common representation. This is a technical adjustment to representation that should be permitted for a particular field.

NFKC performs additional compatibility transformations. These include converting superscript digits to ordinary digits, as described in Microsoft's documentation. Consequently, the fictional product code P²-17 becomes P2-17 under that transformation. If the catalog distinguishes those designations, the transformation destroys a required difference.

Removing separators, changing case, and correcting similar-looking letters should each have their own rules. W3C separately demonstrates that Latin and Cyrillic letters can look identical while remaining distinct after Unicode normalization. Treat detected similarity as a reason to investigate, and permit replacement only under an established rule.

Example: four similar product codes

Consider a fictional calibration plate catalog. Under this catalog's rules, P-17, Р-17, P²-17, and P2-17 identify four different items. The first code begins with Latin P, U+0050; the second begins with Cyrillic Р, U+0420. An attractive, consistent font does not help reliably distinguish these entries.

The series name Peña arrives from two sources: one represents ñ as a single character, while the other uses n followed by a combining tilde. The field specification permits NFC for the series name, so the working names should match. Transformations are prohibited for product codes: all four original designations must remain intact.

Suppose AI is asked to prepare short plate descriptions from a register. Give each record a stable internal identifier and the prepared series name. Require that identifier in the result, then insert the exact product code into the final card from the preserved original field. Do not ask the model to reconstruct the designation from memory or similarity.

Check preparation without running the model

First, assemble a small collection of inputs with expected outcomes. In this example, the two representations of Peña must produce the same working name. The pairs P-17 and Р-17, and P²-17 and P2-17, must remain distinct. These are expected outcomes under the example's rules, rather than reported model test results.

Add checks for case and leading zeros: under the rule used here, P-017 differs from P-17, and p-17 differs from P-17. Then process the prepared records again. A second pass should introduce no further changes; otherwise, delivering data repeatedly could change the result.

Compare exact code point sequences instead of relying solely on their appearance in a table. Microsoft recommends validating permitted characters after normalization; apply this to working fields as well. Compare the log with the specification: any unexplained change to a protected product code blocks that record from proceeding to further processing.

Check the entire path to the finished card

SeaGenera provides Playground and API access for text tasks. Organize the preparation described here within your own application. Check the string before sending it, the answer's connection to the record identifier, and the product code after assembling the final card. If the answer contains an unknown identifier, do not choose a substitute through name similarity.

The method has limits. NFC does not repair recognition errors or determine which product code a person intended. Also, avoid indiscriminately deleting invisible characters: W3C describes their meaningful roles in some writing systems and emoji sequences. Unusual characters require rules appropriate to the language and field.

Preserving strings does not establish that the model selected the correct record. Separately check that the description concerns the intended plate and matches the register. When the processing specification changes, rerun the checks and compare the transformation log: a new rule should not silently spread to fields with different requirements.

Sources