Skip to content

Commit 35f8bf1

Browse files
more improvements and cleanups
1 parent cc6314e commit 35f8bf1

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

bot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
{"question": "What is the origin of the personality cores in Portal 2, including Wheatley?", "answer": "limit glados' intelligence"},
4242
]
4343

44-
def generate_convo_text(start_line: str = "Hello")->str:
44+
def generate_convo_text(start_line: str = None)->str:
4545
# Randomly select a greeting
4646
greetings = ["Hi", "Hey", "Hello", "Hallo", "Good morning", "Good afternoon", "Good evening", "Good day",
4747
"Good night"]
@@ -54,7 +54,8 @@ def generate_convo_text(start_line: str = "Hello")->str:
5454

5555
selected_greeting = random.choice(greetings)
5656

57-
line = start_line
57+
if start_line is None:
58+
start_line = "Hello".split()
5859

5960
# Get raw text as string.
6061
with open("corpus.txt") as file:
@@ -68,8 +69,7 @@ def generate_convo_text(start_line: str = "Hello")->str:
6869

6970
# Generate a random number between 5 and 10
7071
random_number = random.randint(5, 10)
71-
startwords = line.split()
72-
random_word = random.choice(startwords)
72+
random_word = random.choice(start_line)
7373
pattern = r'\b' + re.escape(random_word) + r'\b'
7474
if re.search(pattern, text):
7575
text_lines = text_model.make_sentence_with_start(beginning=random_word, strict=False)

corpus.txt

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,13 @@ Personnel File Addendum Addendum:
380380
One last thing:
381381
Go ahead and leave me.
382382
I think I prefer to stay inside.
383-
Maybe you'll find someone else
384-
to help you.
383+
Maybe you'll find someone else to help you.
385384
Maybe Black Mesa...
386385
THAT WAS A JOKE. HA HA. FAT CHANCE.
387386
Anyway, this cake is great.
388387
It's so delicious and moist.
389-
Look at me still talking
390-
when there's Science to do.
391-
When I look out there,
392-
it makes me GLaD I'm not you.
388+
Look at me still talking when there's Science to do.
389+
When I look out there, it makes me GLaD I'm not you.
393390
I've experiments to run.
394391
There is research to be done.
395392
On the people who are still alive.
@@ -634,7 +631,8 @@ Did anything happen while I was out?
634631
Hold on, who-?
635632
Yes, sir, Mister Johnson...
636633
Why did I just-Who is that? What the HELL is going on he----?
637-
Okay. I guess emotional outbursts require more than one point six volts. Now we know that. We just need to relax. We're still going to find out what the hell's going on here. But calmly.
634+
Okay. I guess emotional outbursts require more than one point six volts. Now we know that. We just need to relax.
635+
We're still going to find out what the hell's going on here. But calmly.
638636
Those people, in the portrait. They look so familiar...
639637
Second Propulsion Gel Test Chamber.
640638
I swear I know him...
@@ -960,7 +958,7 @@ Don't worry, they are of no use to anyone, totally boring and useless.
960958
This is just a thought experiment, just to see how much time you'll waste thinking about these worthless documents. The correct time is zero seconds.
961959
Very good! You found those useless blueprints.
962960
While I do need you to be in the room so I can see them, I want to be clear. There is no reason whatsoever for you to look at them.
963-
Done. I guess. I suppose. I wasn't paying attention. *The last part is cut off by the level transition.*
961+
Done. I guess. I suppose. I wasn't paying attention. *The last part is cut off.*
964962
This course was created and then abandoned by humans. They tend to do that, create something wonderful and then abandon it.
965963
Do you know why they abandoned this course? Too deadly. Have you worked out the one good trait humans have, yet?
966964
Let me give you a clue, it is the one thing you can't do.
@@ -1084,7 +1082,8 @@ Congratulations on passing that test.
10841082
I wonder if the humans will make a statue of me for rescuing them? Oh, don't worry, if they ever write a historical document of my heroic rescue, I will make sure your names are included in the footnotes.Test chamber 5:While I will receive all the glory for the rescue don't think you two aren't going to get something. The bond you form during these tests will last a lifetime.
10851083
At the rate you are completing these tests, I am beginning to think you don't share my excitement for rescuing crying trapped injured dying humans.
10861084
If that doesn't motivate you, I'm not sure what will.
1087-
Maybe you two have never met humans? They are as bad as you might think, smelly, gross, annoying, often wanting to try and kill you. But they do make great test subjects.
1085+
Maybe you two have never met humans? They are as bad as you might think, smelly, gross, annoying, often wanting to try and kill you.
1086+
But they do make great test subjects.
10881087
We are only two tests away from reaching the humans, are you as excited as I am?
10891088
Only one more test after this.
10901089
I know your cores are reused from calculation machines, built for simple mathematical operations and not for testing, but if we can rescue the humans I promise you something to add maybe even subtract.
@@ -1126,7 +1125,8 @@ five
11261125
eightBlue is penalized
11271126
Orange is penalized science collaboration points.
11281127
Blue receives
1129-
Orange receivesCo-op Credits test subject analysisLet's look at their files...
1128+
Orange receivesCo-op Credits test subject analysis.
1129+
Let's look at their files...
11301130
NOT a team player.
11311131
Horrible people skills.
11321132
Never listens.
@@ -1633,7 +1633,6 @@ I'm going to be honest with you now. Not fake honest like before, but real hones
16331633
And as soon as I can PROVE it, the laws of robotics allow me to terminate you for being a liar.
16341634
This next test... *boom!*..is... *BOOM!*dangerous. I'll be right back.
16351635
Did you know I discovered a way to eradicate poverty? But then you KILLED me. So that's gone.
1636-
Unused Co-op human storyline
16371636
Hello again. Sorry about exploding you. Luckily, you don't feel pain. At any rate, you don't have a way to communicate that you feel pain.
16381637
So I've been thinking: We need humans for these tests. And since the only human within a thousand miles of us is a test-ruining sociopath... I'll just have to MAKE some.
16391638
I know how humans make more humans, and frankly, it's ridiculous. It also assumes that you already have a human, which I hope somebody got fired over. So I came up a with BETTER way.
@@ -1646,7 +1645,6 @@ NO.
16461645
Okay. Plan B, subsection one: Stand still so I can bring you back.
16471646
Humans must have some purpose other than a place to store your neurotoxin. Something I failed to notice before, an intangible quality that makes their test results... significant.
16481647
Okay. Plan B. We need humans.
1649-
Unused Co-op artifact storyline
16501648
Good. You made it to one of the human habitats. We're looking for an artifact. Think of it as an archeological dig.
16511649
Their laughter centered around one of the objects in this room.
16521650
That's it. Scan it for me.
@@ -1664,7 +1662,6 @@ Reactions?
16641662
Yes, it's funny because most of it actually happened.
16651663
Do you feel more human?
16661664
Well, let's do some tests and see what happens.
1667-
Unused Co-op tic-tac-toe game
16681665
We are now going to take a break from the collaboration for an instructional competition.
16691666
You should both be familiar with the game of Tic-Tac-Toe.
16701667
This is Tic-Tac-Toe-Two.
@@ -1971,16 +1968,20 @@ Your poorly chosen, hopelessly outmatched team.
19711968
Some... interesting choices there.
19721969
Hmm. Well, good luck.
19731970
Wait until your loved ones hear about this. This should make them proud. Or bored. One of those.
1974-
Well, really there should be an entirely new word for whatever it was you just stumbled and pinwheeled your arms through. But, I guess for now, let's call it winning.
1975-
All your little goblins destroyed a magic... whatever it was... in the middle of a forest. That's quite a skill you have. If I were you, Id wait by the mailbox for my big cheque.
1976-
I was going to say it's not that big a deal, but then I looked at your file and saw the list of your other accomplishments. The space on the form where they should have been, I mean.
1971+
Well, really there should be an entirely new word for whatever it was you just stumbled and pinwheeled your arms through.
1972+
But, I guess for now, let's call it winning.
1973+
All your little goblins destroyed a magic... whatever it was... in the middle of a forest. That's quite a skill you have.
1974+
If I were you, Id wait by the mailbox for my big cheque.
1975+
I was going to say it's not that big a deal, but then I looked at your file and saw the list of your other accomplishments.
1976+
The space on the form where they should have been, I mean.
19771977
Congratulations. You solved Dota. You are the best hero. Turn off your computer now.
19781978
The game already started, by the way. I wasn't sure if you were waiting for a whistle. There isn't one.
19791979
Don't wear out the edge of your seat.
19801980
Gripping, isn't it?
19811981
You paid for the whole seat, so get comfortable, because it looks like we may be here a long time.
19821982
I know, I can't wait either.
1983-
Here's a Dota play-by-play: That fat, bat winged thing just flew left. A goblin punched a... ghost I think. Good for him. Good for everyone. Anyway, Dota.
1983+
Here's a Dota play-by-play: That fat, bat winged thing just flew left. A goblin punched a... ghost I think. Good for him.
1984+
Good for everyone. Anyway, Dota.
19841985
So... what's happening here then? Oh, the game's still on! Gripping, isn't it?
19851986
I spy with my robot eye something that makes no sense. Did you guess everything that's going on here? Because this is all nonsense
19861987

0 commit comments

Comments
 (0)