in reply to print failing to output anything

To other monks replying, the empty while loop is a red herring.

Looks like you are looping through the file and checking for "words" ending with /NN, /NNP, or /NNS. But your definition of word /\w['\w-]*/ doesn't allow them to contain a / character, so nothing matches.

A common problem with using //g is that it silently ignores bad input, leading to surprises.