CAS LX 390 / | NLP/CL | Midterm |
GRS LX 690 | Fall 2016 | due Wed 10/19 |
This is a “take-home” midterm, because I don’t want to add unnecessary anxiety, or run into technical trouble that causes things to get delayed in what would be a short time to take an in-class midterm.
However, it is still of course important that you do this on your own. What that means specifically is not consulting with classmates, roommates, etc. I do not plan for this to be difficult. If you (feel that you) have been doing relatively well on understanding the homework, then these things should not be particularly challenging. If you are having technical trouble, please let me know, and I will try to help you troubleshoot.
One thing you are hereby explicitly allowed to do, however, is consult static online reference sources. So, looking things up in the book, in the detailed documentation on python.org, nltk.org, StackExchange, etc., is fine. That is, after all, how you would proceed in the real world if you have a problem you want to solve. If you have questions, you can ask me.
I don’t think there will be much cause to worry about the ground rules, but I still wanted to state them. I expect this to take not (much?) more than the time it would have taken to do this in class time.
Define a function called non_five_odds
that will take an integer n
as an argument,
and return a list of all the odd numbers between 0 and n
except 5.
Notes:
n
” here means that you are not responsible for how non_five_odds(10.5)
behaves. It does not need to reject 10.5 as being a non-integer, but it does not
matter what the function returns in that case.non_five_odds(10)
should return [1, 3, 7, 9]
.range()
will be useful, but note that the number you provide to
range()
must be an integer.int()
to convert a float to an integer (the integer toward 0):
int(29/10) == 2
.Use Python to count how many different words in “Alice’s Adventures in Wonderland”
contain the sequence hat
.
Notes / assumptions:
Use Python to create a list containing any sentences in “Alice’s Adventures in Wonderland” in which the actual word “hat” appears, and provide the resulting list.
Notes:
['I have a hat .', 'You have a hat .']
and not [['I', 'have', 'a', 'hat', '.'],['You', 'have', 'a', 'hat', '.']]
Use WordNet to provide the senses of the word “hat”, the definition of each, hypernyms of each, and examples of each.
Notes: