Text Encoding Error Detection via N-gram Probability Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current solutions for detecting text encoding issues in electronic documents, such as mojibake, are not scalable and limited to a small set of known errors, requiring manual intervention and not suitable for large-scale processing or mixed language documents.

Innovation Solution

An automated solution using machine learning techniques combined with deterministic algorithms, specifically analyzing n-grams (contiguous sequences of characters) to identify words with encoding errors by comparing their frequencies across supported languages, and employing a hybrid approach with regular expressions to detect known patterns.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If manual intervention is used to detect text encoding issues, then detection accuracy for known errors is improved, but scalability and productivity deteriorate when processing large corpora of documents

Engineering Contradiction:
Improvedetection accuracyVSAvoidprocessing throughput
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The system performs self-service by automatically detecting text encoding issues through n-gram analysis without requiring manual intervention. The machine learning model autonomously identifies mojibake patterns by comparing n-gram frequencies against learned language models, enabling the system to serve itself in detecting encoding errors across large document corpora.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent replaces manual mechanical inspection with automated computational analysis. Instead of human administrators manually examining documents for encoding errors, the system uses machine learning models and n-gram frequency analysis to automatically detect issues, substituting human cognitive processes with algorithmic computation.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Reliability

If conventional detection solutions are used, then detection capability for limited known formats is improved, but adaptability to mixed language and unknown encoding formats deteriorates

Engineering Contradiction:
Improvedetection reliabilityVSAvoidlanguage format flexibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The system achieves universality by designing a language-agnostic detection approach. The n-gram analysis and machine learning models are trained on multiple languages and can detect encoding issues across any language without requiring language-specific rules or configuration, making the system universally applicable to diverse multilingual document corpora.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent applies parameter changes by transforming the detection approach from format-specific rules to statistical frequency analysis. By changing from deterministic encoding format checking to probabilistic n-gram frequency comparison, the system adapts to various languages and encoding formats dynamically based on statistical patterns rather than fixed parameters.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If automated detection is implemented, then productivity and scalability are improved, but measurement precision and recall for detecting encoding errors may deteriorate compared to manual detection

Engineering Contradiction:
Improveprocessing throughputVSAvoiddetection precision
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The system implements feedback through confidence scoring and threshold-based filtering. The machine learning model generates confidence scores for each detected encoding issue, allowing the system to filter results based on precision requirements. High-confidence detections are returned with high precision, while the feedback mechanism allows adjustment of thresholds to balance precision and recall based on specific use case requirements.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The patent applies preliminary action by pre-training machine learning models on large corpora of correctly encoded text in multiple languages before deployment. This preliminary training establishes baseline n-gram frequencies and language patterns, enabling the automated system to achieve high detection precision from the start rather than requiring iterative manual tuning.

Inventive Principle:
Principle #10Preliminary action

4Ease of operation

If conventional solutions supporting limited formats are used, then ease of operation is improved, but versatility in handling diverse encoding formats and languages deteriorates

Engineering Contradiction:
Improvesystem simplicityVSAvoidencoding format coverage
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The system performs self-service by automatically adapting to different encoding formats and languages without requiring user configuration or intervention. The machine learning model autonomously identifies the appropriate language and encoding context for each document through n-gram analysis, eliminating the need for users to manually specify formats or configure language settings.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS11423208B1Text encoding issue detection
Publication Date: 2022.08.23 AMAZON TECH INC
  • US11423208B1 patent drawing
  • US11423208B1 patent drawing
  • US11423208B1 patent drawing

AI summary

Method and apparatus for detecting text encoding errors caused by previously encoding the electronic document in multiple encoding formats. Non-word portions are removed from the electronic document. Embodiments determine whether words in the electronic document are likely to contain one or more text encoding errors, by dividing the first word into n-grams of length 2 or more. For each of the plurality of n-grams, a database is queried to determine a respective probability of the n-gram appearing in each of a plurality of recognized languages, and upon determining that the determined probabilities of two consecutive n-grams are each less than a predefined threshold probability, the first word is added to a list of words that likely contain text encoding errors. A confidence level that the first word includes the one or more text encoding errors is calculated, based on a lowest determined probably for the n-grams for the first word.