regex - Read Certain words from text file java -


so have text file (tagged.txt) full of different sentences. looking read text file java, , extract specific words file.

e.g

sentence : i went shop buy new pair of trainers

if sentence has words shop, buy, or trainers in it, sentence equal opinion.

i have created list of words in text file (words.txt), in stream against tagged.txt file.

i wanted know if there way of implementing in java.

  • read words words.txt , store in array , sort using arrays.sort(arr).
  • read lines tagged.txt line line , store in string. use split() split line different words , store words in array.
  • then loop through words of line, , use array's binarysearch method search through words words array.

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -