Skip to content

This is online challenge where I have made code which solves multiple requirements of problem in single line using nested loop method. Where I have successfully delivered my solution of challenge.

Notifications You must be signed in to change notification settings

ShubhamSongire/One-line-regex-code-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

One-line-regex-code-challenge

This is online challenge where I have made code which solves multiple requirements of problem in single line using nested loop method. Where I have successfully delivered my solution of challenge.

Challenge task is as follows.

For this project, you will mine text from Shakespeare's famous play Hamlet. You will only mine from Act I. The corresponding text file can be found inside the same zipped folder.
What to do?

  1. First mine all the sentences in Act I using regular expressions. Please remove the characters’ names. Here is an example:

Before step1:

BARNARDO Who's there?
FRANCISCO
Nay, answer me. Stand and unfold yourself.

After step1:

Who's there?
Nay, answer me.
Stand and unfold yourself.

Things to consider:

a. Note that sentences end with a period (.) or a question mark (?) or an exclamation mark (!). However, sometimes period (.) can be found in the middle of a sentence, for example, Ph.D. , Mr. , Mrs. Dr., etc. An interesting thing to note is that period, when appears at the end of a sentence, is usually also followed by an uppercase letter which is a part of the next sentence. This idea will stay true for most cases in Act I.
b. Note that you will have to be careful to detect the beginning of a sentence. Sentences cannot include a character’s name unless it is a part of the dialog. That means, “BARNARDO Who's there?” is not accepted, because “BARNARDO” is indicating the speaker’s name and not part of the dialog. So “BARNARDO” should not be included when mining the sentence. Only “Who’s there?” should be mined. However, “Get thee to bed, Francisco.” is a valid sentence and should be included, because “Francisco” is a part of the dialog.
c. Also note that some sentences start with a single quote (’). These sentences should not be ignored.
d. The above three are just examples, and more patterns may exist. You are encouraged to observe more patterns and use that knowledge to write a

About

This is online challenge where I have made code which solves multiple requirements of problem in single line using nested loop method. Where I have successfully delivered my solution of challenge.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published