When I run the code in python3,
frompattern3.enimporttagfromnltk.corpusimportwordnetaswn# Annotate text tokens with POS tagsdefpos_tag_text(text):
defpenn_to_wn_tags(pos_tag):
ifpos_tag.startswith('J'):
returnwn.ADJelifpos_tag.startswith('V'):
returnwn.VERBelifpos_tag.startswith('N'):
returnwn.NOUNelifpos_tag.startswith('R'):
returnwn.ADVelse:
returnNonetagged_text=tag(text)
tagged_lower_text= [(word.lower(), penn_to_wn_tags(pos_tag))
forword, pos_tagintagged_text]
returntagged_lower_textI got the error message:
File "/Anaconda3/lib/python3.6/site-packages/pattern3/text/tree.py", line 37
except:
^
IndentationError: expected an indented block
When I run the code in python3,
I got the error message:
File "/Anaconda3/lib/python3.6/site-packages/pattern3/text/tree.py", line 37
except:
^
IndentationError: expected an indented block