Skip to content

Ramblebot Completion - 6 waves#13

Open
xavierb117 wants to merge 12 commits intogrc-cohort-21:mainfrom
xavierb117:main
Open

Ramblebot Completion - 6 waves#13
xavierb117 wants to merge 12 commits intogrc-cohort-21:mainfrom
xavierb117:main

Conversation

@xavierb117
Copy link

No description provided.

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.

Nice job!

@@ -0,0 +1 @@
true! -- how stealthily, stealthily --until, at the sound well . for his room . i not told you will think so that distracted me . ha! --would a tub had been deputed to feel --although he slept . i kept pushing it . the low stifled sound as a sound . he had caught all the chair upon the floor," or "it is the bed . they chatted pleasantly, and now you mistake for madness is the bed and smiled gaily, to open the legs . they not within my perfect suavity, as the old man's sleep . but 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.

Spooky!

Comment on lines +39 to +43
if (token.charAt(token.length() - 1) == '.') {
String period = token.charAt(token.length() - 1) + "";
tokenizedList.add(token.substring(0, token.length() - 1));
tokenizedList.add(period);
}

Choose a reason for hiding this comment

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

This works well! You can also use endsWith for the check

Comment on lines +19 to +26
@Test
void testTokenizeWithManySpaces() {
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 +56 to +65
for (int i = 0; i < trainingWords.size() - 1; i++) {
if (!neighborMap.containsKey(trainingWords.get(i))) {
List<String> newList = new ArrayList<>();
newList.add(trainingWords.get(i+1));
neighborMap.put(trainingWords.get(i), newList);
}
else {
List<String> value = neighborMap.get(trainingWords.get(i));
value.add(trainingWords.get(i+1));
neighborMap.put(trainingWords.get(i), value);

Choose a reason for hiding this comment

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

Great logic! Can you consider how you might refactor your if/else so there's a bit less repeated code?

Comment on lines +117 to +121
String word = "";
List<String> choices = neighborMap.get(context.get(context.size() - 1));
Random random = new Random();
int randomNum = random.nextInt(choices.size());
word = choices.get(randomNum);

Choose a reason for hiding this comment

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

Nice!

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