Je suis un débutant aux outils PNL. J'ai besoin d'obtenir tous les noms du code ci-dessous à un tableau. Comment puis-je faire ceci ?Obtenir tous les noms à un ensemble de tableaux en utilisant le noyau NLP
public String s = "I like java and python";
public static Set<String> nounPhrases = new HashSet<>();
public void me() {
Document doc = new Document(" " + s);
for (Sentence sent : doc.sentences()) {
System.out.println("The parse of the sentence '" + sent + "' is " + sent.parse());
}
Ce code me donne la sortie ci-dessous.
The parse of the sentence 'I like java and python' is (ROOT (S (NP (PRP I)) (VP (VBP like) (NP (NN java) (CC and) (NN python)))))
J'ai besoin tous
NN
à mon tableau mis nounPhrases. Comment puis-je faire ceci ?
J'utilise la PNL bibliothèque de base simple Stanford [lien] (https://stanfordnlp.github.io/CoreNLP/simple.html) – user8048032