0
$\begingroup$

I working on a dataset, I did the pos_tagging using nltk. Now I want to know which sequence of grammar is most common in my rows, then I want to define a chunk grammar based on a common grammar sequence. Can you please tell me how to do it in python? Thank you

enter image description here

$\endgroup$
3
  • $\begingroup$ You would need to extract n-grams of POS tags for various lengths N and count their frequency. $\endgroup$
    – Erwan
    Jan 24, 2022 at 21:23
  • $\begingroup$ I need to know the grammar sequence followed by most of the sentences. e.g, Noun>Verb> DT>Noun>Pronoun etc....... $\endgroup$
    – aadil gani
    Jan 25, 2022 at 17:23
  • $\begingroup$ Yes, as I said the first step is to compute all the POS n-grams frequencies. You have several options to do this, personally I would simply code it myself (it's not very complex) but otherwise you can prepare the list of POS tags as if they are words and feed this to CountVectorizer. $\endgroup$
    – Erwan
    Jan 25, 2022 at 18:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.