You're telling a story about a time when you got locked out of your house. You've described the basic situation, and now you want to describe the interesting event that happened.
As I was riding the train home, I realized that I'd left my keys in the closet at work.
Use "as I was ___ing , ___" to describe when something suddenly happened while you were doing some other continuing action. For example:
As I was getting ready for work, I suddenly felt a sharp pain in my chest.
You can put the "as I was" part at the end as well:
She called out to me as I was about to get on the bus.
This is similar to "meanwhile", but "meanwhile" can be used to describe what two (or more) different people did:
James got started on supper. Meanwhile, Emma and I worked on her math homework and Brad went off to his room, probably to play X-box.
"As I was ___ing" is used to describe two things that happened to the same person at the same time. One of the events is continuous ("riding the train"), and the other is a momentary action ("realized that...").
You can "ride" a train, or you can "take" a train. What's the difference?
You use "ride" when you want to talk about the experience of riding, or when you want to describe something that happened while you were riding the train:
I love riding the train in the middle of the day when it's not crowded.
I was riding the train, and this guy next to me started telling me a story about how he had just gotten out of prison.
You use "take" when you want to talk about how you get somewhere:
Just take the #3 train to 72nd Street and I'll meet you there.
Do you think it'll be faster to take the train or try to catch a bus?
To "realize" is to suddenly know something based on your own thinking - not based on what someone tells you or on things that you directly see.
In written English, it's considered correct to use "that" after "realize":
I realized that I didn't have my wallet.
But in spoken English, "that" is often dropped.
You use "I'd (done something)" when you're telling a story, and you want to talk about something that you did before the scene that you're describing. In the example above, "I'd left my keys in the closet" happened before "riding the train home".
I was really sleepy because I had gone out drinking the night before.
It turns out that my roommate had left his window unlocked.
(Print this lesson)