Commit bc768081 by Steven Bird

updated ChunkRule factory function to use fromstring instead of parse, a change…

updated ChunkRule factory function to use fromstring instead of parse, a change introduced in NLTK. Resolves #787
parent 17871109
...@@ -902,7 +902,7 @@ class RegexpChunkApp(object): ...@@ -902,7 +902,7 @@ class RegexpChunkApp(object):
self.normalized_grammar = self.normalize_grammar( self.normalized_grammar = self.normalize_grammar(
self._history[index][0]) self._history[index][0])
if self.normalized_grammar: if self.normalized_grammar:
rules = [RegexpChunkRule.parse(line) rules = [RegexpChunkRule.fromstring(line)
for line in self.normalized_grammar.split('\n')] for line in self.normalized_grammar.split('\n')]
else: else:
rules = [] rules = []
...@@ -1035,7 +1035,7 @@ class RegexpChunkApp(object): ...@@ -1035,7 +1035,7 @@ class RegexpChunkApp(object):
line = line.strip() line = line.strip()
if line: if line:
try: try:
RegexpChunkRule.parse(line) RegexpChunkRule.fromstring(line)
except ValueError as e: except ValueError as e:
self.grammarbox.tag_add('error', '%s.0' % (lineno+1), self.grammarbox.tag_add('error', '%s.0' % (lineno+1),
'%s.0 lineend' % (lineno+1)) '%s.0 lineend' % (lineno+1))
...@@ -1068,7 +1068,7 @@ class RegexpChunkApp(object): ...@@ -1068,7 +1068,7 @@ class RegexpChunkApp(object):
try: try:
# Note: the normalized grammar has no blank lines. # Note: the normalized grammar has no blank lines.
if normalized_grammar: if normalized_grammar:
rules = [RegexpChunkRule.parse(line) rules = [RegexpChunkRule.fromstring(line)
for line in normalized_grammar.split('\n')] for line in normalized_grammar.split('\n')]
else: else:
rules = [] rules = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment