Open
Conversation
added 9 commits
January 21, 2025 11:44
auberonedu
reviewed
Feb 18, 2025
Comment on lines
+1
to
+4
| attorney: what school did you present when a fight . attorney: what was your responses must be oral, ok? what school did you performed on dead people? witness: july 18th . attorney: doctor, how i dress when a fight . attorney: how old is your autopsies have you present when i just lie there . attorney: and what gear were you sexually active? witness: july 18th . attorney: and reeboks . attorney: what ways does it affect your iq . attorney: and what gear were you performed on dead people? witness: he's 20, much like your picture was it terminated? | ||
| //not sure why there is a little space before the period :C | ||
|
|
||
| //Output spread out for reading convenience: |
There was a problem hiding this comment.
The spaces with the periods are RambleApp's fault, not your code. I might improve it in future versions
Comment on lines
+40
to
+44
|
|
||
| if (length > 0 && rambleWord.charAt(length-1) == '.' && length > 1){ | ||
| tokens.add(rambleWord.substring(0,length-1)); //adds word, removes end period | ||
| tokens.add("."); //readds period as a different token | ||
| } |
There was a problem hiding this comment.
Nice logic! You can also use endsWith here
Comment on lines
+19
to
+28
| @Test | ||
| void testTokenizeSentenceWithSpaces(){ | ||
|
|
||
| LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer(); | ||
| Scanner scanner = new Scanner("this is a lowercase sentence with many spaces"); | ||
| List<String> tokens = tokenizer.tokenize(scanner); | ||
|
|
||
| assertEquals(List.of("this", "is", "a", "lowercase", "sentence", "with", "many", "spaces"), tokens); | ||
|
|
||
| } |
Comment on lines
+56
to
+66
| neighborMap = new HashMap<>(); //makes a map for all the strings and lists | ||
| for(int i = 0; i < trainingWords.size() - 1; i++){ | ||
| String currentWord = trainingWords.get(i); | ||
| String nextWord = trainingWords.get(i +1); | ||
|
|
||
| if (!neighborMap.containsKey(currentWord)){ | ||
| neighborMap.put(currentWord, new ArrayList<>()); | ||
| }//end if | ||
| neighborMap.get(currentWord).add(nextWord); | ||
| }//end for | ||
| }//end scanner |
Comment on lines
+122
to
+126
| Random rand = new Random(); //didn't copy and paste anything, but I read up on how to use Random with this site: https://www.geeksforgeeks.org/generating-random-numbers-in-java/ | ||
| int randomRamble = rand.nextInt(nextWord.size()); | ||
|
|
||
| return nextWord.get(randomRamble); | ||
|
|
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.