Skip to content

Project: ramblebot#5

Open
AAshGray wants to merge 17 commits intogrc-cohort-21:mainfrom
AAshGray:main
Open

Project: ramblebot#5
AAshGray wants to merge 17 commits intogrc-cohort-21:mainfrom
AAshGray:main

Conversation

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

Great job!

$ cd c:\\Users\\Blaze\\SDEV301\\projects\\ramblebot ; /usr/bin/env C:\\Program\ Files\\Java\\jdk-23\\bin\\java.exe @C:\\Users\\Blaze\\AppData\\Local\\Temp\\cp_18ci5o9mcfusdn4uv3b7jw736.argfile RambleApp
Enter the filename: poeTraining.txt
Enter the number of words to generate: 100
by a shore; seas that drip all over; mountains toppling evermore into seas that walks in agony, to the traveller meets, aghast, sheeted memories of the fring'd lid; and dead,? their sad and sigh as they pass the sad and pools where dwell the dismal tarns and dead,? their lone waters, lone and titan woods, with the earth?and heaven . bottomless vales and caves, and pools where dwell the mountains?near the newt encamp,? by the wanderer by? white-robed forms of the past? shrouded forms that thus the snows of the earth?and heaven . for the heart whose woes are legion 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.

Deep

Comment on lines +45 to +46
// if the word ends with a period
if (word.endsWith(".")) {

Choose a reason for hiding this comment

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

Smart use of endsWith

Comment on lines +22 to +29
@Test
void testTokenizeSentenceWithMultipleSpaces() {
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 +60
// make sure neighbormap is properly initialized
// it took a little bit to realize you hadn't done this
if (neighborMap == null) {
neighborMap = new HashMap<>();
}

Choose a reason for hiding this comment

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

Nice catch! Yes, this can either happen here or in the constructor.

Comment on lines +70 to +76
if (!neighborMap.containsKey(currentWord)) {

// if it isn't build a new list
List<String> list = new ArrayList<>();

// add it to the map with currentWord as the key
neighborMap.put(currentWord, list);

Choose a reason for hiding this comment

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

Great logic!

Comment on lines +143 to +144
//should return null if no prediction can be made (like if it's not in the neighborMap)
String predictedWord = null;

Choose a reason for hiding this comment

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

Smart null handling

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