{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from fastai import * # Quick access to most common functionality\n", "from fastai.text import * # Quick access to NLP functionality" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Text example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An example of creating a language model and then transfering to a classifier." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "PosixPath('/home/jhoward/.fastai/data/imdb_sample')" ] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "path = untar_data(URLs.IMDB_SAMPLE)\n", "path" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Open and view the independent and dependent variables:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | 0 | \n", "1 | \n", "2 | \n", "
---|---|---|---|
0 | \n", "label | \n", "text | \n", "is_valid | \n", "
1 | \n", "negative | \n", "Un-bleeping-believable! Meg Ryan doesn't even ... | \n", "False | \n", "
2 | \n", "positive | \n", "This is a extremely well-made film. The acting... | \n", "False | \n", "
3 | \n", "negative | \n", "Every once in a long while a movie will come a... | \n", "False | \n", "
4 | \n", "positive | \n", "Name just says it all. I watched this movie wi... | \n", "False | \n", "