代写CS 61B、代做java编程设计
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
1/11
CS 61B
Projects / Project 2C: Ngordnet Enhancements
Each assignment will have an FAQ linked at the top. You can also access it by adding “/faq” to
the end of the URL. The FAQ for Project 2C is located here.
In this project, you?ll complete your implementation of the NGordnet for k!=0 and
commonAncestors case.
As this is a quite new project, there may be occasional bugs or confusion with the spec. If you
notice anything of this sort, please post on Ed.
DANGER
Please read through the 2B spec before starting 2C.
DANGER
THE SETUP FOR THIS PROJECT IS DIFFERENT THAN THE OTHER LABS / PROJECTS.
PLEASE DO NOT SKIP THIS STEP!
Project 2C: Ngordnet Enhancements
FAQ
Checkpoint & Design Doc Due 03/15/2024
Coding Due 04/01/2024
Project Setup
Skeleton Setup
Similar to other assignments in this class, run git pull skeleton main to get the skeleton
code for this project.
1
NOTE: You?ll notice that this skeleton is (almost) the exact same as the Project 2B
skeleton. This is intentional.
a
Download the data files for this project using this link and move them into your proj2c
folder on the same level as src .
2
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
2/11
Once you are done, your proj2c directory should look like this:
WARNING
While you can (and should!) certainly design for 2C in advance, we suggest only starting to
code after you get a full score on Project 2B just in case your implementation has any
subtle bugs in it.
WARNING
IMPORTANT NOTE: You should really complete Project 2B/C: Checkpoint first before
starting coding, or even designing your project. It will be helpful for your understanding of
the project. We will also require you to submit a design document to Gradescope. More
details about the design document can be found in Deliverables and Scoring.
This part of the project is designed for you to come up with an efficient and correct design for
your implementation. The design you come up with will be very important to handle these
cases. Please read the 2B & 2C spec carefully before starting your design document.
Copy your implementation from 2A for ngrams , including TimeSeries and NGramMap , into
the proj2c folder.
3
Copy your implementation from 2B into the proj2c folder, since k!=0 &
commonAncestors will depend on your implementation from 2A and 2B.
4
proj2c
├── data
│ ├── ngrams
│ └── wordnet
├── src
│ ├── <2B helper files>
│ ├── browser
│ ├── main
│ ├── ngrams
│ │ ├──
│ │ └──
│ └── plotting
├── static
└── tests
Copy
Getting Started
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
3/11
We?ve created two wonderful tools that you can (and should!) use to explore the dataset, see
how the staff solution behaves for specific inputs, and get expected outputs for your unit tests
(see Testing Your Code). We?ll link them here, as well as in other relevant parts of the spec.
Wordnet Visualizer: Useful for visually understanding how synsets and hyponyms work and
testing different words/lists of words for potential test case inputs. Click on the “?” bubbles
to learn how to use the various features of this tool!
Staff Solution Webpage: Useful for generating expected outputs for different test case
inputs. Use this to write your unit tests!
TASK
Read through the entire 2B/C spec and complete Project 2B/C: Checkpoint
After finishing the checkpoint, complete Design Document
In Project 2B, we handled the situation where k == 0 , which is the default value when the
user does not enter a k value.
Your required task is to handle the case where the user enters k . k represents the maximum
number of hyponyms that we want in our output. For example, if someone enters the word
“dog”, and then enters k = 5 , your code would return at most 5 words.
To choose the 5 hyponyms, you should return the k words which occurred the most times in
the time range requested. For example, if someone entered words = ["food", "cake"] ,
startYear = 1950 , endYear = 1990 , and k = 5 , then you would find the 5 most popular
words in that time period that are hyponyms of both food and cake. Here, the popularity is
defined as the total number of times the word appears over the entire time period requested.
The words should then be returned in alphabetical order. In this case, the answer is [cake,
cookie, kiss, snap, wafer] if we?re using top_14377_words.csv , total_counts.csv ,
synsets.txt , and hyponyms.txt .
DANGER
Be sure you are getting the words that appear with the highest counts, not the highest
weights. Otherwise, you will run into issues that are very difficult to debug!
Note that if the frontend doesn?t supply a year, default values of startYear = 1900 and endYear
= 2020 are provided by NGordnetQueryHandler.readQueryMap .
It might be hard to figure out the hyponyms of the words with k != 0 so we are providing
data that is easier to visualize! Below, you?ll see a modified version for EECS class
?
?
Handling k != 0
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
4/11
requirements, inspired by HKN. We have also provided the data that represents the graph
below ( frequency-EECS.csv , hyponyms-EECS.txt , synsets-EECS.txt ). If someone entered
words = ["CS61A"] , startYear = 2010 , endYear = 2020 , and k = 4 , you should receive
"[CS170, CS61A, CS61B, CS61C]" . This frequency-EECS.csv is a bit different from the
previous one since it has values with the same frequencies. We highly recommend you to take
a look at frequency-EECS.csv . Also, while you are designing your implementation, bear this in
mind that we can give you words with the same frequencies.
Project 2C: Ngordnet Enhancements - EECS Course Guide Edited 1 month ago
If a word never occurs in the time frame specified, i.e. the count is zero, it should not be
returned. In other words, if k > 0 , we should not show any words that do not appear in the
ngrams dataset.
If there are no words that have non-zero counts, you should return an empty list, i.e. [] .
If there are fewer than k words with non-zero counts, return only those words. For example if
you enter the word "potato" and enter k = 15 , but only 7 hyponyms of "potato" have
non-zero counts, you?d return only 7 words.
This task will be a little trickier since you?ll need to figure out how to pass information around
so that the HyponymsHandler knows how to access a useful NGramMap .
TASK
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
5/11
Modify your HyponymsHandler and the rest of your implementation to deal with the k !=
0 case.
WARNING
EECS-course guide is not available on the interactive web staff solution so it won?t return
anything if you give the input CS61A .
DANGER
DO NOT MAKE A STATIC NGRAMMAP FOR THIS TASK! It might be tempting to simply
make some sort of public static NGramMap that can be accessed from anywhere in your
code. This is called a "global variable".
We strongly discourage this way of thinking about programming, and instead suggest that
you should be passing an NGramMap to either constructors or methods. We?ll come back
to talking about this during the software engineering lectures.
Until you use the autograder, you?ll need to construct your own test cases. We provided
one in the previous section: words = ["food", "cake"] , startYear = 1950 , endYear =
1990 , k = 5 .
When constructing your own test cases, consider making your own input files. Using the
large input files we provide is extremely tedious.
Up until now, we have only been concerned with finding the common hyponyms of words. For
the last part of this project, your task is to find the common ancestors.
That is, given a set of words, what words contain the given set of words as hyponyms?
For example, consider synsets16.txt and hyponyms16.txt from 2B:
Tips
?
?
Finding Common Ancestors
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
6/11
If we find the ancestors of "adjustment" , we should get "[adjustment, alteration, event,
happening, modification, natural_event, occurrence, occurrent]" , as shown in the
graph below.
This also should apply to words in multiple contexts, as seen with "change" :
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
7/11
The ancestors of "change" should be "[act, action, alteration, change, event,
happening, human_action, human_activity, modification, natural_event, occurrence,
occurrent]" .
We can also ask for the common ancestors of sets of words, which can reveal some neat
relationships!
Here, we find the common ancestors of the words = ["change", "adjustment"] . The result
should be "[alteration, event, happening, modification, natural_event, occurrence,
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
8/11
occurrent]" , which are all the words in the graph that contain both "change" and
"adjustment" as hyponyms. Note that "alteration" and "modification" are also included
in the result, contrary to what you might expect, as explained below.
Note: Be sure to take a word intersection rather than a node intersection just as in 2B, so the
common ancestors of ["test_subject", "math"] in the following graph should return "
[subject]" , as "subject" contains both "test_subject" and "math" as hyponyms, even
though "test_subject" and "math" are not directly connected in the graph.
We may also ask for common ancestors of three or more words.
Note that the outputs are in alphabetical order, and keep in mind that k != 0 can also apply
to this task.
Your query handling needs to remain efficient for common ancestors (i.e., the timeouts applied
to 2B still apply here). This means that going through every single word and checking if it
contains all the words in the query as hyponyms will be too slow on the larger datasets!
You will need to modify your HyponymsHandler class to account for the type of query, i.e.,
hyponyms or common ancestors. This should look similar to how you found startYear ,
endYear , or k , and this will be specified for you with NgordnetQueryType.HYPONYMS or
NgordnetQueryType.ANCESTORS , respectively.
TASK
Modify your HyponymsHandler and the rest of your implementation to handle common
ancestor queries in addition to hyponym queries.
As mentioned before, you should not need to copy-paste your code or do anything too drastic
to handle this task. Consider how you can use the same data structures and methods from
before to solve this problem, perhaps with a few tweaks.
NgordnetQueryType
Design Tips
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
9/11
Helper methods are your friends! If you find yourself writing similar code more than once,
consider making a helper method that you can call from both places that does the common
work for you.
For Project 2C, the only required deliverable is the HyponymsHandler.java file, in addition to
any helper classes. However, we will not be directly grading these classes, since they can vary
from student to student.
Project 2B/C: Checkpoint: 5 points - Due March 15th
Project 2C Coding: 25 points - Due April 1st
HyponymsHandler popularity-hardcoded: 20%, k != 0
HyponymsHandler popularity-randomized: 30%, k != 0
HyponymsHandler common-ancestors: 50%
In addition to Project 2C, you will also have to turn in your design document. This will be worth
5 points and it is due March 15th. The design document?s main purpose is to serve as a
foundation for your project. It is important to think and ideate before coding. What we are
looking for in the design document:
Identify the data structures we have learned in the class that you will be using in your
implementation.
Pseudocode / general overview of your algorithm for your implementation.
Your design document should be around 1 - 2 pages long. Design document will be mainly
graded on effort, thought and completion.
Please make a copy of this template and submit to Gradescope.
Don?t worry if you decide to change your design document after. You are free to do so! We
want you to think about the implementation before coding therefore we require you to submit
your design as the part of the project.
The token limiting policy for this project will be as follows: You will start with 8 tokens, each of
which has a 24-hour refresh time.
We?ve provided you with two short unit test files for this project in the proj2c/tests
directory:
TestOneWordKNot0Hyponyms.java
Deliverables and Scoring

Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
10/11
TestCommonAncestors.java
These test files are not comprehensive; in fact, they each only contain one sanity check
test. You should fill each file with more unit tests, and also use them as a template to create
two new test files for the respective cases.
If you need help figuring out what the expected outputs of your tests should be, you should
use the two tools that we linked in the Getting Started section.
Use the small files while testing! This decreases the startup time to run Main.java and
makes it easier to reason about the code. If you?re running Main.java , these files are set in
the first few lines of the main method. For unit tests, the file names are passed into the
getHyponymsHandler method.
You can run Main.java with the debugger to debug different inputs quickly. After clicking
the “Hyponyms” button, your code will execute with the debugger - breakpoints will be
triggered, you can use the variables window, etc.
There are a lot of moving parts to this project. Don?t start by debugging line-by-line.
Instead, narrow down which function/region of your code is not working correctly then
search more closely in those lines.
Check the FAQ for common issues and questions.
Throughout this assignment, we?ve had you use your front end to test your code. Our grader is
not sophisticated enough to pretend to be a web browser and call your code. Instead, we?ll
need you to provide a method in the proj2c_testing.AutograderBuddy class that provides a
handler that can deal with hyponyms requests.
When you ran git pull skeleton main at the start of this spec, you should have received a
file called AutograderBuddy.java
Just like 2B, open AutograderBuddy.java and fill in the getHyponymsHandler method such
that it returns a HyponymsHandler that uses the four given files. Your code here will probably
be similar to your code in Main.java .
Now that you?ve created proj2c.testing.AutograderBuddy , you can submit to the
autograder. If you fail any tests, you should be able to replicate them locally as JUnit tests by
building on the test files above. If any additional datafiles are needed, they will be added to this
section as links.

Submitting Your Code
Project 2C: Ngordnet Enhancements | CS 61B Spring 2024
11/11
If you?d like to go above and beyond in this project (and even explore some front-end
development), read through the Optional Features spec!
The WordNet part of this assignment is loosely adapted from Alina Ene and Kevin Wayne?s
Wordnet assignment at Princeton University.
Optional Extra Features
Acknowledgements

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图