Skip to content

Finished rambleBot#17

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

Finished rambleBot#17
Bolshialex wants to merge 13 commits intogrc-cohort-21:mainfrom
Bolshialex:main

Conversation

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

Comment on lines +1 to +3
slow down forever and float above the comedown catches me down for good go for broke,
as country folk never crack my crescendo vanta blackout with my crescendo vanta blackout
with my baby dont care youll never crack my soul sister through the electro madness buckle bunny

Choose a reason for hiding this comment

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

Really makes you think

Comment on lines +34 to +49
List<String> contentList = new ArrayList<>();
List<String> result = new ArrayList<>();

while (scanner.hasNextLine()) {
result.add(scanner.next().toLowerCase());
}

for (String str : result) {
if(str.charAt(str.length()-1) != '.'){
contentList.add(str);
}else{
String temp = str.replace('.', ' ');
contentList.add(temp.replace(" ", ""));
contentList.add(".");
}
}

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 +19 to +25
@Test
void testTokenWithManySpaces(){
LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer();
Scanner scanner = new Scanner("hello hi hi hi hello hello");
List<String> token = tokenizer.tokenize(scanner);
assertEquals(List.of("hello", "hi", "hi", "hi", "hello", "hello"), token);
}

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 +58 to +64
for(int i = 1; i < trainingWords.size(); i++){
neighborMap.get(trainingWords.get(i-1)).add(trainingWords.get(i));

if(!neighborMap.containsKey(trainingWords.get(i))){
neighborMap.put(trainingWords.get(i), new ArrayList<String>());
}
}

Choose a reason for hiding this comment

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

Smart initializing the list in the previous pass

Comment on lines +116 to +118
String lastWord = context.get(context.size()-1);
int randomStringIndex = rand.nextInt(neighborMap.get(lastWord).size());
return neighborMap.get(lastWord).get(randomStringIndex);

Choose a reason for hiding this comment

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

Nice variable names

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