strrepalias

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Text/Strs/Chars/Links
Introduced first in SolidGeometry 5.1, Creation date: 2022-01-24, Last change: 2025-09-15

replaces a set of similar words by a specified one

Description

could be a thesaurus but used mainly for natural language interfaces to correct speach or missspelling

See Also: siri2jarvis , jarvis , fourbardesignbysiri , strrepn , strfindafter , strfindtag

Example Illustration

 missing image of strrepalias(str,word,)

Syntax

str=strrepalias(str,word,[])

Input Parameter

str: string
word: {'animal', 'fox', 'dog', 'wolf', 'wolfhound', 'dog', 'hound'; 2nd line}

Output Parameter

str: modified string

Examples


strrepalias('the wolf has dangerous teeth',{'animal', 'fox', 'dog', 'wolf', 'wolfhound', 'dog', 'hound'})




Copyright 2022-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, strrepalias, is designed to replace a set of similar words in a string with a specified word. It is primarily used for natural language interfaces to correct speech or misspellings.

Input Parameters

Output

Algorithm Steps

  1. Determine the number of additional arguments, nvar, by subtracting 2 from the total number of input arguments.
  2. Check if word is a cell array:
  3. If word is not a cell array:

Example

Using the function: strrepalias('the wolf has dangerous teeth', {'animal', 'fox', 'dog', 'wolf', 'wolfhound', 'dog', 'hound'}) will replace occurrences of 'fox', 'dog', 'wolf', 'wolfhound', and 'hound' with 'animal' in the given string.

Algorithm explaination created using ChatGPT on 2025-08-19 01:27. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21