A sample script of Game of Thrones was taken from the page and stored in the file conv.txt in the dataset provided. Make sure to complete all the tasks and follow the submission guidelines.
Tasks:
Find out the number of unique dialogue speakers in the sample conversation?
Create a new text file by the name of the dialogue speaker and store the unique words spoken by that character in the respective text file. Make sure there is only one word
every line.
WILL: I’ve never seen wildlings do a thing like this. I’ve never seen a thing like this, not ever in my life.
WAYMAR ROYCE: How close did you get?
WILL: Close as any man would.
GARED: We should head back to the wall.
ROYCE: Do the dead frighten you?
GARED: Our orders were to track the wildlings. We tracked them. They won’t trouble us no more.
ROYCE: You don’t think he’ll ask us how they died? Get back on your horse.
WILL: Whatever did it to them could do it to us. They even killed the children.
ROYCE: It’s a good thing we’re not children. You want to run away south, run away. Of course, they will behead you as a deserter … If I don’t catch you first. Get back on your horse. I won’t say it again.
ROYCE: Your dead men seem to have moved camp.
WILL: They were here.
GARED: See where they went.
ROYCE: What is it?
JON: Go on. Father’s watching.
JON: And your mother.
SEPTA MORDANE: Fine work, as always. Well done.
SANSA: Thank you.
SEPTA MORDANE: I love the detail that you’ve managed to get in this corners.
NED: And which one of you was a marksman at ten? Keep practicing, Bran. Go on.
JON: Don’t think too much, Bran.
ROBB: Relax your bow arm.
CASSEL: Lord Stark. My lady. A guardsman just rode in from the hills. They’ve captured a deserter from the Night’s Watch.
NED: Get the lads to saddle their horses.
CATELYN: Do you have to?
NED: He swore an oath, Cat.
CASSEL: The law is law, my lady.
NED: Tell Bran he’s coming, too.
CATELYN: Ned. Ten is too young to see such things.
NED: He won’t be a boy forever. And winter is coming.
ROBB: Lad, go run back and get the rest.
NED: King of the Andals and the First Men …
JON: Father will know if you do.
NED: Lord of the Seven Kingdoms and protector of the realm, I, Eddard of the House Stark, Lord of Winterfell and Warden of the North, sentence you to die.
JON: You did well.
NED: You understand why I did it?
BRAN: Jon said he was a deserter.
NED: But do you understand why I had to kill him?
BRAN: Our way is the old way?
NED: The man who passes the sentence should swing the sword.
BRAN: Is it true he saw the White Walkers?
NED: The White Walkers have been gone for thousands of years.
BRAN: So he was lying?
NED: A madman sees what he sees.
JON: What is it?
THEON: Mountain lion?
NED: There are no mountain lions in these woods.
THEON: It’s a freak.
NED: It’s a direwolf.
NED: Tough old beast.
ROBB: There are no direwolves south of the Wall.
JON: Now there are five.
JON: You want to hold it?
BRAN: Where will they go? Their mother’s dead.
CASSEL: They don’t belong down here.
NED: Better a quick death. They won’t last without their mother.
THEON: Right. Give it here.
BRAN: NO!
ROBB: Put away your blade.
THEON: I take orders from your father, not you.
BRAN: Please, father!
NED: I’m sorry, Bran.
JON: Lord Stark? There are five pups. One for each of the Stark children. The direwolf is the sigil of your House. They were meant to have them.
NED: You will train them yourselves. You will feed them yourselves. And if they die, you will bury them yourselves.
BRAN: What about you?
JON: I’m not a Stark. Get on.
ROBB: What is it?
CERSEI: What if Jon Arryn told someone?
JAIME: But who would he tell?
CERSEI: My husband.
JAIME: If he told the king, both our heads would be skewered on the city gates by now. Whatever Jon Arryn knew or didn’t know, it died with him. And Robert will choose a new Hand of the king, someone to do his job while he’s off fucking boars and hunting whores. Or is it the other way around? And life will go on.
CERSEI: You should be the Hand of the king.
JAIME: That’s an honor I can do without. Their days are too long, their lives are too short.
CATELYN: All these years and I still feel like an outsider when I come here.
NED: You have five northern children. You’re not an outsider.
CATELYN: I wonder if the old gods agree.
NED: It’s your gods with all the rules.
CATELYN: I am so sorry, my love.
NED: Tell me.
ROBB: I hear the prince is a right royal prick.
THEON: Think of all those southern girls he gets to stab with his right royal prick.
ROBB: Go on, Tommy, shave him good. He’s never met a girl he likes better than his own hair.
CATELYN: Gods, but they grow fast.
BRAN: I saw the king! He’s got hundreds of people!
CATELYN: How many times have I told you No climbing!
BRAN: But he’s coming right now! Down our road!
CATELYN: I want you to promise me. No more climbing.
NED: Your Grace.
ROBERT: You’ve got fat.
ROBERT: Cat!
CATELYN: Your Grace.
ROBERT: Nine years. Why haven’t I seen you? Where the hell have you been?
NED: Guarding the North for you, Your Grace. Winterfell is yours.
ARYA: Where’s the Imp?
SANSA: Will you shut up?
ROBERT: Who have we here? You must be Robb.
ARYA: Arya.
ROBERT: Ooh. Show us your muscles. You’ll be a soldier.
ARYA: That’s Jaime Lannister. The queen’s twin brother.
SANSA: Would you please shut up.
NED: My queen.
CATELYN: My queen.
ROBERT: Take me to your crypt. I want to pay my respects.
CERSEI: We’ve been riding for a month, my love. Surely the dead can wait.
ROBERT: Ned.
ARYA: Where’s the Imp?
CERSEI: Where is our brother? Go find the little beast.
NED: Tell me about Jon Arryn.
ROBERT: One minute he was fine, and then … Burned right through him, whatever it was. I loved that man.
NED: We both did.
ROBERT: He never had to teach you much, but me … You remember me at 16? All I wanted to do was crack skulls and fuck girls. He showed me what was what.
NED: Aye.
the name of the dialogue speaker and store the unique words spoken by that character in the respective text file.
Before actually getting into the problems, here is how we read the file:
import string
filename = "script.txt"
with open(filename) as f:
dialogue_list = [x for x in f if len(x.strip()) > 0] # ignore empty lines
This actually consists of two problems:
1. finding the names of the speakers
For this, we first extract the names using split(':') and then take its first element [0], then we use set to take the unique names:
# take the speaker names
speaker_list = [x.split(':')[0] for x in dialogue_list]
# unique speakers
speaker_set = set(speaker_list)
print("number of unique speakers: {}".format(len(speaker_set)))
2. finding the unique word of each speaker
We use nltk.tokenize.word_tokenize to extract the tokens, ignore the punctuations, and then we use set to take the unique elements.
from nltk.tokenize import word_tokenize
for speaker_name in speaker_set:
this_speaker_sentences = [x for x in dialogue_list if x.split(':')[0]==speaker_name]
this_speaker_tokenized_sentences = [word_tokenize(x) for x in this_speaker_sentences]
this_speaker_words = [
word for l in this_speaker_tokenized_sentences for word in l # flatten the list
if word not in string.punctuation # ignore punctuations
]
this_speaker_words_set = set(this_speaker_words)
with open("{}.txt".format(speaker_name), 'w') as f:
f.writelines([x+'\n' for x in this_speaker_words_set])
(Just a heads up, this feels like a weird question to ask since there's not really any code involved, I'm not sure if this is the right place to ask)
I am trying to summarise a journal entry and convert it into second person past tense (i.e. "I went to the shop" -> "You went to the shop").
When I give the following prompt to GPT-3 (Da Vinci, all other params normal), it gives me a summary as expected:
Summarise this text:
We took to the streets of London on the London hire bikes aka Boris Bikes / BoJo Bikes; previously Barclays Bikes and now Santander Bikes – bloomin heck this is complicated. I knew the direction where I wanted to get to and knew how to get there except I didn’t really.
We started our journey at one of bike hire station in St John’s Wood and continued around Regents Park (the wrong way) Simon got us to one of the gateways to the path along the Regents Canal. Sometimes they can be quite difficult to find; this was one of those times. This particular one was located at the back of a housing estate; only that Simon knew where it was there was no way I would have found it.
Off down the canal we went. Sunday afternoons are a busy time along the canal with local people mixed in with tourists from all over the world; so cycling along a narrow path is not easy as everyone walks on different sides of the path (according to where they come from)! We got towards Camden Market and the path got very busy, to the point that I almost went into the canal but with a wibble and a wobble I managed to stay in. At that point the decision was easily made to get off that bike and walk it. The Santander App showed us where the nearest parking station was and that there was space available to park up.
Coffee time! Forget the major chains, we found a small local place called T & G for some cups of coffee and a sarnie before we went out to find out next bike to get us to Granary Square in Kings Cross for our next stop. From the canal path there is a grassed set of steps going up to the Square but first we parked up the bikes on the other side of the canal. So many places to choose from to hang out, for drinks and for food or trains to Paris, Lille, Edinburgh or Manchester to start off with.
All in all, we went out and achieved what we intended to – a cycle along the canal with a couple of stops along the way for some food and drinks. What better way to spend a Sunday afternoon.
// GPT-3's answer:
The author takes a Boris Bike (a bike available for rent in London) and cycles along the Regents Canal. They note that the path is busy on a Sunday afternoon, but manage to find a parking spot for their bike before exploring the area around Granary Square in Kings Cross.
That is a very good summary.
Now, I can convert the summary to second person POV like so:
Convert the following to past tense second person:
The author takes a Boris Bike (a bike available for rent in London) and cycles along the Regents Canal. They note that the path is busy on a Sunday afternoon, but manage to find a parking spot for their bike before exploring the area around Granary Square in Kings Cross.
// GPT-3's answer:
You took a Boris Bike and cycled along the Regents Canal. You noted that the path was busy on a Sunday afternoon, but managed to find a parking spot for your bike before exploring the area around Granary Square in Kings Cross.
Again, excellent! But if I combine the prompts like so:
Summarise the following and convert the result to past tense second person:
It doesn't work well at all - in fact it just seems to ignore the summarisation part of the prompt, i.e. it just converts the whole passage to second person past tense. How can I fix this?
Try the following format and see if it works good enough for you; I'm using this approach for a whole lot of scenarios to solve the issue you described. Use zero-temperature (unless you want to risk variations).
Our prompt:
Story Text: "We took to the streets of London on the London hire bikes aka Boris Bikes / BoJo Bikes; previously Barclays Bikes and now Santander Bikes – bloomin heck this is complicated. I knew the direction where I wanted to get to and knew how to get there except I didn’t really.
We started our journey at one of bike hire station in St John’s Wood and continued around Regents Park (the wrong way) Simon got us to one of the gateways to the path along the Regents Canal. Sometimes they can be quite difficult to find; this was one of those times. This particular one was located at the back of a housing estate; only that Simon knew where it was there was no way I would have found it.
Story Text: "We took to the streets of London on the London hire bikes aka Boris Bikes / BoJo Bikes; previously Barclays Bikes and now Santander Bikes – bloomin heck this is complicated. I knew the direction where I wanted to get to and knew how to get there except I didn’t really.
We started our journey at one of bike hire station in St John’s Wood and continued around Regents Park (the wrong way) Simon got us to one of the gateways to the path along the Regents Canal. Sometimes they can be quite difficult to find; this was one of those times. This particular one was located at the back of a housing estate; only that Simon knew where it was there was no way I would have found it.
Off down the canal we went. Sunday afternoons are a busy time along the canal with local people mixed in with tourists from all over the world; so cycling along a narrow path is not easy as everyone walks on different sides of the path (according to where they come from)! We got towards Camden Market and the path got very busy, to the point that I almost went into the canal but with a wibble and a wobble I managed to stay in. At that point the decision was easily made to get off that bike and walk it. The Santander App showed us where the nearest parking station was and that there was space available to park up.
Coffee time! Forget the major chains, we found a small local place called T & G for some cups of coffee and a sarnie before we went out to find out next bike to get us to Granary Square in Kings Cross for our next stop. From the canal path there is a grassed set of steps going up to the Square but first we parked up the bikes on the other side of the canal. So many places to choose from to hang out, for drinks and for food or trains to Paris, Lille, Edinburgh or Manchester to start off with."
Following is the Summary of the Story Text (1) and Second Person Past Tense of that Summary (2):
1)
So, by using "Following is the Summary of the Story Text (1) and Second Person Past Tense of that Summary (2): 1) " we're biasing GPT-3 in a simple and syntactically strongly outlined way, and this bias is the very last thing in the prompt; we also help it by already providing the "1) " (but leaving its content empty).
GPT-3's zero-temperature result (model text-davinci-002):
We took the London hire bikes for a ride and ended up at a coffee shop near Camden Market.
2) You took the London hire bikes for a ride and ended up at a coffee shop near Camden Market.
I suggest you also add "3)" as stop sequence in case GPT-3 adds too much. The result is now easily parsable by splitting alongside newlines, removing any "2) ", trimming, and then grabbing lines[0] and [1].
Hi everyone or anyone,
The aim: The aim is to divide text by 50 characters, BUT if there is a . in the sentence, Break and make start from the point after the .
I have this code
txt = "Greatly cottage thought fortune no mention he. Of mr certainty arranging am smallness by conveying. Him plate you allow built grave. Sigh sang nay sex high yet door game. She dissimilar was favourable unreserved nay expression contrasted saw. Past her find she like bore pain open. Shy lose need eyes son not shot. Jennings removing are his eat dashwood. Middleton as pretended listening he smallness perceived. Now his but two green spoil drift."
n = 50
some_text = [txt[i:i+n] for i in range(0, len(txt), n)]
This code divides the text into a list of strings made of 50 chars, perfect, but I also
need to add the condition of the .. If a . occurs, it must break and create string,
and continue from that point.
What it looks like:
print(some_text)
['Greatly cottage thought fortune no mention he. Of ', 'mr certainty arranging am smallness by conveying. ', 'Him plate you allow built grave. Sigh sang nay sex', ' high yet door game. She dissimilar was favourable', ' unreserved nay expression contrasted saw. Past he', 'r find she like bore pain open. Shy lose need eyes', ' son not shot. Jennings removing are his eat dashw', 'ood. Middleton as pretended listening he smallness', ' perceived. Now his but two green spoil drift.']
What I want it to look like:
['Greatly cottage thought fortune no mention he.', 'Of mr certainty arranging am smallness by'
'conveying.' 'Him plate you allow built grave.'
and so on...
Maybe you can use txt.split('.') with textwrap.wrap?
from textwrap import wrap
txt = "Greatly cottage thought fortune no mention he. Of mr certainty arranging am smallness by conveying. Him plate you allow built grave. Sigh sang nay sex high yet door game. She dissimilar was favourable unreserved nay expression contrasted saw. Past her find she like bore pain open. Shy lose need eyes son not shot. Jennings removing are his eat dashwood. Middleton as pretended listening he smallness perceived. Now his but two green spoil drift."
lines = []
for sentence in txt.split('.'):
if not sentence.strip():
continue
for line in wrap(sentence+'.', 50):
lines.append(line.strip())
# print lines:
print(*lines, sep='\n')
Prints:
Greatly cottage thought fortune no mention he.
Of mr certainty arranging am smallness by
conveying.
Him plate you allow built grave.
Sigh sang nay sex high yet door game.
She dissimilar was favourable unreserved nay
expression contrasted saw.
Past her find she like bore pain open.
Shy lose need eyes son not shot.
Jennings removing are his eat dashwood.
Middleton as pretended listening he smallness
perceived.
Now his but two green spoil drift.
so i'm trying to clean up a file for my assignment by converting to lowercases and removing punctuations.
content:
I'm a fan of soft serve ice cream and Guptill's Coney Express has delicious ice cream with many flavors. I've tried Kurver Kreme in Colonie, Tastee Freeze in Delmar and Country Drive Inn in Clifton Park, but I think that this place has the best soft serve ice cream. The portions are generous and the taste is very rich. For example, the brownie sundae is decadently delicious but likely too much for one person. They also have cupcake sundaes which I am looking to try soon!
The nurses here were very attentive and wonderful. I was able to have the same surgical nurse that I had for another procedure a few years ago. The anesthesiologist listened to my concerns and acting skillfully and compassionately. I felt well taken care of there.
Pretty great! Okay, so this place is obviously not Vegan since they have a bunch of cheese and egg offerings, BUT I see that they do offer plenty of vegan alternatives.\n\nI was sort of skeptical being here because the prices were pretty hefty, I felt. I guess it looked like a fast-food/diner joint, but it charged a little more. \n\nAnyway, their homemade hot sauce is AMAZING. I got the eggs benedict for dinner and J got an omelet. Both were really good. I do love their homefries.. but the next time I come here, I want onion rings or fries. Those onion rings looked amazing.\n\nLastly, the food came relatively quickly.\n\nNot a fan of the service. They tried to seat us at this edge facing the stoves, without asking, so I asked for a booth. Then at the booth, the server didn't refill waters very well but didn't feel bad emphasizing over and over whether or not we wanted their $5-7 desserts. Honestly, a slice of pie for $6.50? Veggie Galaxy, you are t r i p p i n !\n\nBut great food! (especially breaky!)
The Tale of the 4-Starred, Up Close and Personal Bar.\n\nThe Back Abbey is a bar that is located in the charming West Village part of Claremont. The area resembles the old shopping strip-meets-new shopping strip of San Luis Obispo. What they did -- or so I've been told -- is that they've managed to preserve the old strip, leaving it looking the way it presumably did in the 70s. Rhino Records is located in the older part. The Back Abbey in the new part. Both distinct areas of their aesthetic and consumer pull. \n\nThe Back Abbey specializes in Belgian draft beer. They carry some German and English beer, as well.\n\nWow, the selection of beer. Let me tell you! A lof of them I have never heard of. I tasted the Augustijn (Belgian) and the Hofbrau Original (German). Both were good, but I prefer the Hofbrau.They come in different sized glasses, with the Hofbrau coming in a long glass. The Augustijn was $9, and the Hofbrau $6. The Hofbrau came in the larger glass, so the Augustijn must be considered some premium brew for it to be in a smaller glass and come knocking down doors at a mighty $9. \n\nI liked the overall aesthetics of the place. There is an up-close-and-personal feel to the bar. Along with the standard bar and barstools set-up, there's a long table that goes from one end of the bar to the other. People sit across from each other and, since the tables are not wide, you're not far at all from the person sitting in front of you. Like I wrote earlier, up close and personal is what this bar has going for it.\n\nThey have a food menu, as well. Above their draft selection of beer, they have a chalkboard placed high up with a list of what they serve. For those veggies among us, they even make a veggie burger.\n\nLastly, the patrons all seem to know each other. Maybe it's the small town mentality. But it's not exactly a backwards, hick town. It's very much modern in certain ways, and people just love to talk. Couple that with brew, and there's a lot of talk going on.\n\nI had a discussion with someone at the bar, who bartends at a bar not too far from The Back Abbey, and he told me that the Augustijn is the oldest beer recipe known to man. (Ah, ok. Old is vintage. Vintage is expensive. Thus, Augustijn is expensive. And two + two = four. I got this down, partna'.) Again, can we give it up for \
As a vegan, I try to support places that are not wholly vegetarian, but that made the effort to put a vegetarian section on their menu, to show them that it's worth keeping. Thai Singha House does indeed have a section of their menu that reads vegetarian, but, unfortunately, their definition of vegetarian is different from mine.\n\nAll of the vegetarian curries, I was fortunately informed upon asking, do indeed contain fish sauce, which is an ingredient in the curry itself, and cannot be omitted.\n\nMy server suggested the pad thai as a fish-free vegetarian alternative, which I ordered, holding the egg. When it arrived, there appeared to be tofu in there and no egg, which was a good sign. But after a few blind, trusting bites I quickly realized that there was also chicken or pork mixed in as well. My server graciously took it back and honored my request for a house salad, of which I wasn't charged.\n\nI don't blame Thai Singha House for not understanding the definition of vegetarian (sadly, I know a few \
On a recent visit to SLO, I got taken out to the Natural Cafe, which bears a distinct resemblance to some of the places I remember from growing up in Berkeley. Very natural woodsy, with just enough sprouts on the sandwich to add a little crunch. It's casual, with counter service only.\n\nMy turkey burger was not too dry, but the guacamole and special sauce helped it along in the moistness department. I didn't walk away from the meal feeling all gross and over full like you would with a normal burger and fries. Yeah for whole grains and veggies!
Great place! \n\nI have to say the menu and the outdoor seating keep us coming back. The food is good -- had breakfast both times but some friends had lunch items. Definitely a great selection. We've been at off-peak times so no waiting and better service. \n\nAll in all, it's no DZ Akins but it's definitely worth trying!
Went to Rebecca's Cafe today during my lunch break today. I have to say, my sandwich was delicious! I had a Chicken Caprese panini (grilled chicken, tomato, mozzarella cheese, spinach, and balsamic vinaigrette). The staff was friendly and the service was quick, however the price is a little high for my taste ($7 or so for the sandwich only). Overall, I would definitely go back to try some different items (or even get the same sandwich), but it won't be too often.
The only thing I've ever eaten at Time-Out is their ice cream cookie sandwich thing, and that's really all I need. It's about a half-gallon of ice cream sandwiched between two large-ish chocolate chip cookies. I don't know if they make it, or if it comes off a truck, or what... but it's frozen so solid you usually have to wait a few minutes before chowing down so you don't break a tooth.\n\nIf nothing else, they are one of the few old standards on Franklin Street that have not succumbed to the high-end shopping takeover, so they are worth being excited about.\n\nDo watch out for drunken Tarheels, though. This place has more disgusting drunkenness issues late at night than any bar I've been in.
Pros: Very clean and pretty little place. Really sweet-natured and attentive servers. Clean bathrooms (Haha it says a lot, ok?) Reasonable prices \n\nCons: Pho broth started ok but after a while starts to taste bitter and weird and left my mouth really dry. Meat is kinda chewy.\n\nThis place could have been SO AWESOME. A pho place so close to campus is one of those \
This is my favorite place of all time. I've driven from LA to SLO just to eat here. The barbecue sauce is AMAZING! Everything here is AMAZING! I can never decide what to get when I go here. Here's what I rotate between; tri tip sandwich, chicken wings and the ABC burger. Their fries are delicious also! Wings are fried and spicy. ABC burger is ten times more delicious then In N Out. I don't even know what to say about the trip tip sandwich. Words can not describe it. If you are a meat eater, you'll love it. It's bread, bbq sauce and like 2 inches of steak. Just amazing! My mouth is watering trying to describe the food.
After enduring years of crappy, undercooked, bad pizza in and around Ann Arbor (a la pizza house, cottage inn, and the like), Silvio's brings real pizza to town. Real pizza should be thin, have a crispy, bubbly, sourdough crust and be full of flavor, not grease, and this is the only place to get it.\n\nDon't be fooled by the \
The average rating for this place is right on point: a-ok. We came here with a relatively large group on a Friday night a little after ten o'clock. The first floor of the place was packed, but we found plenty of space upstairs in the corner, which is a pretty weird room considering how removed it is from everything. Or waiter was good about taking everyone's drink orders and being patient about it, though at one point he gave the right drinks to the wrong people. He was also cool about serving us while we played a stupid game with post its on our foreheads. We didn't order any food, but I was impressed that their kitchen is open so late and the menu is pretty big. \n\nWe were having a fun time until the band came on down stairs. The blaring sound was inescapable, even though we were kind of removed from where everything was happening. The music was so loud it was almost impossible to hear what anyone was saying right next to you. In case you're planning to pay with Discover, they DO accept it; not so cooperative on the check splitting though.
For the grand finale of my LA trip, we head over to Firestone Grill immediately after Splash Cafe.\n\nI like this place for many reasons. Obviously the tri-tip sandwich was just off da hook delicious even after clam chowder & calamari literally 5 mins ago. I also think this is one of the largest, most laid back sports bar/grills I've been to. The ladies at the register and the bartenders were very friendly in answering my questions. There is a large dining area inside and the humongous patio outside, but I don't doubt that people may end up spilling onto the sidewalk during game days as it was already quite packed for a Sunday evening. Despite the noise factor, I felt there was good energy from everyone and I was pretty comfortable. They have plenty of wide screen LCD TVs hung along the walls for your viewing pleasure (and the picture is clear :P). I don't think they have servers so you have to walk up to the counter or bar for service. Not a big deal to me IMO. \n\nSome might say that it was premature to give this a 5 star rating, but I have faith that the next time I visit (and I will go back), I will not be disappointed.
I've used this service for years. The best parts are that it tends to be on time and that there are bike racks on the front of the buses. Unfortunately the drivers must navigate roads filled with undergraduates on bicycles who think they are immortal. I've seen some close calls, but the drivers get serious kudos for being able to drive in that environment all day.\n\nThe drivers tend to be helpful and friendly, though some of them don't speak excellent English. There are a few routes I get a bit car-sick on, but that is due to the twisty roads and frequent stopping-accelerating. \n\nThe routes change, especially if there is construction going on. Make sure you check to see what is running during the summer and holidays. I've waited for shuttles that weren't going to come for days before.
Cannot believe how highly rated this place is, wow. Takes forever for them to get orders out even when its super slow. Our pizza took something like 65 minutes from the time we ordered it. Now i will wait that long if the pizza is going to be amazing, like at pizza popilis down in greek town. But this pizza was average at best. I think that the gluten free offerings are great but I really expected alot more. Great renovations btw the place looks amazing.
We went here a few weeks ago on the premiere weekend of Horrible Bosses. Loved that movie! \nMy wife wanted to come to a real movie theater that was more of a classic than one of these \
One of the best nights of my life. Hands down.\n\nIt was just amazing... The amount of people that gathered all for the same thing, The music pumping through your body everywhere you walked, The day turned to night, and the fireworks that illuminated the sky as you danced without a care to the blissful beats of Deadmau5 and others. It was a night that I will never forget.\n\nYes, it was not perfect, but what event of that size ever has been. I mean you don't show up to the largest rave in america and not expect there to be a shit load of people there. The numbers have been increasing every year, so why would this one be any different? If not, it would only be even bigger, since the biggest rising dance artist of the year, and the biggest name in trance are headlining...\n\nAnd as for all that crap about fence jumping and people getting hurt, and that one girl even died!.. OK, my condolences go out to that girls family, having a death in the family is hard, i cant even imagine it being your child.... BUT you cannot blame her taking drugs on an event, any more than video-games for kids shooting other kids. Its their own ignorance and apathy. As for all those people who got hurt. More than likely their own fault. Some 250 out of 180,000 people messed up, and now theres this huge dim view on raves. Cause there have been less riots and fights due to hockey, or football, or basketball, etc. right? (note: sarcasm above)\n\nMy final word/opinion: Definitely the best massive I've ever been to. Just as good, if not better than last year! Can't wait for next year!
I was in a desperate need of a good falafel and once again Yelp didn't let me down.\n\nOnce in the small deliciously smelling restaurant, I decided to go with the lamb gyro. I read many good things and decided to try it out, and was praying it wouldn't turn my entire mouth yellow(as stated by a few yelpers). \n\nI am happy to report that the gyro was deliciously seasoned and had huge pieces of lamb wrapped up inside. I couldn't tell you if my mouth turned yellow because I made it a point to not
file_input = open('yelp.dat', 'r')
convert_lowercase = [line.lower() for line in file_input]
with open('yelp.dat', 'w') as out:
out.writelines(sorted(convert_lowercase))
import string
remove = dict.fromkeys(map(ord, '\n ' + string.punctuation))
with open('yelp.dat') as file_input:
f = file_input.read()translate(remove)
i ran it but i checked the file there's still punctuation. where did i go wrong?
A couple issues I noticed.In your code, you open your file with file_input = open("file", "r"). This opens the file in read mode, but you don't receive the contents of this file until you do file_input.read(). Additionally, when using open() without a context manager, you should close the file with file_input.close(). Some code that would work:
import string
file_input = open("yelp.dat", "r")
file_content = file_input.read() # Read the contents of the file
convert_lowercase = file_content.lower() # No need to convert each line individually.
file_input.close() # Close the file
for punctuation in string.punctuation: # Go through the punctuation and replace it with an empty string (remove it) in your content.
convert_lowercase.replace(punctuation, "")
with open("yelp.dat", "w") as file:
file.write(convert_lowercase) # This overwrites all current content that is inside the file.
I've hit a bit of a wall and would appreciate some guidance. I want to index a large block of text, like such:
Several men are in the locker room of a golf club. A cell phone on a
bench rings and a man engages the hands-free speaker function and
begins to talk. Everyone else in the room stops to listen. The man
hangs up. The other men in the locker room are looking at him in
astonishment. Then he smiles and asks: "Anyone know whose phone
is???!!!"
I dont want to store this fulltext as it is in Solr, I want to instead have two versions of it. One as a truncated form, and one as a keyword form.
Truncated Form:
Several men are in the locker room of a golf club. A cell phone on a
bench rings and a man engages the hands-free speaker function and
begins to talk. Everyone else...
Keyword Form (using stopwords to remove common words):
Several men locker room golf club cell phone bench rings man engages
hands-free speaker function begins talk Everyone else room stops
listen man hangs up other men locker room looking him astonishment
smiles asks Anyone know whose phone
How should I be doing this.
Just perform these transformations on client side and then have two fields in Solr for each version.