LETS GOO 6/6 WAVES 8/8 TEST CASES WE DONE!!!#14
Open
RJRico17 wants to merge 16 commits intogrc-cohort-21:mainfrom
Open
LETS GOO 6/6 WAVES 8/8 TEST CASES WE DONE!!!#14RJRico17 wants to merge 16 commits intogrc-cohort-21:mainfrom
RJRico17 wants to merge 16 commits intogrc-cohort-21:mainfrom
Conversation
…HE EU SPELLING THATS WHY SOME THINGS WERE MESSING UP
…erflow said the way the private hashmap was intialized was wrong??? added new HashMap()<>; and life is good
WE GET FIVE BIG BOOMS BOOM BOOM BOOM BOOM BOOM
…e some edgarallenpoe type poems for 1000 words and let the tokenizer break it down then ran it and its all good!
auberonedu
reviewed
Feb 18, 2025
| for (int i=0;i<word.length();i++) { | ||
| wordBreakdown[i] = word.charAt(i); | ||
| } | ||
| if (wordBreakdown[word.length()-1]=='.') { |
There was a problem hiding this comment.
This works well! As an alternative you could use endsWith
Comment on lines
+19
to
+25
| @Test | ||
| public void testSentenceWillSplitIntoList() { | ||
| LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer(); | ||
| Scanner scanner = new Scanner("RJ Fredrick Rico is a pool player who will be the best in Washington State."); | ||
| List<String> tokens = tokenizer.tokenize(scanner); | ||
| assertEquals(List.of("rj","fredrick", "rico","is","a","pool","player","who","will","be","the","best","in","washington","state","."), tokens); | ||
| } |
There was a problem hiding this comment.
This doesn't quite test what was being asked for. The instructions asked for a test that would have multiple spaces in a row, like hi hey hi
Comment on lines
+55
to
+65
| for (int i=0; i < trainingWords.size()-1; i++) { | ||
| String currentWord = trainingWords.get(i); | ||
| List<String> emptyList = new ArrayList<>(); | ||
| if (!neighborMap.containsKey(currentWord)) { | ||
| neighborMap.put(currentWord, emptyList); | ||
| emptyList.add(trainingWords.get(i+1)); | ||
| } | ||
| else { | ||
| List<String> currentNeighbors = neighborMap.get(currentWord); | ||
| currentNeighbors.add(trainingWords.get(i+1)); | ||
| } |
Comment on lines
+114
to
+118
| Random rand = new Random(); | ||
| String text = ""; | ||
| List<String> nextWords = neighborMap.get(context.get(context.size()-1)); | ||
| text = nextWords.get(rand.nextInt(nextWords.size())); | ||
| return text; |
There was a problem hiding this comment.
Nice! I think we don't need line 115 though, we can just declare and initialize the variable at the same time on 117.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.