nltk_tree(sentence) throws NameError
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
A pattern.text.Sentence can't be converted into an nltk.tree.Tree, at least not
with nltk version 3.0.4.
>>> import pattern
>>> from pattern.de import parsetree
>>> sentence = parsetree('Hans liebt Maria.')[0]
>>> pattern.text.tree.nltk_tree(sentence)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-13-7bbd6533ae36> in <module>()
----> 1 pattern.text.tree.nltk_tree(sentence)
/usr/local/lib/python2.7/dist-packages/Pattern-2.6-py2.7.egg/pattern/text/tree.pyc in nltk_tree(sentence)
1592 v.append(ch.pnp)
1593 T.append(')')
-> 1594 return tree.bracket_parse(' '.join(T))
1595
1596 ### GRAPHVIZ DOT ###################################################################################
/usr/local/lib/python2.7/dist-packages/nltk-3.0.4-py2.7.egg/nltk/tree.pyc in bracket_parse(s)
1488 Use Tree.read(s, remove_empty_top_bracketing=True) instead.
1489 """
-> 1490 raise NameError("Use Tree.read(s, remove_empty_top_bracketing=True) instead.")
1491
1492 def sinica_parse(s):
NameError: Use Tree.read(s, remove_empty_top_bracketing=True) instead.
>>> import nltk
>>> nltk.__version__
'3.0.4'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pattern/text/tree.py at nltk_tree, using the traceback and the NLTK 3.0.4 version as context. Check the current NLTK tree parsing API and verify that converting the example pattern.text.Sentence completes without the reported NameError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100