Pretty print the NLTK syntax tree too
This commit is contained in:
parent
114731060f
commit
edfb9e89f6
@ -585,7 +585,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 33,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
@ -609,8 +609,42 @@
|
|||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"from stat_parser import Parser\n",
|
"from stat_parser import Parser\n",
|
||||||
"parser = Parser()\n",
|
"parsed = Parser().parse('The quick brown fox jumps over the lazy dog.')\n",
|
||||||
"print parser.parse('The quick brown fox jumps over the lazy dog.')"
|
"print parsed"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 34,
|
||||||
|
"metadata": {
|
||||||
|
"slideshow": {
|
||||||
|
"slide_type": "fragment"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
" S \n",
|
||||||
|
" ________________________|__________________________ \n",
|
||||||
|
" | VP | \n",
|
||||||
|
" | ____|_____________ | \n",
|
||||||
|
" | | NP | \n",
|
||||||
|
" | | _________|________ | \n",
|
||||||
|
" | | | PP | \n",
|
||||||
|
" | | | ________|___ | \n",
|
||||||
|
" NP | NP | NP | \n",
|
||||||
|
" ___|____ | ___|____ | _______|____ | \n",
|
||||||
|
" DT NN VB JJ NN IN DT JJ NN . \n",
|
||||||
|
" | | | | | | | | | | \n",
|
||||||
|
"the quick brown fox jumps over the lazy dog . \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"parsed.pretty_print()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user