Skip to content

Finished RambleBot#12

Open
timmyd4 wants to merge 16 commits intogrc-cohort-21:mainfrom
timmyd4:main
Open

Finished RambleBot#12
timmyd4 wants to merge 16 commits intogrc-cohort-21:mainfrom
timmyd4:main

Conversation

@timmyd4
Copy link

@timmyd4 timmyd4 commented Jan 29, 2025

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!

Copy link

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

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("'", "'");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test!

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.

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice logic!

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice loigc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants