diff --git a/A - Using TorchText with Your Own Datasets.ipynb b/A - Using TorchText with Your Own Datasets.ipynb index da776c8..7f51c4f 100644 --- a/A - Using TorchText with Your Own Datasets.ipynb +++ b/A - Using TorchText with Your Own Datasets.ipynb @@ -28,9 +28,9 @@ "TEXT = data.Field()\n", "LABEL = data.LabelField()\n", "\n", - "train, test = datasets.IMDB.splits(TEXT, LABEL)\n", + "train_data, test_data = datasets.IMDB.splits(TEXT, LABEL)\n", "\n", - "train, valid = train.split()" + "train_data, valid_data = train_data.split()" ] }, { @@ -173,12 +173,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'text': ['I', 'simply', 'cannot', 'believe', 'the', 'number', 'of', 'people', 'comparing', 'this', 'favourably', 'with', 'the', 'first', 'film.', 'It', 'moved', 'me', 'to', 'leave', 'this', 'comment!', 'This', 'is', 'just', 'an', 'obvious', 'attempt', 'to', 'cash-in', 'on', 'the', 'success', 'of', 'the', 'first', 'film.', 'The', 'dialogue', 'is', 'appalling', 'and', 'nothing', 'like', 'as', 'authentic', 'or', 'compelling', 'as', 'the', 'original', 'film.The', 'storyline', 'is', 'ridiculous,', 'the', 'portrayal', 'of', 'the', 'French', 'police', 'laughable', 'and', 'the', 'characterisation', 'of', 'Doyle', 'a', 'mile', 'away', 'from', 'the', 'first', 'film.How', 'many', 'drug', 'bosses', 'do', 'you', 'think', 'go', 'down', 'to', 'the', 'docks', 'in', 'person', 'to', 'see', 'a', 'shipment', 'come', 'in?', 'The', 'ease', 'at', 'which', 'Doyle', 'finds', 'his', 'guy', 'is', 'just', 'pathetic.', 'Like', 'all', 'the', 'French', 'Police', 'were', 'just', 'drinking', 'coffee', 'until', 'Doyle', 'turns', 'up', 'from', 'America', 'and', 'does', 'some', 'REAL', 'police', 'work.', 'What', 'a', 'joke.', 'Try', 'going', 'to', 'a', 'foreign', 'city', 'and', 'unearthing', 'the', 'biggest', 'crims', 'in', 'the', 'place', 'with', 'a', 'travel', 'map', 'and', 'some', 'tourist', 'pamphlets.', 'Pathetic.', 'A', 'truly', 'awful', 'sequel,', 'anyone', 'who', 'thinks', 'otherwise', 'is', 'crazy.'], 'label': 'neg'}\n" + "{'n': ['John'], 'p': ['United', 'Kingdom'], 's': ['i', 'love', 'the', 'united kingdom']}\n" ] } ], "source": [ - "print(vars(train[0]))" + "print(vars(train_data[0]))" ] }, { @@ -249,12 +249,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'text': ['I', 'simply', 'cannot', 'believe', 'the', 'number', 'of', 'people', 'comparing', 'this', 'favourably', 'with', 'the', 'first', 'film.', 'It', 'moved', 'me', 'to', 'leave', 'this', 'comment!', 'This', 'is', 'just', 'an', 'obvious', 'attempt', 'to', 'cash-in', 'on', 'the', 'success', 'of', 'the', 'first', 'film.', 'The', 'dialogue', 'is', 'appalling', 'and', 'nothing', 'like', 'as', 'authentic', 'or', 'compelling', 'as', 'the', 'original', 'film.The', 'storyline', 'is', 'ridiculous,', 'the', 'portrayal', 'of', 'the', 'French', 'police', 'laughable', 'and', 'the', 'characterisation', 'of', 'Doyle', 'a', 'mile', 'away', 'from', 'the', 'first', 'film.How', 'many', 'drug', 'bosses', 'do', 'you', 'think', 'go', 'down', 'to', 'the', 'docks', 'in', 'person', 'to', 'see', 'a', 'shipment', 'come', 'in?', 'The', 'ease', 'at', 'which', 'Doyle', 'finds', 'his', 'guy', 'is', 'just', 'pathetic.', 'Like', 'all', 'the', 'French', 'Police', 'were', 'just', 'drinking', 'coffee', 'until', 'Doyle', 'turns', 'up', 'from', 'America', 'and', 'does', 'some', 'REAL', 'police', 'work.', 'What', 'a', 'joke.', 'Try', 'going', 'to', 'a', 'foreign', 'city', 'and', 'unearthing', 'the', 'biggest', 'crims', 'in', 'the', 'place', 'with', 'a', 'travel', 'map', 'and', 'some', 'tourist', 'pamphlets.', 'Pathetic.', 'A', 'truly', 'awful', 'sequel,', 'anyone', 'who', 'thinks', 'otherwise', 'is', 'crazy.'], 'label': 'neg'}\n" + "{'n': ['John'], 'p': ['United', 'Kingdom'], 's': ['i', 'love', 'the', 'united', 'kingdom']}\n" ] } ], "source": [ - "print(vars(train[0]))" + "print(vars(train_data[0]))" ] }, { @@ -301,12 +301,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'text': ['I', 'simply', 'cannot', 'believe', 'the', 'number', 'of', 'people', 'comparing', 'this', 'favourably', 'with', 'the', 'first', 'film.', 'It', 'moved', 'me', 'to', 'leave', 'this', 'comment!', 'This', 'is', 'just', 'an', 'obvious', 'attempt', 'to', 'cash-in', 'on', 'the', 'success', 'of', 'the', 'first', 'film.', 'The', 'dialogue', 'is', 'appalling', 'and', 'nothing', 'like', 'as', 'authentic', 'or', 'compelling', 'as', 'the', 'original', 'film.The', 'storyline', 'is', 'ridiculous,', 'the', 'portrayal', 'of', 'the', 'French', 'police', 'laughable', 'and', 'the', 'characterisation', 'of', 'Doyle', 'a', 'mile', 'away', 'from', 'the', 'first', 'film.How', 'many', 'drug', 'bosses', 'do', 'you', 'think', 'go', 'down', 'to', 'the', 'docks', 'in', 'person', 'to', 'see', 'a', 'shipment', 'come', 'in?', 'The', 'ease', 'at', 'which', 'Doyle', 'finds', 'his', 'guy', 'is', 'just', 'pathetic.', 'Like', 'all', 'the', 'French', 'Police', 'were', 'just', 'drinking', 'coffee', 'until', 'Doyle', 'turns', 'up', 'from', 'America', 'and', 'does', 'some', 'REAL', 'police', 'work.', 'What', 'a', 'joke.', 'Try', 'going', 'to', 'a', 'foreign', 'city', 'and', 'unearthing', 'the', 'biggest', 'crims', 'in', 'the', 'place', 'with', 'a', 'travel', 'map', 'and', 'some', 'tourist', 'pamphlets.', 'Pathetic.', 'A', 'truly', 'awful', 'sequel,', 'anyone', 'who', 'thinks', 'otherwise', 'is', 'crazy.'], 'label': 'neg'}\n" + "{'n': ['John'], 'p': ['United', 'Kingdom'], 's': ['i', 'love', 'the', 'united', 'kingdom']}\n" ] } ], "source": [ - "print(vars(train[0]))" + "print(vars(train_data[0]))" ] }, {