forked from clips/pattern
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
When I run the code in python3,
from pattern3.en import tag
from nltk.corpus import wordnet as wn
# Annotate text tokens with POS tags
def pos_tag_text(text):
def penn_to_wn_tags(pos_tag):
if pos_tag.startswith('J'):
return wn.ADJ
elif pos_tag.startswith('V'):
return wn.VERB
elif pos_tag.startswith('N'):
return wn.NOUN
elif pos_tag.startswith('R'):
return wn.ADV
else:
return None
tagged_text = tag(text)
tagged_lower_text = [(word.lower(), penn_to_wn_tags(pos_tag))
for word, pos_tag in
tagged_text]
return tagged_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
Metadata
Metadata
Assignees
Labels
No labels