Open
Conversation
…. Also added data to ramble on
auberonedu
reviewed
Feb 18, 2025
| @@ -0,0 +1 @@ | |||
| dude i got some fucking banana bread at work today dude? hell yeah. my mom told me if i wait for things, like, good things will happen to me dude and fucking i waited for some things and i got some banana bread at work today dude? hell yeah. so it just goes to show that waiting for things is, like, worth it. but there’s a lot of bad things in this world, dude. like fucking skunks dude? hell no. Scratching you’re eye, but it’s STILL fucking ITCHY dude?! HELL no. The fucking CUBS, DUDE? HELL NO!! LIKE GETTING PAID NOT A LOT OF MONEY, DUDE?! FOR FUCKING WORKING?! HELL NO!!!! BUT BANANA BREAD?! AT FUCKING WORK, DUDE?! HELL YEAH!!!!!! HELL YEAH, BRO!!!! HELL YEAH!! BANANA BREAD, BRO, AT FUCKING WORK, DUDE!!!! HELL YEAH!! No newline at end of file | |||
Comment on lines
+41
to
+45
| String moveCharacters = Lowered.replaceAll("(?<!\\w)\\.(?!\\w)", " . ") //this replacement checks for a word infront and behind the period if found, and singles out the period | ||
| .replaceAll("(\\w)\\.(\\w)", "$1.$2") //this replacement checks for a period surrounded by words, the \\w checks what is arround and inits its findings to the first and second capturing group | ||
| .replaceAll("\\.(?!\\w)", " . ")//this replacement checks for a period followed by no word string | ||
| .replace(",", " , ") | ||
| .replace("'", "'"); |
There was a problem hiding this comment.
Wow! That's a serious regex! Very impressive! As an alternative, can you think of how you might do this in a slightly simpler way without regular expressions?
Comment on lines
+24
to
+32
| @Test | ||
| void testTokenizeWithNoCapitalizationOrPeriodWithLotsOfSpaces() | ||
| { | ||
| 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
+54
to
+65
| List<String> trainingWords = tokenizer.tokenize(scanner); // List of tokenized string values. | ||
|
|
||
| for(int i = 0; i < trainingWords.size() - 1; i++) // Loop through the tokenized list. | ||
| { | ||
| String currentWord = trainingWords.get(i); // get the first index of the list. | ||
| String nextWord = trainingWords.get(i + 1); // get the one after the first or where ever i equals. | ||
|
|
||
| List<String> listOfStrings = neighborMap.getOrDefault(currentWord, new ArrayList<>()); // Get or default checks if (currentWord) is in the map as a key, and if its not it adds it and returns a list, | ||
| listOfStrings.add(nextWord); // here we add to the list and if (nextWord) isnt the same as (currentWord) it adds it within that list as a value to the key. | ||
| neighborMap.put(currentWord, listOfStrings); // populate hashmap and add values. | ||
|
|
||
| } |
Comment on lines
+116
to
+121
| Random random = new Random(); //init new random | ||
| String word = context.get(context.size() - 1);// Obtain the size of selected key containing the list. | ||
| List<String> neighbor = neighborMap.getOrDefault(word, context);// get the values of the key and store in a list // if one or (null) then default to that value. | ||
| int randomInt = random.nextInt(neighbor.size()); //get the size of the values of the key. | ||
| // Hint: only the last word in context should be looked at | ||
| return null; | ||
| return neighbor.get(randomInt); //Return the list with a random index |
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.
My Training Data is a meme from a while ago, If you look up on youtube "banana bread for work today" its a guy who is passive agressively talking about how hes upset he got banana bread for work instead of possibly a bonus or whatever.
I think its funny, but if you want me to add something else I totally can!
Thanks!