GithubHelp home page GithubHelp logo

zhima-mochi / replace-multiple-words Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 34 KB

Given replace map, we can replace all the correspond words in input file without wrong twice replace.

C++ 93.40% Dockerfile 2.68% CMake 3.92%
cpp17 docker trie-structure

replace-multiple-words's Introduction

replace-multiple-words

Given replace map, we can replace all the correspond words in input file without wrong twice replace.

Example:

mapping.txt

Key:Value
紅色:草莓口味
草莓:小熊軟糖
紅色辣椒:綠色青椒
啊:[del]

Can use ":" or ":".
Key and value should not be "".
Use [del] to replace key as "".

input.txt

This is my Key.
我有一個紅色辣椒啊
我還有紅色的草莓啊
2022紅色辣年糕

output.txt

This is my Value.
我有一個綠色青椒
我還有草莓口味的小熊軟糖
2022草莓口味辣年糕

In the second line, "紅色辣椒" would not be "草莓口味辣椒" and be "綠色青椒" correctly. In the fourth line, replace "紅色" with "草莓口味" successfully and would not be disturbed by "紅色辣椒".

Getting started

git clone https://github.com/Zhima-Mochi/replace-multiple-words.git
cd replace-multiple-words
docker build -t replace-words .
cd test
docker run --rm -v ${PWD}:/files replace-words your_mapping_file.txt your_input_file.txt your_output_file.txt

replace-multiple-words's People

Contributors

joy-brave avatar zhima-mochi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.