Skip to content

Instantly share code, notes, and snippets.

@BarisSari
Last active December 24, 2020 09:47
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/1f067ecf56cf415bac36d0d28a5e1031 to your computer and use it in GitHub Desktop.
Save BarisSari/1f067ecf56cf415bac36d0d28a5e1031 to your computer and use it in GitHub Desktop.
sentence-tokenization.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "sentence-tokenization.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyPpV/ErAoPGJJtRHyDt2rmy",
"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/1f067ecf56cf415bac36d0d28a5e1031/sentencizer.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "nblo4YPZhTFg"
},
"source": [
"from spacy.lang.en import English\n",
"\n",
"nlp = English() # just the language with no model\n",
"sentencizer = nlp.create_pipe(\"sentencizer\")\n",
"nlp.add_pipe(sentencizer)"
],
"execution_count": 1,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "jxkl0c-YjGPI",
"outputId": "733e76a5-9339-475f-faf7-1edec230172a"
},
"source": [
"[sent.text for sent in nlp(first_dialogue).sents]"
],
"execution_count": 3,
"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?,',\n",
" '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": 3
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Ecm7-k35FP9_"
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment