I am relatively new to Java, and I need help extracting multiple substrings from a string. An example line is shown below:
String = "How/WRB can/MD I/PRP find/VB a/DT list/NN of/IN celebrities/NNS '/POS real/JJ names/NNS ?/."
Desired Result: WRB MD PRP VB DT NN IN NNS POS JJ NNS
I have a text file with possible thousands of similar POS-labeled lines that I need to extract POS tags and do some calculations based on POS tags.
I tried to use a tokenizer, but did not get the desired result. I even tried to use split()and store in arrays because I need to store and use it later, and this still does not work.
Finally, I tried using a wildcard template, and I am having trouble with regex because it returns a word with a slash.
Regex: [\/](.*?)\s\b
Result: /WRB /MD ....
, , - , .