Source Code Spellchecker Distinguishing Natural Language

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional spellcheckers often produce false positives when processing source code files, flagging programming language instructions as misspelled due to their non-English language nature.

Innovation Solution

A method and system that differentiate between natural language and programming language parts in source code files by selecting candidate delimiters, classifying strings based on spelling errors, and outputting indications of misspelled words only when the string is classified as natural language, avoiding false positives in programming language instructions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If a conventional spellchecker processes source code files, then spelling errors in natural language can be detected, but false positives occur on programming language instructions

Engineering Contradiction:
Improvespelling error detection accuracyVSAvoidfalse positive rate
Core Design Contradiction:
Measurement precisionVSReliability

Solution Approach 1:

The source code file is segmented into multiple strings using delimiters (e.g., newline characters, comment markers). Each string is then individually classified to determine whether it contains natural language or programming language instructions. This segmentation allows the spellchecker to apply different processing rules to different portions of the code, detecting spelling errors in natural language while avoiding false positives in programming instructions.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Different quality standards are applied to different parts of the source code based on their classification. Natural language portions are subjected to strict spelling verification, while programming language instructions are excluded from spellchecking or given different evaluation criteria. This local differentiation resolves the contradiction by making the spellchecking process adaptive to the specific content type being analyzed.

Inventive Principle:
Principle #3Local quality

2Ease of operation

If programming language instructions are treated as natural language, then spelling errors can be uniformly checked, but false positives increase

Engineering Contradiction:
Improvespellchecking process simplicityVSAvoidfalse positive rate
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The spellchecking process dynamically adjusts its behavior based on the classification of each string. Rather than applying a static, uniform spellchecking rule to all content, the system modifies its operation mode for each string: performing full spellchecking on natural language and either skipping or performing reduced spellchecking on programming language instructions. This dynamic adaptation maintains operational simplicity while eliminating false positives.

Inventive Principle:
Principle #15Dynamics

3Measurement precision

If all strings in source code are spellchecked, then comprehensive error detection is achieved, but programming language instructions are incorrectly flagged

Engineering Contradiction:
Improvespelling error detection coverageVSAvoidfalse positive impact
Core Design Contradiction:
Measurement precisionVSObject-affected harmful factors

Solution Approach 1:

Before performing spellchecking on any string, the system performs a preliminary classification action to determine whether the string contains natural language or programming language instructions. This preliminary step ensures that only appropriate strings are subjected to spellchecking, achieving comprehensive error detection in natural language portions while preventing false positives in programming instructions from the outset.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS8700997B1Method and apparatus for spellchecking source code
Publication Date: 2014.04.15 GOOGLE LLC
  • US8700997B1 patent drawing
  • US8700997B1 patent drawing
  • US8700997B1 patent drawing

AI summary

In one aspect, a spellchecker is provided that differentiates between code and natural language parts of a source code file. In operation, the spellchecker identifies a string in the source code file and attempts to classify the string as inducing programming language instructions or natural language words. If the sting is classified as including natural language words, the spellchecker outputs an indication of a spelling mistake in the string. Otherwise, if the string is not classified as including natural language words, the spellchecker does not output indications of spelling mistakes found in the string.