Skip to content

Commit

Permalink
Found other places where old cfg module was referenced.
Browse files Browse the repository at this point in the history
Fixed several stale lines in nltk_contrib/misc/*.py


svn/trunk@6753
  • Loading branch information
stevenbird committed Oct 30, 2008
1 parent 47ef14d commit cc53acc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions nltk/data.py
Expand Up @@ -352,9 +352,9 @@ def retrieve(resource_url, filename=None, verbose=True):
FORMATS = {
'pickle': "A serialized python object, stored using the pickle module.",
'yaml': "A serialzied python object, stored using the yaml module.",
'cfg': "A context free grammar, parsed by nltk.cfg.parse_cfg().",
'pcfg': "A probabilistic CFG, parsed by nltk.cfg.parse_pcfg().",
'fcfg': "A feature CFG, parsed by nltk.cfg.parse_fcfg().",
'cfg': "A context free grammar, parsed by nltk.parse_cfg().",
'pcfg': "A probabilistic CFG, parsed by nltk.parse_pcfg().",
'fcfg': "A feature CFG, parsed by nltk.parse_fcfg().",
'fol': "A list of first order logic expressions, parsed by "
"nltk.sem.parse_fol() using nltk.sem.logic.LogicParser.",
'logic': "A list of first order logic expressions, parsed by "
Expand Down
4 changes: 2 additions & 2 deletions nltk/grammar.py
Expand Up @@ -442,7 +442,7 @@ def check_coverage(self, tokens):
if missing:
missing = ', '.join('%r' % (w,) for w in missing)
raise ValueError("Grammar does not cover some of the "
"input words: %r." +missing)
"input words: %r." % missing)

# [xx] does this still get used anywhere, or does check_coverage
# replace it?
Expand Down Expand Up @@ -943,7 +943,7 @@ def parse_fcfg(input, features=None, logic_parser=None, fstruct_parser=None):
lexicon = earley_lexicon(lexical_productions)
return ContextFreeGrammar(start, grammatical_productions, lexicon)

@deprecated("Use nltk.cfg.parse_fcfg() instead.")
@deprecated("Use nltk.parse_fcfg() instead.")
def parse_featcfg(input):
return parse_fcfg(input)

Expand Down
6 changes: 3 additions & 3 deletions nltk/tree.py
Expand Up @@ -15,7 +15,7 @@
import re
import string

import nltk.grammar
from grammar import Production, Nonterminal
from probability import ProbabilisticMixIn
from util import slice_bounds

Expand Down Expand Up @@ -252,7 +252,7 @@ def productions(self):
if not isinstance(self.node, str):
raise TypeError, 'Productions can only be generated from trees having node labels that are strings'

prods = [nltk.cfg.Production(nltk.cfg.Nonterminal(self.node), _child_names(self))]
prods = [Production(Nonterminal(self.node), _child_names(self))]
for child in self:
if isinstance(child, Tree):
prods += child.productions()
Expand Down Expand Up @@ -1293,7 +1293,7 @@ def _child_names(tree):
names = []
for child in tree:
if isinstance(child, Tree):
names.append(nltk.cfg.Nonterminal(child.node))
names.append(Nonterminal(child.node))
else:
names.append(child)
return names
Expand Down

0 comments on commit cc53acc

Please sign in to comment.