--- /dev/null
+diff --git a/nltk/test/corpus.doctest b/nltk/test/corpus.doctest
+index 5509fe2fd..0a34c9522 100644
+--- a/nltk/test/corpus.doctest
++++ b/nltk/test/corpus.doctest
+@@ -94,7 +94,7 @@ If the reader methods are called without any arguments, they will
+ typically load all documents in the corpus.
+
+ >>> len(inaugural.words())
+- 145735
++ 149797
+
+ If a corpus contains a README file, it can be accessed with a ``readme()`` method:
+
+@@ -387,8 +387,8 @@ examples illustrate the use of the wordlist corpora:
+
+ >>> stopwords.fileids() # doctest: +ELLIPSIS
+ ['arabic', 'azerbaijani', 'danish', 'dutch', 'english', 'finnish', 'french', ...]
+- >>> stopwords.words('portuguese') # doctest: +ELLIPSIS
+- ['de', 'a', 'o', 'que', 'e', 'do', 'da', 'em', 'um', 'para', ...]
++ >>> sorted(stopwords.words('portuguese')) # doctest: +ELLIPSIS
++ ['a', 'ao', 'aos', 'aquela', 'aquelas', 'aquele', 'aqueles', ...]
+ >>> names.fileids()
+ ['female.txt', 'male.txt']
+ >>> names.words('male.txt') # doctest: +ELLIPSIS
+diff --git a/nltk/test/unit/test_wordnet.py b/nltk/test/unit/test_wordnet.py
+index a7b26ac91..a1df3d396 100644
+--- a/nltk/test/unit/test_wordnet.py
++++ b/nltk/test/unit/test_wordnet.py
+@@ -204,7 +204,7 @@ class WordnNetDemo(unittest.TestCase):
+ u'preobrat',
+ u'preobrat_v_mišljenju'
+ ]
+- self.assertEqual(S('about-face.n.02').lemma_names(lang='slv'), expected)
++ self.assertEqual(sorted(S('about-face.n.02').lemma_names(lang='slv')), sorted(expected))
+
+ def test_iterable_type_for_all_lemma_names(self):
+ # Duck-test for iterables.
--- /dev/null
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_6 )
+PYTHON_REQ_USE="sqlite,tk?,xml(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Natural Language Toolkit"
+HOMEPAGE="https://www.nltk.org/ https://github.com/nltk/nltk/"
+SRC_URI="https://github.com/nltk/nltk/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
+IUSE="tk"
+
+RDEPEND="dev-python/six[${PYTHON_USEDEP}]"
+BDEPEND="
+ test? (
+ dev-python/nltk-data
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/pyparsing[${PYTHON_USEDEP}]
+ dev-python/twython[${PYTHON_USEDEP}]
+ sci-libs/scikits_learn[${PYTHON_USEDEP}]
+ sci-libs/scipy[${PYTHON_USEDEP}]
+ )"
+PDEPEND="dev-python/nltk-data"
+
+distutils_enable_tests nose
+
+PATCHES=(
+ "${FILESDIR}"/nltk-3.4.5-corpus-tests.patch
+)
+
+src_prepare() {
+ # requires unpackaged pycrfsuite
+ sed -i -e '/>>>/s@$@ # doctest: +SKIP@' nltk/tag/crf.py || die
+ # replace fetching from network with duplicate file URL
+ sed -e 's@https://raw.githubusercontent.com/nltk/nltk/develop/nltk/test/toy.cfg@nltk:grammars/sample_grammars/toy.cfg@' \
+ -i nltk/test/data.doctest || die
+ # requires X and hangs in Xvfb
+ sed -e 's:test_plot:_&:' \
+ -i nltk/test/unit/test_cfd_mutation.py || die
+
+ distutils-r1_src_prepare
+}
+
+src_test() {
+ cd nltk/test || die
+ distutils-r1_src_test
+}
+
+python_test() {
+ "${EPYTHON}" runtests.py -v || die "Tests failed with ${EPYTHON}"
+}