-
Notifications
You must be signed in to change notification settings - Fork 27
Wave six Complete #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Merge finwake from upstream
auberonedu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works! scanner also has the functionality built in to skip whitespace with scanner.next
| else if(arr[i].endsWith(".")) | ||
| { | ||
| arr[i] = arr[i].replace('.', ' '); | ||
| textList.add(arr[i].trim().toLowerCase()); | ||
| textList.add("."); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice logic
| @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); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice logic! As an alternative, can you think of how this could be done without a nested loop?
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the for loop here - getting a random word once is enough
No description provided.