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 usingarrays.sort(arr). - read lines
tagged.txtline line , store instring. usesplit()split line different words , store words in array. - then loop through words of line, , use array's
binarysearchmethod search through words words array.
Comments
Post a Comment