Add logic to the search and replace words script.
Good day. I will send you the files in personal messages when I see your bid and your profile. I also need a professional in JS for ongoing collaboration. I have a script in js and a file in json, in which the words are specified for replacement. It needs to be corrected. I will send you 2 js files with the script itself. The script code starts from line 261 replace.
And now what exactly needs to be done.
Currently, the search and replacement of words works like this: in the Json file from = word and to = word
And there is a problem with short words of three letters, for example, руб should be replaced with грн.
The script does this. Example:
In the article, it finds 100 руб and replaces it with 100 грн. And this is correct.
BUT! When the script encounters any word that contains 3 letters = руб, it replaces them with грн. And it creates a lot of spelling mistakes. It turns normal words into abnormal ones. I showed this in the screenshot.
It simply found the letters that need to be replaced and blindly replaces them in any words, whether they have 3 letters or 45 letters, thus creating abnormal words. For example:
It found the word аеротруба and replaced it with аеротгрну because it found the 3 letters руб in the word and replaced them with 3 letters грн. Thus, it distorted the word.
It found the word рубашки and replaced it with грнашки.
And this happened with hundreds of words in different articles.
It is necessary to make the script precise regarding the number of letters it searches for. For example, if the word in from is a three-letter word, then it should search for words that have no more than 3 letters. And if the word has more than three letters, then it should not replace letters in that word, because it is a different word. I think you understand the essence.
Only make sure it doesn't break my other conditions. There are conditions where words have more than three letters. For example, not руб, but рублів. So here the script should understand that we are making replacements in words that have no more than 6 letters.
In other words, if in the from condition: the word that needs to be replaced consists of three letters, then the script searches for words that have 3 letters and replaces them. Not all words that contain those three letters.
If in the from condition: the word that needs to be replaced consists of 10 letters, then the script should search for these letters only in words that have no more than 10 letters.
Can you IMPROVE THE SCRIPT THAT EXISTS? It works fine. It just lacks precision regarding the number of letters in which it should make replacements. It makes replacements in all words, regardless of the number of letters, and thus in some words the replacement is correct. 100 руб to 100 грн = THIS IS NORMAL! But the word рубашки was replaced with грнашки = THIS IS NOT NORMAL.
I was told earlier that it is necessary to make its logic based on regex. And then it will work more accurately.
Also, in the script, there is code for escaped tags, do not break this line of code. Because! It is responsible for replacing escaped tags, because if something is redone and this piece of code is forgotten, then replacements will not occur in all words. I will explain in detail if needed.
I can test your version of the script myself. Or connect to me via anydesk. And we will test it together.
Evaluate the task. And I will give you the project.
Applications 3
Client's review of cooperation with Vladyslav Lypovets
Add logic to the search and replace words script.Thank you. Excellent specialist. Attentive to the technical task. Work speed is at a high level. I recommend to everyone for collaboration.
Freelancer's review of cooperation with Aleksandr Kremenyuk
Add logic to the search and replace words script.Great client, was in touch all the time, and clearly explained the task, so everything went well. I hope for further cooperation.
-
I work with JavaScript and TypeScript on Node.js.
Write in private messages, we will discuss the details, I will review the script.
-
Hello! Please send the files in private messages, I would like to review the existing code first.
-
2241 35 0 Good day, I can improve the script. The price depends on the volume of work. You can see how many nuances there are just with the case of rub/UAH.
-
690 10 0 Good day, I have familiarized myself with the task and am ready to start. I will be happy to collaborate. Have a nice day.
-
360 3 1 Good day to you. I am proficient in JS, PHP, NodeJS, MySQL. I can help you with solving your tasks.
-
2060 25 0 Good day. Yes, to solve the task, we need to dynamically create a regex. Write in private messages, I will finish your script.
-
1102 21 0 1 Good day, I understood the task, I have experience with similar tasks, I am ready to complete it today.
-
1768 17 1 Good day. I have extensive experience in JavaScript, I will do it by today. Feel free to reach out.
-
простой способ, найти словарь автозамены, и сперва прописать длинные слова потом корткие, пример:
приветствие, привет ,при, вет
-
Current freelance projects in the category Javascript and Typescript
Development of the AM Mobility platform (car service, parking, insurance, car rental)
5770 USD
We are looking for a team or an experienced Full Stack developer to create the MVP of the AM Mobility platform. AM Mobility is a unified digital ecosystem for motorists, combining in one application and web platform: parking; car service; tire fitting; car wash; car rental;… Javascript and Typescript, Web Programming ∙ 4 days 17 hours back ∙ 112 proposals |
Gsap animations
22 USD
Good day. Corrections need to be made in the current project. A specialist is needed who works well with gsap/lenis. Animation of cards needs to be done. Detailed specifications here:… Javascript and Typescript, Web Programming ∙ 4 days 23 hours back ∙ 21 proposals |
I am looking for a mentor with Claude Code to launch a web project from scratch.Brief about the task: I am a beginner with no programming experience. I have a ready specification for website development (42 pages, Next.js, PostgreSQL). I want to implement it myself using Claude Code - I need a specialist who will set up the environment and teach me how to… Javascript and Typescript, Tuition ∙ 6 days 22 hours back ∙ 19 proposals |
Website design updateIt is necessary to update the design of the existing website using HTML, CSS, JS: refresh the appearance, make it modern and responsive for mobile devices. Smooth animations and interactive elements need to be added. HTML & CSS, Javascript and Typescript ∙ 7 days 16 hours back ∙ 96 proposals |
Consultation and audit of the current project on Odoo 19 Community EditionWe are looking for an Odoo Developer — a solo developer with experience in Odoo 19 Community Edition, including using Claude Code. We need a specialist who has successfully implemented projects in Odoo and practical experience in development using Claude Code. Important: we only… C & C++, Javascript and Typescript ∙ 7 days 21 hours back ∙ 8 proposals |