Open
Conversation
… index locations) and added method to retrieve predicted word based on the random number
…cally are passing; commented out test prints
auberonedu
reviewed
Feb 18, 2025
| $ cd c:\\Users\\Blaze\\SDEV301\\projects\\ramblebot ; /usr/bin/env C:\\Program\ Files\\Java\\jdk-23\\bin\\java.exe @C:\\Users\\Blaze\\AppData\\Local\\Temp\\cp_18ci5o9mcfusdn4uv3b7jw736.argfile RambleApp | ||
| Enter the filename: poeTraining.txt | ||
| Enter the number of words to generate: 100 | ||
| by a shore; seas that drip all over; mountains toppling evermore into seas that walks in agony, to the traveller meets, aghast, sheeted memories of the fring'd lid; and dead,? their sad and sigh as they pass the sad and pools where dwell the dismal tarns and dead,? their lone waters, lone and titan woods, with the earth?and heaven . bottomless vales and caves, and pools where dwell the mountains?near the newt encamp,? by the wanderer by? white-robed forms of the past? shrouded forms that thus the snows of the earth?and heaven . for the heart whose woes are legion No newline at end of file |
Comment on lines
+45
to
+46
| // if the word ends with a period | ||
| if (word.endsWith(".")) { |
Comment on lines
+22
to
+29
| @Test | ||
| void testTokenizeSentenceWithMultipleSpaces() { | ||
| 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
+56
to
+60
| // make sure neighbormap is properly initialized | ||
| // it took a little bit to realize you hadn't done this | ||
| if (neighborMap == null) { | ||
| neighborMap = new HashMap<>(); | ||
| } |
There was a problem hiding this comment.
Nice catch! Yes, this can either happen here or in the constructor.
Comment on lines
+70
to
+76
| if (!neighborMap.containsKey(currentWord)) { | ||
|
|
||
| // if it isn't build a new list | ||
| List<String> list = new ArrayList<>(); | ||
|
|
||
| // add it to the map with currentWord as the key | ||
| neighborMap.put(currentWord, list); |
Comment on lines
+143
to
+144
| //should return null if no prediction can be made (like if it's not in the neighborMap) | ||
| String predictedWord = null; |
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.