grammar1 = nltk.data.load('/users/luke/mygrammar.cfg') if you are using *nix and 'luke' is your home directory and mygrammar.cfg is in that directory, or it's Win equivalent.
Hi: I have the following error message when I try to load a .cfg file. I used the following expression.grammar1 = nltk.data.load('file:mygrammar.cfg')The actual error message is as follows. Could anyone help me out? Thanks much in advance.Traceback (most recent call last): File "tree2.py", line 8, in <module> grammar1 = nltk.data.load('file:mygrammar.cfg') File "nltk/data.py", line 597, in load File "nltk/grammar.py", line 1036, in parse_cfg File "nltk/grammar.py", line 1199, in parse_grammar ValueError: Unable to parse line 1: grammar1 = nltk.parse_cfg(""" Expected an arrow
Luke: can you show us the first few lines of your grammar file?
2010/1/9 Richard Careaga <leu...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "nltk-users" group.
> To post to this group, send email to nltk-...@googlegroups.com.
> To unsubscribe from this group, send email to
> nltk-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nltk-users?hl=en.
>
>
Thanks very much for your message.
Actually, I made a mistake. Originally, I included "grammar1 = nltk.parse.cfg(""" ... """)" in "mygrammar.cfg". Later I noticed that it should not be part of the .cfg file. After removing this part, the file loads correctly.
Indeed, the error message was right. The content was not in the right format. Thanks again!