NLTK Context Free Grammar Genaration

后端 未结 4 1650
花落未央
花落未央 2021-02-06 01:01

I\'m working on a non-English parser with Unicode characters. For that, I decided to use NLTK.

But it requires a predefined context-free grammar as below:



        
4条回答
  •  情歌与酒
    2021-02-06 01:21

    You can't write such kind of rules in nltk right now without any effort but you can make some tricks.

    For example, transcribe your sentence in some kind of word-informative labels and write your grammar rules accordingly.

    For example (using POS tag as label):

    Dogs eat bones. 
    

    becomes:

    NN V NN.
    

    And grammar terminal rules example:

    V -> 'V'
    

    If that's not enough you should take a look for a more flexible formalism implementation.

提交回复
热议问题