dimanche 19 avril 2015

How to filter out part-of-speech tag?


var sentence = "/`` Do/VBP n't/RB cut/VB off/RP its/PRP$ power/NN ,/, "/'' he/PRP said/VBD ./. ;
var pattern = new Regex(@"/(?:[.,]|\p{Lu}+\b)");
var outcome = pattern.Replace(sentence, string.Empty);

//Output : "/`` Do n't cut off its$ power , "/'' he said .


How should I modify the pattern to produce expected output of:


"Don't cut off its power," he said.


Aucun commentaire:

Enregistrer un commentaire