Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Section3, Task 1: Given a list of tagged sentences, build and return
- #a dictionary whose keys are words ending in 'ing', where the value
- #associated with a w is a *list* of all pos-tags assigned to w anywhere
- #in the given sentences.
- #Add script for build_ing_dict here:
- def build_ing_dict(tag_sent_list):
- ing_dict = {}
- key = 0
- pattern = r'^.*(?:ing)$'
- for s in tag_sent_list:
- # for sentences in tag_sent_list.sents(s):
- for word in s:
- # for word in range(len(tag_sent_list)):
- if re.match(pattern,word):
- ing_dict[key] = word
- key+=1
- print ing_dict
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement