This REALLY looks like homework, but you've got other replies, so throwing mine into the ring.
Looks like you've got a fancy form of a regular expression, one data file with about 1000 lines of replacements, another file to be replaced.
My recommendation is loading the first file and turning the values into a large regular expression using a std::regex object. Sure the regex will be a few kilobytes long, but that's small potatoes to the engine. Then load the second file into a buffer and use regex_replace() [edit: regex_match()] on it, storing the result in your output stream. Looks like you're parsing about 500K of data, that's easily traversed.
Cppreference.com has an example doing it in 3 lines, but they've got a simple direct string instead of your more complicated data sources. Yours would probably be closer to 10 lines since you've got the formatted source file.
If it is homework you'll need to explain a few things to your teacher, but for a real world environment that's going to likely be your fastest solution unless you want to hand craft something.
Barring that solution (maybe your peers tremble at the power of regular expressions), a hash table mapping the words together and a stream-based process of your second file is probably going to be your next fastest solution. You'll want to be certain you scan for words in place so you avoid unnecessary allocations, that becomes a single pass through the file with fast constant-time lookup of each of the 10K lines, so it should run in a few milliseconds. It will be slower to read and write the result.