Skip to content

Project: ramblebot#6

Open
dangrabo wants to merge 13 commits intogrc-cohort-21:mainfrom
dangrabo:main
Open

Project: ramblebot#6
dangrabo wants to merge 13 commits intogrc-cohort-21:mainfrom
dangrabo:main

Conversation

@dangrabo
Copy link

Daniel Grabowski

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.

Awesome job!

Comment on lines 6 to 10
Ramblebot is a unigram word predictor written in Java that can be trained on any given set of text.
Using the Markov chain model, the bot can autoregressively predict words to
produce generated content in the style of the training text.

### Academic Honesty
Link to demo: https://youtu.be/sY_KwScRxa0

Choose a reason for hiding this comment

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

Super cool! Nice job cleaning this up so it can be presented to others. Very cool adding the video too!

Comment on lines +1 to +2
on the lightning strikes lead you asked me and kiss me bleed? were kids and i know this life is breakin' i miss the only one way to know, now
i get this far i know in my mind 'cause i'm leaving i'm letting go now we bury the world is breakin' i just in my mind or tell me i close my mind

Choose a reason for hiding this comment

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

Deep


while (scanner.hasNext()) {
String token = scanner.next();
char tokenLastChar = token.charAt(token.length() - 1);

Choose a reason for hiding this comment

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

This works well! As an alternative you can use endsWith

Comment on lines +19 to +26
@Test
void testTokenizeWithManySpaces() {
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);
}

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 +57 to +61
if (!neighborMap.containsKey(trainingWords.get(trainingWords.size() - 1))) {
List<String> newList = new ArrayList<>();
newList.add(trainingWords.get(0));
neighborMap.put(trainingWords.get(trainingWords.size() - 1), newList);
}

Choose a reason for hiding this comment

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

Very very smart! I've been meaning to change the assignment a bit so this is handled elsewhere, but great job handling it here!

Comment on lines +77 to +81
String currentWord = context.get(context.size() - 1);
List<String> possibleNextWords = new ArrayList<>(neighborMap.get(currentWord));
Random random = new Random();

return possibleNextWords.get(random.nextInt(possibleNextWords.size()));

Choose a reason for hiding this comment

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

Great logic!

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