I have a file that contains basic examples of input and output:
[Database.txt]
Hello*==Hello. How are you?
How*are*you*==I am fine I guess.
Can you*die*==I can not die. I am software.
I will get an input string that does not have punctuation.
Example: "can you ever die in a million years"
I am trying to match the input with the first side of the database on the left of "==" and return the second side of the line the string matched the first side with. So where input = "can you ever die in a million years", output = "I can not die. I am software."
I have to use native JavaScript. This is part of a personal project I have been working on and have not been able to get past in 4 months. It is part of an independent natural speech engine that could download the file, read it to a variable, and use it as a reference. I have tried combinations of looping through lines, splitting at "==", str.match(), and a lot of other stuff. I will manage case insensitivity. Any help would be greatly appreciated.
bashfor the job, let me know, it would be a piece of cake.