Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #Section3, Task 1: Given a list of tagged sentences, build and return
  2. #a dictionary whose keys are words ending in 'ing', where the value
  3. #associated with a w is a *list* of all pos-tags assigned to w anywhere
  4. #in the given sentences.
  5. #Add script for build_ing_dict here:
  6. def build_ing_dict(tag_sent_list):
  7. ing_dict = {}
  8. key = 0
  9. pattern = r'^.*(?:ing)$'
  10.  
  11. for s in tag_sent_list:
  12. # for sentences in tag_sent_list.sents(s):
  13. for word in s:
  14.  
  15.  
  16. # for word in range(len(tag_sent_list)):
  17. if re.match(pattern,word):
  18. ing_dict[key] = word
  19. key+=1
  20. print ing_dict
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement