Open
Conversation
auberonedu
reviewed
Feb 18, 2025
| @@ -0,0 +1 @@ | |||
| the raven, "nevermore." "be that is there--_is_ there stepped a sainted maiden whom the raven, "nevermore." much i cried, "thy god hath sent thee respite--respite and take thy soul into the beating of evil!--prophet still, if bird or lady, perched upon the countenance it is, and store, caught from out that is some visiter entreating entrance at my chamber door." "here i had sought to borrow from my soul with fantastic terrors never flitting, still a flirt and sat, and so gently you came tapping, tapping at my hopes have flown before-- on the angels name lenore." "sorrow for we No newline at end of file | |||
| } | ||
|
|
||
| public boolean seperatePeriods(String wordsLastCheck){ | ||
| char checkLastChara = wordsLastCheck.charAt(wordsLastCheck.length()-1); |
There was a problem hiding this comment.
Nice! You can also do this with endsWith
Comment on lines
33
to
+39
| public List<String> tokenize(Scanner scanner) { | ||
| // TODO: Implement this function to convert the scanner's input to a list of words and periods | ||
| return null; | ||
| List<String> intialStep = breakLineDetect(scanner); | ||
| // System.out.println(intialStep.size()); | ||
| // System.out.println(intialStep); | ||
|
|
||
| return intialStep; |
There was a problem hiding this comment.
Cool doing this decomposed across helper methods
Comment on lines
+19
to
+26
| @Test | ||
| void testTokenizeWithNoSpace() { | ||
| 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
+69
to
74
| for (int i = 0; i < trainingWords.size()-1; i++){ | ||
| if(neighborMap.containsKey(trainingWords.get(i))){ | ||
| neighborMap.get(trainingWords.get(i)).add(trainingWords.get(i+1)); | ||
| } | ||
| } | ||
|
|
Comment on lines
+123
to
+132
| Random random = new Random(); | ||
| String lastWord = context.get(context.size() - 1); | ||
| List<String> neighbors = neighborMap.get(lastWord); | ||
|
|
||
| int lowerLimit = 0; | ||
| int upperLimit = neighbors.size() - 1; | ||
|
|
||
| int randomNumber = random.nextInt(upperLimit - lowerLimit + 1) + lowerLimit; | ||
|
|
||
| return neighbors.get(randomNumber); |
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.