Open
Conversation
Merge finwake from upstream
auberonedu
reviewed
Feb 18, 2025
Comment on lines
+17
to
+19
| The wipers on the bus go “Swish, swish, swish, | ||
| Swish, swish, swish, swish, swish, swish” | ||
| The wipers on the bus go “Swish, swish, swish” |
There was a problem hiding this comment.
Definitely good music. Looks like you might be missing the rambleOutput.txt though asked for in Wave 6?
|
|
||
|
|
||
|
|
||
| if(arr[i] == " " || arr[i] == " " || arr[i] == "") //filtering out the extra spaces inside the arrayList |
There was a problem hiding this comment.
This works! scanner also has the functionality built in to skip whitespace with scanner.next
Comment on lines
+62
to
+67
| else if(arr[i].endsWith(".")) | ||
| { | ||
| arr[i] = arr[i].replace('.', ' '); | ||
| textList.add(arr[i].trim().toLowerCase()); | ||
| textList.add("."); | ||
| } |
Comment on lines
+20
to
+28
| @Test | ||
| void testTokenizeWithMultipleSpaces() | ||
| { | ||
| LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer(); | ||
| Scanner scanner = new Scanner("hello hi hi hi hello hello"); | ||
| List<String> tokens = tokenizer.tokenize(scanner); | ||
|
|
||
| assertEquals(List.of("hello","hi", "hi","hi", "hello","hello"), tokens); | ||
| } |
Comment on lines
+70
to
+81
| for(int i = 0; i < trainingWords.size(); i++) | ||
| { | ||
| keyText = trainingWords.get(i); | ||
| for(int j= 0; j < trainingWords.size()-1; j++) | ||
| { | ||
| if(keyText.equals(trainingWords.get(j))) | ||
| { | ||
| valueWords.add(trainingWords.get(j+1)); | ||
| } | ||
| } | ||
| neighborMap.put(trainingWords.get(i), valueWords); | ||
| valueWords = new ArrayList<String>(); |
There was a problem hiding this comment.
Nice logic! As an alternative, can you think of how this could be done without a nested loop?
Comment on lines
+178
to
+181
| for (int i = 0; i < probaleList.size(); i++) //having the returned probable word return the most likely word from the random number | ||
| { | ||
| probableWord = probaleList.get(wordProb.nextInt(max - 0 + 1)); | ||
| } |
There was a problem hiding this comment.
We don't need the for loop here - getting a random word once is enough
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.