Find and Replace System for Code Inflection Handling

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing text editing tools, such as Microsoft Word 2000, require multiple passes and are error-prone when performing find and replace operations in programming languages, failing to efficiently handle inflected forms of code elements due to their reliance on natural language grammatical rules and oversized dictionaries.

Innovation Solution

A method and system that applies pure lexico-syntactic transformations to identify and replace inflected forms of input expressions in a single pass, using a set of rules to generate valid find and replace couples, without relying on natural language grammatical rules, thus providing a unified find and replace facility for multiple syntactic forms of a single concept.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If multiple find and replace commands are used to handle different forms of code elements, then case discrimination is improved, but the number of operations and time required increases

Engineering Contradiction:
Improvecase discrimination accuracyVSAvoidnumber of operations
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent combines multiple separate find and replace commands into a single unified command that can handle multiple case variations simultaneously. The system merges the functionality of multiple commands (handling DATA_ELEMENT, data element, DataElement, etc.) into one operation that processes all variations in a single pass through the codebase.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The find and replace command is enhanced to perform multiple functions simultaneously - it can match and replace multiple case variations of code elements in a single operation. The command becomes universal by handling different naming conventions (camelCase, PascalCase, snake_case, etc.) without requiring separate commands for each variation.

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

2Adaptability or versatility

If sophisticated regular expressions are used to match multiple code patterns, then matching capability is improved, but error probability and complexity increase

Engineering Contradiction:
Improvepattern matching capabilityVSAvoiderror probability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent uses simple, lightweight case-insensitive matching rules instead of complex regular expressions. These simple matching rules are 'cheap' in terms of complexity and 'short-living' in that they are applied once per find and replace operation without requiring maintenance of sophisticated pattern libraries. This reduces errors while maintaining adequate matching capability for common code patterns.

Inventive Principle:
Principle #27Cheap short-living objects (Disposable)

3Measurement precision

If refactoring tools are used to rename classes and methods, then semantic accuracy is improved, but the scope of replacement is limited

Engineering Contradiction:
Improvesemantic accuracyVSAvoidreplacement scope
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

Instead of using refactoring tools that work from semantic definitions upward (class names, method names), the patent inverts the approach by working from the text level downward. The system performs text-based find and replace operations that can capture all variations of code element names regardless of their semantic definitions, thereby expanding the replacement scope beyond what traditional refactoring tools achieve.

Inventive Principle:
Principle #13The other way round (Inversion)

Data Source

PatentUS10241987B2Method and system for editing text with a find and replace function leveraging derivations of the find and replace input
Publication Date: 2019.03.26 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10241987B2 patent drawing
  • US10241987B2 patent drawing
  • US10241987B2 patent drawing

AI summary

A method, computer program and system for performing a find and replace editing operation of a text starting from a couple of initial find and replace expressions provided by the user, applying each rule defining admissible inflected forms of the initial find and replace expressions, to the initial find and replace expressions to identify all the derived couples of find and replace expressions. The find expression and the replace expression of the derived couples correspond to inflected forms of the initial find and replace expressions. Then, for each match in the text of the find expression of the derived couples, proposing to the user the derived couples for replacement in the text.