We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
skipgram seed parameter got removed in a documentation patch, seed parameter should be readded
Patch 0af6b6c7f5cbad394673bc962dd248f50fd821ff removed the seed parameter from skipgrams. Having a seed parameter makes it easier to vary the results from``skipgram`` in a controlled way.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `keras/preprocessing/sequence.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3 
4 import numpy as np
5 import random
6 from six.moves import range
7 
8 
9 def pad_sequences(sequences, maxlen=None, dtype='int32',
10                   padding='pre', truncating='pre', value=0.):
11     """Pads each sequence to the same length (length of the longest sequence).
12 
13     If maxlen is provided, any sequence longer
14     than maxlen is truncated to maxlen.
15     Truncation happens off either the beginning (default) or
16     the end of the sequence.
17 
18     Supports post-padding and pre-padding (default).
19 
20     # Arguments
21         sequences: list of lists where each element is a sequence
22         maxlen: int, maximum length
23         dtype: type to cast the resulting sequence.
24         padding: 'pre' or 'post', pad either before or after each sequence.
25         truncating: 'pre' or 'post', remove values from sequences larger than
26             maxlen either in the beginning or in the end of the sequence
27         value: float, value to pad the sequences to the desired value.
28 
29     # Returns
30         x: numpy array with dimensions (number_of_sequences, maxlen)
31 
32     # Raises
33         ValueError: in case of invalid values for `truncating` or `padding`,
34             or in case of invalid shape for a `sequences` entry.
35     """
36     if not hasattr(sequences, '__len__'):
37         raise ValueError('`sequences` must be iterable.')
38     lengths = []
39     for x in sequences:
40         if not hasattr(x, '__len__'):
41             raise ValueError('`sequences` must be a list of iterables. '
42                              'Found non-iterable: ' + str(x))
43         lengths.append(len(x))
44 
45     num_samples = len(sequences)
46     if maxlen is None:
47         maxlen = np.max(lengths)
48 
49     # take the sample shape from the first non empty sequence
50     # checking for consistency in the main loop below.
51     sample_shape = tuple()
52     for s in sequences:
53         if len(s) > 0:
54             sample_shape = np.asarray(s).shape[1:]
55             break
56 
57     x = (np.ones((num_samples, maxlen) + sample_shape) * value).astype(dtype)
58     for idx, s in enumerate(sequences):
59         if not len(s):
60             continue  # empty list/array was found
61         if truncating == 'pre':
62             trunc = s[-maxlen:]
63         elif truncating == 'post':
64             trunc = s[:maxlen]
65         else:
66             raise ValueError('Truncating type "%s" not understood' % truncating)
67 
68         # check `trunc` has expected shape
69         trunc = np.asarray(trunc, dtype=dtype)
70         if trunc.shape[1:] != sample_shape:
71             raise ValueError('Shape of sample %s of sequence at position %s is different from expected shape %s' %
72                              (trunc.shape[1:], idx, sample_shape))
73 
74         if padding == 'post':
75             x[idx, :len(trunc)] = trunc
76         elif padding == 'pre':
77             x[idx, -len(trunc):] = trunc
78         else:
79             raise ValueError('Padding type "%s" not understood' % padding)
80     return x
81 
82 
83 def make_sampling_table(size, sampling_factor=1e-5):
84     """Generates a word rank-based probabilistic sampling table.
85 
86     This generates an array where the ith element
87     is the probability that a word of rank i would be sampled,
88     according to the sampling distribution used in word2vec.
89 
90     The word2vec formula is:
91         p(word) = min(1, sqrt(word.frequency/sampling_factor) / (word.frequency/sampling_factor))
92 
93     We assume that the word frequencies follow Zipf's law (s=1) to derive
94     a numerical approximation of frequency(rank):
95        frequency(rank) ~ 1/(rank * (log(rank) + gamma) + 1/2 - 1/(12*rank))
96         where gamma is the Euler-Mascheroni constant.
97 
98     # Arguments
99         size: int, number of possible words to sample.
100         sampling_factor: the sampling factor in the word2vec formula.
101 
102     # Returns
103         A 1D Numpy array of length `size` where the ith entry
104         is the probability that a word of rank i should be sampled.
105     """
106     gamma = 0.577
107     rank = np.arange(size)
108     rank[0] = 1
109     inv_fq = rank * (np.log(rank) + gamma) + 0.5 - 1. / (12. * rank)
110     f = sampling_factor * inv_fq
111 
112     return np.minimum(1., f / np.sqrt(f))
113 
114 
115 def skipgrams(sequence, vocabulary_size,
116               window_size=4, negative_samples=1., shuffle=True,
117               categorical=False, sampling_table=None):
118     """Generates skipgram word pairs.
119 
120     Takes a sequence (list of indexes of words),
121     returns couples of [word_index, other_word index] and labels (1s or 0s),
122     where label = 1 if 'other_word' belongs to the context of 'word',
123     and label=0 if 'other_word' is randomly sampled
124 
125     # Arguments
126         sequence: a word sequence (sentence), encoded as a list
127             of word indices (integers). If using a `sampling_table`,
128             word indices are expected to match the rank
129             of the words in a reference dataset (e.g. 10 would encode
130             the 10-th most frequently occurring token).
131             Note that index 0 is expected to be a non-word and will be skipped.
132         vocabulary_size: int. maximum possible word index + 1
133         window_size: int. actually half-window.
134             The window of a word wi will be [i-window_size, i+window_size+1]
135         negative_samples: float >= 0. 0 for no negative (=random) samples.
136             1 for same number as positive samples. etc.
137         shuffle: whether to shuffle the word couples before returning them.
138         categorical: bool. if False, labels will be
139             integers (eg. [0, 1, 1 .. ]),
140             if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]
141         sampling_table: 1D array of size `vocabulary_size` where the entry i
142             encodes the probabibily to sample a word of rank i.
143 
144     # Returns
145         couples, labels: where `couples` are int pairs and
146             `labels` are either 0 or 1.
147 
148     # Note
149         By convention, index 0 in the vocabulary is
150         a non-word and will be skipped.
151     """
152     couples = []
153     labels = []
154     for i, wi in enumerate(sequence):
155         if not wi:
156             continue
157         if sampling_table is not None:
158             if sampling_table[wi] < random.random():
159                 continue
160 
161         window_start = max(0, i - window_size)
162         window_end = min(len(sequence), i + window_size + 1)
163         for j in range(window_start, window_end):
164             if j != i:
165                 wj = sequence[j]
166                 if not wj:
167                     continue
168                 couples.append([wi, wj])
169                 if categorical:
170                     labels.append([0, 1])
171                 else:
172                     labels.append(1)
173 
174     if negative_samples > 0:
175         num_negative_samples = int(len(labels) * negative_samples)
176         words = [c[0] for c in couples]
177         random.shuffle(words)
178 
179         couples += [[words[i % len(words)],
180                     random.randint(1, vocabulary_size - 1)] for i in range(num_negative_samples)]
181         if categorical:
182             labels += [[1, 0]] * num_negative_samples
183         else:
184             labels += [0] * num_negative_samples
185 
186     if shuffle:
187         seed = random.randint(0, 10e6)
188         random.seed(seed)
189         random.shuffle(couples)
190         random.seed(seed)
191         random.shuffle(labels)
192 
193     return couples, labels
194 
195 
196 def _remove_long_seq(maxlen, seq, label):
197     """Removes sequences that exceed the maximum length.
198 
199     # Arguments
200         maxlen: int, maximum length
201         seq: list of lists where each sublist is a sequence
202         label: list where each element is an integer
203 
204     # Returns
205         new_seq, new_label: shortened lists for `seq` and `label`.
206     """
207     new_seq, new_label = [], []
208     for x, y in zip(seq, label):
209         if len(x) < maxlen:
210             new_seq.append(x)
211             new_label.append(y)
212     return new_seq, new_label
213
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/keras/preprocessing/sequence.py b/keras/preprocessing/sequence.py
--- a/keras/preprocessing/sequence.py
+++ b/keras/preprocessing/sequence.py
@@ -114,7 +114,7 @@
 
 def skipgrams(sequence, vocabulary_size,
               window_size=4, negative_samples=1., shuffle=True,
-              categorical=False, sampling_table=None):
+              categorical=False, sampling_table=None, seed=None):
     """Generates skipgram word pairs.
 
     Takes a sequence (list of indexes of words),
@@ -140,6 +140,7 @@
             if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]
         sampling_table: 1D array of size `vocabulary_size` where the entry i
             encodes the probabibily to sample a word of rank i.
+        seed: random seed.
 
     # Returns
         couples, labels: where `couples` are int pairs and
@@ -184,7 +185,8 @@
             labels += [0] * num_negative_samples
 
     if shuffle:
-        seed = random.randint(0, 10e6)
+        if seed is None:
+            seed = random.randint(0, 10e6)
         random.seed(seed)
         random.shuffle(couples)
         random.seed(seed)

{"golden_diff": "diff --git a/keras/preprocessing/sequence.py b/keras/preprocessing/sequence.py\n--- a/keras/preprocessing/sequence.py\n+++ b/keras/preprocessing/sequence.py\n@@ -114,7 +114,7 @@\n \n def skipgrams(sequence, vocabulary_size,\n               window_size=4, negative_samples=1., shuffle=True,\n-              categorical=False, sampling_table=None):\n+              categorical=False, sampling_table=None, seed=None):\n     \"\"\"Generates skipgram word pairs.\n \n     Takes a sequence (list of indexes of words),\n@@ -140,6 +140,7 @@\n             if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]\n         sampling_table: 1D array of size `vocabulary_size` where the entry i\n             encodes the probabibily to sample a word of rank i.\n+        seed: random seed.\n \n     # Returns\n         couples, labels: where `couples` are int pairs and\n@@ -184,7 +185,8 @@\n             labels += [0] * num_negative_samples\n \n     if shuffle:\n-        seed = random.randint(0, 10e6)\n+        if seed is None:\n+            seed = random.randint(0, 10e6)\n         random.seed(seed)\n         random.shuffle(couples)\n         random.seed(seed)\n", "issue": "skipgram seed parameter got removed in a documentation patch, seed parameter should be readded\nPatch 0af6b6c7f5cbad394673bc962dd248f50fd821ff removed the seed parameter from skipgrams. Having a seed parameter makes it easier to vary the results from``skipgram`` in a controlled way.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport numpy as np\nimport random\nfrom six.moves import range\n\n\ndef pad_sequences(sequences, maxlen=None, dtype='int32',\n                  padding='pre', truncating='pre', value=0.):\n    \"\"\"Pads each sequence to the same length (length of the longest sequence).\n\n    If maxlen is provided, any sequence longer\n    than maxlen is truncated to maxlen.\n    Truncation happens off either the beginning (default) or\n    the end of the sequence.\n\n    Supports post-padding and pre-padding (default).\n\n    # Arguments\n        sequences: list of lists where each element is a sequence\n        maxlen: int, maximum length\n        dtype: type to cast the resulting sequence.\n        padding: 'pre' or 'post', pad either before or after each sequence.\n        truncating: 'pre' or 'post', remove values from sequences larger than\n            maxlen either in the beginning or in the end of the sequence\n        value: float, value to pad the sequences to the desired value.\n\n    # Returns\n        x: numpy array with dimensions (number_of_sequences, maxlen)\n\n    # Raises\n        ValueError: in case of invalid values for `truncating` or `padding`,\n            or in case of invalid shape for a `sequences` entry.\n    \"\"\"\n    if not hasattr(sequences, '__len__'):\n        raise ValueError('`sequences` must be iterable.')\n    lengths = []\n    for x in sequences:\n        if not hasattr(x, '__len__'):\n            raise ValueError('`sequences` must be a list of iterables. '\n                             'Found non-iterable: ' + str(x))\n        lengths.append(len(x))\n\n    num_samples = len(sequences)\n    if maxlen is None:\n        maxlen = np.max(lengths)\n\n    # take the sample shape from the first non empty sequence\n    # checking for consistency in the main loop below.\n    sample_shape = tuple()\n    for s in sequences:\n        if len(s) > 0:\n            sample_shape = np.asarray(s).shape[1:]\n            break\n\n    x = (np.ones((num_samples, maxlen) + sample_shape) * value).astype(dtype)\n    for idx, s in enumerate(sequences):\n        if not len(s):\n            continue  # empty list/array was found\n        if truncating == 'pre':\n            trunc = s[-maxlen:]\n        elif truncating == 'post':\n            trunc = s[:maxlen]\n        else:\n            raise ValueError('Truncating type \"%s\" not understood' % truncating)\n\n        # check `trunc` has expected shape\n        trunc = np.asarray(trunc, dtype=dtype)\n        if trunc.shape[1:] != sample_shape:\n            raise ValueError('Shape of sample %s of sequence at position %s is different from expected shape %s' %\n                             (trunc.shape[1:], idx, sample_shape))\n\n        if padding == 'post':\n            x[idx, :len(trunc)] = trunc\n        elif padding == 'pre':\n            x[idx, -len(trunc):] = trunc\n        else:\n            raise ValueError('Padding type \"%s\" not understood' % padding)\n    return x\n\n\ndef make_sampling_table(size, sampling_factor=1e-5):\n    \"\"\"Generates a word rank-based probabilistic sampling table.\n\n    This generates an array where the ith element\n    is the probability that a word of rank i would be sampled,\n    according to the sampling distribution used in word2vec.\n\n    The word2vec formula is:\n        p(word) = min(1, sqrt(word.frequency/sampling_factor) / (word.frequency/sampling_factor))\n\n    We assume that the word frequencies follow Zipf's law (s=1) to derive\n    a numerical approximation of frequency(rank):\n       frequency(rank) ~ 1/(rank * (log(rank) + gamma) + 1/2 - 1/(12*rank))\n        where gamma is the Euler-Mascheroni constant.\n\n    # Arguments\n        size: int, number of possible words to sample.\n        sampling_factor: the sampling factor in the word2vec formula.\n\n    # Returns\n        A 1D Numpy array of length `size` where the ith entry\n        is the probability that a word of rank i should be sampled.\n    \"\"\"\n    gamma = 0.577\n    rank = np.arange(size)\n    rank[0] = 1\n    inv_fq = rank * (np.log(rank) + gamma) + 0.5 - 1. / (12. * rank)\n    f = sampling_factor * inv_fq\n\n    return np.minimum(1., f / np.sqrt(f))\n\n\ndef skipgrams(sequence, vocabulary_size,\n              window_size=4, negative_samples=1., shuffle=True,\n              categorical=False, sampling_table=None):\n    \"\"\"Generates skipgram word pairs.\n\n    Takes a sequence (list of indexes of words),\n    returns couples of [word_index, other_word index] and labels (1s or 0s),\n    where label = 1 if 'other_word' belongs to the context of 'word',\n    and label=0 if 'other_word' is randomly sampled\n\n    # Arguments\n        sequence: a word sequence (sentence), encoded as a list\n            of word indices (integers). If using a `sampling_table`,\n            word indices are expected to match the rank\n            of the words in a reference dataset (e.g. 10 would encode\n            the 10-th most frequently occurring token).\n            Note that index 0 is expected to be a non-word and will be skipped.\n        vocabulary_size: int. maximum possible word index + 1\n        window_size: int. actually half-window.\n            The window of a word wi will be [i-window_size, i+window_size+1]\n        negative_samples: float >= 0. 0 for no negative (=random) samples.\n            1 for same number as positive samples. etc.\n        shuffle: whether to shuffle the word couples before returning them.\n        categorical: bool. if False, labels will be\n            integers (eg. [0, 1, 1 .. ]),\n            if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]\n        sampling_table: 1D array of size `vocabulary_size` where the entry i\n            encodes the probabibily to sample a word of rank i.\n\n    # Returns\n        couples, labels: where `couples` are int pairs and\n            `labels` are either 0 or 1.\n\n    # Note\n        By convention, index 0 in the vocabulary is\n        a non-word and will be skipped.\n    \"\"\"\n    couples = []\n    labels = []\n    for i, wi in enumerate(sequence):\n        if not wi:\n            continue\n        if sampling_table is not None:\n            if sampling_table[wi] < random.random():\n                continue\n\n        window_start = max(0, i - window_size)\n        window_end = min(len(sequence), i + window_size + 1)\n        for j in range(window_start, window_end):\n            if j != i:\n                wj = sequence[j]\n                if not wj:\n                    continue\n                couples.append([wi, wj])\n                if categorical:\n                    labels.append([0, 1])\n                else:\n                    labels.append(1)\n\n    if negative_samples > 0:\n        num_negative_samples = int(len(labels) * negative_samples)\n        words = [c[0] for c in couples]\n        random.shuffle(words)\n\n        couples += [[words[i % len(words)],\n                    random.randint(1, vocabulary_size - 1)] for i in range(num_negative_samples)]\n        if categorical:\n            labels += [[1, 0]] * num_negative_samples\n        else:\n            labels += [0] * num_negative_samples\n\n    if shuffle:\n        seed = random.randint(0, 10e6)\n        random.seed(seed)\n        random.shuffle(couples)\n        random.seed(seed)\n        random.shuffle(labels)\n\n    return couples, labels\n\n\ndef _remove_long_seq(maxlen, seq, label):\n    \"\"\"Removes sequences that exceed the maximum length.\n\n    # Arguments\n        maxlen: int, maximum length\n        seq: list of lists where each sublist is a sequence\n        label: list where each element is an integer\n\n    # Returns\n        new_seq, new_label: shortened lists for `seq` and `label`.\n    \"\"\"\n    new_seq, new_label = [], []\n    for x, y in zip(seq, label):\n        if len(x) < maxlen:\n            new_seq.append(x)\n            new_label.append(y)\n    return new_seq, new_label\n", "path": "keras/preprocessing/sequence.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport numpy as np\nimport random\nfrom six.moves import range\n\n\ndef pad_sequences(sequences, maxlen=None, dtype='int32',\n                  padding='pre', truncating='pre', value=0.):\n    \"\"\"Pads each sequence to the same length (length of the longest sequence).\n\n    If maxlen is provided, any sequence longer\n    than maxlen is truncated to maxlen.\n    Truncation happens off either the beginning (default) or\n    the end of the sequence.\n\n    Supports post-padding and pre-padding (default).\n\n    # Arguments\n        sequences: list of lists where each element is a sequence\n        maxlen: int, maximum length\n        dtype: type to cast the resulting sequence.\n        padding: 'pre' or 'post', pad either before or after each sequence.\n        truncating: 'pre' or 'post', remove values from sequences larger than\n            maxlen either in the beginning or in the end of the sequence\n        value: float, value to pad the sequences to the desired value.\n\n    # Returns\n        x: numpy array with dimensions (number_of_sequences, maxlen)\n\n    # Raises\n        ValueError: in case of invalid values for `truncating` or `padding`,\n            or in case of invalid shape for a `sequences` entry.\n    \"\"\"\n    if not hasattr(sequences, '__len__'):\n        raise ValueError('`sequences` must be iterable.')\n    lengths = []\n    for x in sequences:\n        if not hasattr(x, '__len__'):\n            raise ValueError('`sequences` must be a list of iterables. '\n                             'Found non-iterable: ' + str(x))\n        lengths.append(len(x))\n\n    num_samples = len(sequences)\n    if maxlen is None:\n        maxlen = np.max(lengths)\n\n    # take the sample shape from the first non empty sequence\n    # checking for consistency in the main loop below.\n    sample_shape = tuple()\n    for s in sequences:\n        if len(s) > 0:\n            sample_shape = np.asarray(s).shape[1:]\n            break\n\n    x = (np.ones((num_samples, maxlen) + sample_shape) * value).astype(dtype)\n    for idx, s in enumerate(sequences):\n        if not len(s):\n            continue  # empty list/array was found\n        if truncating == 'pre':\n            trunc = s[-maxlen:]\n        elif truncating == 'post':\n            trunc = s[:maxlen]\n        else:\n            raise ValueError('Truncating type \"%s\" not understood' % truncating)\n\n        # check `trunc` has expected shape\n        trunc = np.asarray(trunc, dtype=dtype)\n        if trunc.shape[1:] != sample_shape:\n            raise ValueError('Shape of sample %s of sequence at position %s is different from expected shape %s' %\n                             (trunc.shape[1:], idx, sample_shape))\n\n        if padding == 'post':\n            x[idx, :len(trunc)] = trunc\n        elif padding == 'pre':\n            x[idx, -len(trunc):] = trunc\n        else:\n            raise ValueError('Padding type \"%s\" not understood' % padding)\n    return x\n\n\ndef make_sampling_table(size, sampling_factor=1e-5):\n    \"\"\"Generates a word rank-based probabilistic sampling table.\n\n    This generates an array where the ith element\n    is the probability that a word of rank i would be sampled,\n    according to the sampling distribution used in word2vec.\n\n    The word2vec formula is:\n        p(word) = min(1, sqrt(word.frequency/sampling_factor) / (word.frequency/sampling_factor))\n\n    We assume that the word frequencies follow Zipf's law (s=1) to derive\n    a numerical approximation of frequency(rank):\n       frequency(rank) ~ 1/(rank * (log(rank) + gamma) + 1/2 - 1/(12*rank))\n        where gamma is the Euler-Mascheroni constant.\n\n    # Arguments\n        size: int, number of possible words to sample.\n        sampling_factor: the sampling factor in the word2vec formula.\n\n    # Returns\n        A 1D Numpy array of length `size` where the ith entry\n        is the probability that a word of rank i should be sampled.\n    \"\"\"\n    gamma = 0.577\n    rank = np.arange(size)\n    rank[0] = 1\n    inv_fq = rank * (np.log(rank) + gamma) + 0.5 - 1. / (12. * rank)\n    f = sampling_factor * inv_fq\n\n    return np.minimum(1., f / np.sqrt(f))\n\n\ndef skipgrams(sequence, vocabulary_size,\n              window_size=4, negative_samples=1., shuffle=True,\n              categorical=False, sampling_table=None, seed=None):\n    \"\"\"Generates skipgram word pairs.\n\n    Takes a sequence (list of indexes of words),\n    returns couples of [word_index, other_word index] and labels (1s or 0s),\n    where label = 1 if 'other_word' belongs to the context of 'word',\n    and label=0 if 'other_word' is randomly sampled\n\n    # Arguments\n        sequence: a word sequence (sentence), encoded as a list\n            of word indices (integers). If using a `sampling_table`,\n            word indices are expected to match the rank\n            of the words in a reference dataset (e.g. 10 would encode\n            the 10-th most frequently occurring token).\n            Note that index 0 is expected to be a non-word and will be skipped.\n        vocabulary_size: int. maximum possible word index + 1\n        window_size: int. actually half-window.\n            The window of a word wi will be [i-window_size, i+window_size+1]\n        negative_samples: float >= 0. 0 for no negative (=random) samples.\n            1 for same number as positive samples. etc.\n        shuffle: whether to shuffle the word couples before returning them.\n        categorical: bool. if False, labels will be\n            integers (eg. [0, 1, 1 .. ]),\n            if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]\n        sampling_table: 1D array of size `vocabulary_size` where the entry i\n            encodes the probabibily to sample a word of rank i.\n        seed: random seed.\n\n    # Returns\n        couples, labels: where `couples` are int pairs and\n            `labels` are either 0 or 1.\n\n    # Note\n        By convention, index 0 in the vocabulary is\n        a non-word and will be skipped.\n    \"\"\"\n    couples = []\n    labels = []\n    for i, wi in enumerate(sequence):\n        if not wi:\n            continue\n        if sampling_table is not None:\n            if sampling_table[wi] < random.random():\n                continue\n\n        window_start = max(0, i - window_size)\n        window_end = min(len(sequence), i + window_size + 1)\n        for j in range(window_start, window_end):\n            if j != i:\n                wj = sequence[j]\n                if not wj:\n                    continue\n                couples.append([wi, wj])\n                if categorical:\n                    labels.append([0, 1])\n                else:\n                    labels.append(1)\n\n    if negative_samples > 0:\n        num_negative_samples = int(len(labels) * negative_samples)\n        words = [c[0] for c in couples]\n        random.shuffle(words)\n\n        couples += [[words[i % len(words)],\n                    random.randint(1, vocabulary_size - 1)] for i in range(num_negative_samples)]\n        if categorical:\n            labels += [[1, 0]] * num_negative_samples\n        else:\n            labels += [0] * num_negative_samples\n\n    if shuffle:\n        if seed is None:\n            seed = random.randint(0, 10e6)\n        random.seed(seed)\n        random.shuffle(couples)\n        random.seed(seed)\n        random.shuffle(labels)\n\n    return couples, labels\n\n\ndef _remove_long_seq(maxlen, seq, label):\n    \"\"\"Removes sequences that exceed the maximum length.\n\n    # Arguments\n        maxlen: int, maximum length\n        seq: list of lists where each sublist is a sequence\n        label: list where each element is an integer\n\n    # Returns\n        new_seq, new_label: shortened lists for `seq` and `label`.\n    \"\"\"\n    new_seq, new_label = [], []\n    for x, y in zip(seq, label):\n        if len(x) < maxlen:\n            new_seq.append(x)\n            new_label.append(y)\n    return new_seq, new_label\n", "path": "keras/preprocessing/sequence.py"}]}