Skip to content

Instantly share code, notes, and snippets.

@BarisSari
Last active December 24, 2020 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BarisSari/c5e531610dc00990e7e629957343247f to your computer and use it in GitHub Desktop.
Save BarisSari/c5e531610dc00990e7e629957343247f to your computer and use it in GitHub Desktop.
regex.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "regex.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyNk+A/B2qYKTF1jdrKWZERq",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/BarisSari/c5e531610dc00990e7e629957343247f/regex.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "wkD7e6AdEEQ-",
"outputId": "0110dc79-b2ed-4080-ef2b-0a829f99fb47"
},
"source": [
"import re\n",
"\n",
"\n",
"re.split(r\"(?<!\\w\\.\\w.)(?<![A-Z][a-z]\\.)(?<=\\.|\\?|!)\\s\", first_dialogue)"
],
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"['Do you know what this is all about?',\n",
" 'Do you know, why were here?',\n",
" 'To be out, this is out...and out is one of the single most enjoyable experiences of life.',\n",
" 'People...did you ever hear people talking about We should go out?',\n",
" 'This is what theyre talking about...this whole thing, were all out now, no one is home.',\n",
" 'Not one person here is home, were all out!',\n",
" 'There are people tryin to find us, they dont know where we are.',\n",
" '(on an imaginary phone) Did you ring?, I cant find him.',\n",
" 'Where did he go?',\n",
" 'He didnt tell me where he was going.',\n",
" 'He must have gone out.',\n",
" 'You wanna go out you get ready, you pick out the clothes, right?',\n",
" 'You take the shower, you get all ready, get the cash, get your friends, the car, the spot, the reservation...Then youre standing around, whatta you do?',\n",
" 'You go We gotta be getting back.',\n",
" 'Once youre out, you wanna get back!',\n",
" 'You wanna go to sleep, you wanna get up, you wanna go out again tomorrow, right?',\n",
" 'Where ever you are in life, its my feeling, youve gotta go.']"
]
},
"metadata": {
"tags": []
},
"execution_count": 2
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment