internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: nltk/nltk

Issue:
Zipfile as corpus raises exception unless subdirectory is appended to filename
Unable to use a zipfile as a corpus unless a subdirectory is appended to the zipfile name.  A root name like 'twitter_samples.zip' will raise an exception.  But 'twitter_samples.zip/twitter_samples/' will work.


Using python 3.6.4, NLTK 3.2.5, Windows.

## Example using the twitter corpus.  

#### Fails with exception
```
from nltk.corpus.reader import TwitterCorpusReader
TwitterCorpusReader(root='twitter_samples.zip', fileids="twitter_samples/negative_tweets.json")
```
#### This works
```
TwitterCorpusReader(root='twitter_samples.zip/twitter_samples/', fileids="negative_tweets.json")
```

## Traceback
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\corpus\reader\twitter.py", line 74, in __init__
    CorpusReader.__init__(self, root, fileids, encoding)
  File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\corpus\reader\api.py", line 82, in __init__
    root = ZipFilePathPointer(zipfile, zipentry)
  File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\compat.py", line 221, in _decorator
    return init_func(*args, **kwargs)
  File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\data.py", line 506, in __init__
    (zipfile.filename, entry))
OSError: Zipfile 'C:\\Projects\\mfd\\nlp\\twitter_samples.zip' does not contain '.'
```


Discussion:
@meldavis @alvations I think the problem lies in here:
https://github.com/nltk/nltk/blob/a8446adace93893332d42ff0f564343748b7f83c/nltk/data.py#L491

If entry is empty(which it is in our case), it add a dot to entry, causing unintended error later. Here is an error showcase:
```
import os
import sys
entry = ''
entry = normalize_resource_name(entry, True, '/').lstrip('/')
entry
```
out
```
'.'
```

A simple fix could be changing this line:
https://github.com/nltk/nltk/blob/a8446adace93893332d42ff0f564343748b7f83c/nltk/data.py#L494
to
```
if entry != '.'
```

Shall I create a PR to fix it?

Resolving patch:
diff --git a/nltk/data.py b/nltk/data.py
--- a/nltk/data.py
+++ b/nltk/data.py
@@ -491,7 +491,7 @@ def __init__(self, zipfile, entry=''):
         entry = normalize_resource_name(entry, True, '/').lstrip('/')
 
         # Check that the entry exists:
-        if entry:
+        if entry != '.':
             try:
                 zipfile.getinfo(entry)
             except Exception:


Test patch:
Repository: nltk/nltk

Issue:
corpus BLEU score have a minor issue when smoothing
[Here](https://github.com/nltk/nltk/blob/ecced11335a8942beeab4ed9020eb93f18457d10/nltk/translate/bleu_score.py#L210) should be `hyp_lengths` rather than `hyp_len`.


Discussion:
Thanks @wwt17! Good catch!

Resolving patch:
diff --git a/nltk/translate/bleu_score.py b/nltk/translate/bleu_score.py
--- a/nltk/translate/bleu_score.py
+++ b/nltk/translate/bleu_score.py
@@ -207,7 +207,7 @@ def corpus_bleu(list_of_references, hypotheses, weights=(0.25, 0.25, 0.25, 0.25)
     #       it tries to retain the Fraction object as much as the
     #       smoothing method allows.
     p_n = smoothing_function(p_n, references=references, hypothesis=hypothesis,
-                             hyp_len=hyp_len)
+                             hyp_len=hyp_lengths)
     s = (w_i * math.log(p_i) for w_i, p_i in zip(weights, p_n))
     s =  bp * math.exp(math.fsum(s))
     return s


Test patch:
Repository: nltk/nltk

Issue:
Minor typo in the docstring of common_contexts()
The parameter name is `words`, but the docstring uses `word`.

![image](https://user-images.githubusercontent.com/22998607/52175231-63de9a80-27a9-11e9-98da-6ebc77dcbc9d.png)



Discussion:

Resolving patch:
diff --git a/nltk/text.py b/nltk/text.py
--- a/nltk/text.py
+++ b/nltk/text.py
@@ -483,8 +483,8 @@ def common_contexts(self, words, num=20):
         Find contexts where the specified words appear; list
         most frequent common contexts first.
 
-        :param word: The word used to seed the similarity search
-        :type word: str
+        :param words: The words used to seed the similarity search
+        :type words: str
         :param num: The number of words to generate (default=20)
         :type num: int
         :seealso: ContextIndex.common_contexts()


Test patch:
Repository: nltk/nltk

Issue:
treeprettyprinter imports removed function cgi.escape
Python 3.8 removed the `cgi.escape` function. Since this function is still used in the module `treeprettyprinter`, it is now unusable.

```python
Python 3.8.0 (default, Oct 23 2019, 18:51:26) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nltk import treeprettyprinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/nltk/treeprettyprinter.py", line 24, in <module>
    from cgi import escape
ImportError: cannot import name 'escape' from 'cgi' (/usr/lib/python3.8/cgi.py)
```

The Python 3.7 documentation states:

> Deprecated since version 3.2: This function is unsafe because quote is false by default, and therefore deprecated. Use html.escape() instead.


Discussion:

Resolving patch:
diff --git a/nltk/treeprettyprinter.py b/nltk/treeprettyprinter.py
--- a/nltk/treeprettyprinter.py
+++ b/nltk/treeprettyprinter.py
@@ -19,7 +19,10 @@
 """
 
 import re
-from cgi import escape
+try:
+    from html import escape
+except ImportError:
+    from cgi import escape
 from collections import defaultdict
 from operator import itemgetter
 
@@ -453,7 +456,7 @@ def crosscell(cur, x=vertline):
                 if isinstance(node, Tree) and node.label().startswith("-"):
                     color = funccolor
                 if html:
-                    text = [escape(a) for a in text]
+                    text = [escape(a, quote=False) for a in text]
                     if n in self.highlight:
                         text = ["<font color=%s>%s</font>" % (color, a) for a in text]
                 elif ansi and n in self.highlight:
@@ -572,7 +575,7 @@ def svg(self, nodecolor="blue", leafcolor="red", funccolor="green"):
                     fontsize,
                     x,
                     y,
-                    escape(node.label() if isinstance(node, Tree) else node),
+                    escape(node.label() if isinstance(node, Tree) else node, quote=False),
                 )
             ]
 


Test patch:
Repository: nltk/nltk

Issue:
time.clock removal in Python 3.8
`time.clock` was removed in Python 3.8 in https://github.com/python/cpython/pull/13270 . This will cause error in Python 3.8 for https://github.com/nltk/nltk/search?q=time.clock&unscoped_q=time.clock


Discussion:

Resolving patch:
diff --git a/nltk/compat.py b/nltk/compat.py
--- a/nltk/compat.py
+++ b/nltk/compat.py
@@ -28,6 +28,7 @@ def get_im_class(meth):
     StringIO = io.StringIO
     BytesIO = io.BytesIO
 
+    from time import perf_counter as time_clock
     from datetime import timezone
 
     UTC = timezone.utc
@@ -45,6 +46,7 @@ def get_im_class(meth):
         from StringIO import StringIO
     BytesIO = StringIO
 
+    from time import clock as time_clock
     from datetime import tzinfo, timedelta
 
     ZERO = timedelta(0)
diff --git a/nltk/parse/earleychart.py b/nltk/parse/earleychart.py
--- a/nltk/parse/earleychart.py
+++ b/nltk/parse/earleychart.py
@@ -29,6 +29,7 @@
 
 from six.moves import range
 
+from nltk.compat import time_clock
 from nltk.parse.chart import (
     Chart,
     ChartParser,
@@ -535,10 +536,10 @@ def demo(
 
     # Do the parsing.
     earley = EarleyChartParser(grammar, trace=trace)
-    t = time.clock()
+    t = time_clock()
     chart = earley.chart_parse(tokens)
     parses = list(chart.parses(grammar.start()))
-    t = time.clock() - t
+    t = time_clock() - t
 
     # Print results.
     if numparses:
diff --git a/nltk/parse/featurechart.py b/nltk/parse/featurechart.py
--- a/nltk/parse/featurechart.py
+++ b/nltk/parse/featurechart.py
@@ -14,6 +14,7 @@
 
 from six.moves import range
 
+from nltk.compat import time_clock
 from nltk.featstruct import FeatStruct, unify, TYPE, find_variables
 from nltk.sem import logic
 from nltk.tree import Tree
@@ -640,12 +641,12 @@ def demo(
     if print_sentence:
         print("Sentence:", sent)
     tokens = sent.split()
-    t = time.clock()
+    t = time_clock()
     cp = parser(grammar, trace=trace)
     chart = cp.chart_parse(tokens)
     trees = list(chart.parses(grammar.start()))
     if print_times:
-        print("Time: %s" % (time.clock() - t))
+        print("Time: %s" % (time_clock() - t))
     if print_trees:
         for tree in trees:
             print(tree)


Test patch:
Repository: nltk/nltk

Issue:
Method2 of smoothing function in nltk.translate.bleu_score needs to ignore unigram precision score
According to [Lin & Och, 2004](http://acl2014.org/acl2014/W14-33/pdf/W14-3346.pdf), second smoothing function should add 1 to both numerator & denominator of precision score for all n-grams where n >= 2. However, we can see from the code that it adds 1 to precision score corresponding to every n-gram including unigrams.

```python
def method2(self, p_n, *args, **kwargs):
        """
        Smoothing method 2: Add 1 to both numerator and denominator from
        Chin-Yew Lin and Franz Josef Och (2004) Automatic evaluation of
        machine translation quality using longest common subsequence and
        skip-bigram statistics. In ACL04.
        """
        return [
            Fraction(p_i.numerator + 1, p_i.denominator + 1, _normalize=False)
            for p_i in p_n
        ]
```


Discussion:

Resolving patch:
diff --git a/nltk/translate/bleu_score.py b/nltk/translate/bleu_score.py
--- a/nltk/translate/bleu_score.py
+++ b/nltk/translate/bleu_score.py
@@ -541,8 +541,9 @@ def method2(self, p_n, *args, **kwargs):
         skip-bigram statistics. In ACL04.
         """
         return [
-            Fraction(p_i.numerator + 1, p_i.denominator + 1, _normalize=False)
-            for p_i in p_n
+            Fraction(p_n[i].numerator + 1, p_n[i].denominator + 1, _normalize=False)
+            if i != 0 else p_n[0]
+            for i in range(len(p_n))
         ]
 
     def method3(self, p_n, *args, **kwargs):


Test patch:
Repository: nltk/nltk

Issue:
Wrong result for word more'n in Word Tokenizer and PTB Tokenizer
Let sentence: `It's more'n enough`

If I'm not mistaken, the PTB Tokenizer should result something like this:

`["It", "'s", "more", "'n", "enough"]`

But, it's not. It returns:

`["It", "'s", "more", "'", "n", "enough"]`

Since Word Tokenizer trying to implement PTB contraction, the result should be like that, right?

**PS**: Word Tokenizer contraction is `mor'n`, while original PTB contraction is `more'n`. Need clarification.


Discussion:

Resolving patch:
diff --git a/nltk/tokenize/destructive.py b/nltk/tokenize/destructive.py
--- a/nltk/tokenize/destructive.py
+++ b/nltk/tokenize/destructive.py
@@ -22,7 +22,7 @@ class MacIntyreContractions:
         r"(?i)\b(gon)(?#X)(na)\b",
         r"(?i)\b(got)(?#X)(ta)\b",
         r"(?i)\b(lem)(?#X)(me)\b",
-        r"(?i)\b(mor)(?#X)('n)\b",
+        r"(?i)\b(more)(?#X)('n)\b",
         r"(?i)\b(wan)(?#X)(na)\s",
     ]
     CONTRACTIONS3 = [r"(?i) ('t)(?#X)(is)\b", r"(?i) ('t)(?#X)(was)\b"]
@@ -46,7 +46,7 @@ class NLTKWordTokenizer(TokenizerI):
         (re.compile(r"^\""), r"``"),
         (re.compile(r"(``)"), r" \1 "),
         (re.compile(r"([ \(\[{<])(\"|\'{2})"), r"\1 `` "),
-        (re.compile(r"(?i)(\')(?!re|ve|ll|m|t|s|d)(\w)\b", re.U), r"\1 \2"),
+        (re.compile(r"(?i)(\')(?!re|ve|ll|m|t|s|d|n)(\w)\b", re.U), r"\1 \2"),
     ]
 
     # Ending quotes.


Test patch:
diff --git a/nltk/test/tokenize.doctest b/nltk/test/tokenize.doctest
--- a/nltk/test/tokenize.doctest
+++ b/nltk/test/tokenize.doctest
@@ -38,7 +38,9 @@ Some test strings.
     >>> s10 = "There were 300,000, but that wasn't enough."
     >>> word_tokenize(s10)
     ['There', 'were', '300,000', ',', 'but', 'that', 'was', "n't", 'enough', '.']
-
+    >>> s11 = "It's more'n enough."
+    >>> word_tokenize(s11)
+    ['It', "'s", 'more', "'n", 'enough', '.']
 
 Testing improvement made to the TreebankWordTokenizer
Repository: nltk/nltk

Issue:
Synset._needs_root returns None for pos other than noun and verb
`Synset._needs_root` returns None for pos other than noun and verb. I think it is a bit strange for `Synset._needs_root` to return a boolean for noun and verb, but None for any other part of speech.

![image](https://user-images.githubusercontent.com/35712574/103341379-c9e70180-4a54-11eb-90ae-e6f35364d449.png)

This causes Synset.path_similarity, and Synset.wup_similarity to not work for parts of speech other than noun, and verb.  
If `Synset._needs_root` returns `True` instead, then `Synset.path_similarity` and `Synset.wup_similarity` will work for other parts of speech.

Should these methods work for other parts of speech?


Discussion:

Resolving patch:
diff --git a/nltk/corpus/reader/wordnet.py b/nltk/corpus/reader/wordnet.py
--- a/nltk/corpus/reader/wordnet.py
+++ b/nltk/corpus/reader/wordnet.py
@@ -452,12 +452,9 @@ def lexname(self):
         return self._lexname
 
     def _needs_root(self):
-        if self._pos == NOUN:
-            if self._wordnet_corpus_reader.get_version() == "1.6":
-                return True
-            else:
-                return False
-        elif self._pos == VERB:
+        if self._pos == NOUN and self._wordnet_corpus_reader.get_version() != "1.6":
+            return False
+        else:
             return True
 
     def lemma_names(self, lang="eng"):


Test patch:
diff --git a/nltk/test/unit/test_wordnet.py b/nltk/test/unit/test_wordnet.py
--- a/nltk/test/unit/test_wordnet.py
+++ b/nltk/test/unit/test_wordnet.py
@@ -174,6 +174,10 @@ def test_wordnet_similarities(self):
         self.assertAlmostEqual(S('dog.n.01').path_similarity(S('cat.n.01')), 0.2)
         self.assertAlmostEqual(S('car.n.01').path_similarity(S('automobile.v.01')),
                                S('automobile.v.01').path_similarity(S('car.n.01')))
+        self.assertAlmostEqual(S('big.a.01').path_similarity(S('dog.n.01')),
+                               S('dog.n.01').path_similarity(S('big.a.01')))
+        self.assertAlmostEqual(S('big.a.01').path_similarity(S('long.a.01')),
+                               S('long.a.01').path_similarity(S('big.a.01')))                    
         self.assertAlmostEqual(
             S('dog.n.01').lch_similarity(S('cat.n.01')), 2.028, places=3
         )
@@ -182,6 +186,12 @@ def test_wordnet_similarities(self):
         )
         self.assertAlmostEqual(S('car.n.01').wup_similarity(S('automobile.v.01')),
                                S('automobile.v.01').wup_similarity(S('car.n.01')))
+        self.assertAlmostEqual(S('big.a.01').wup_similarity(S('dog.n.01')),
+                               S('dog.n.01').wup_similarity(S('big.a.01')))
+        self.assertAlmostEqual(S('big.a.01').wup_similarity(S('long.a.01')),
+                               S('long.a.01').wup_similarity(S('big.a.01')))
+        self.assertAlmostEqual(S('big.a.01').lch_similarity(S('long.a.01')),
+                               S('long.a.01').lch_similarity(S('big.a.01')))
         # Information Content similarities.
         brown_ic = wnic.ic('ic-brown.dat')
         self.assertAlmostEqual(
Repository: nltk/nltk

Issue:
Wrong default value in aline.py
I believe the value of `C_skip` in https://github.com/nltk/nltk/blob/develop/nltk/metrics/aline.py#L51 should be negative. In particular, the value in the original paper seems to be `-10`, not `10` (see https://webdocs.cs.ualberta.ca/~kondrak/papers/thesis.pdf, p. 54).


Discussion:
Opened pull request #2712 
Not sure why but simply changing C_skip to -10 causes issues.
\>\>\> aline.align('tuwθ', 'dentis')
returns
[[('t', 't'), ('u', 'i'), ('w', '-'), ('θ', 's')]]  # Unmatched phonemes of "dentis" should still appear
instead of the expected
[[('t', 'd'), ('u', 'e'), ('w', '-'), ('-', 'n'), ('-', 't'), ('-', 'i'), ('θ', 's')]]

Resolving patch:
diff --git a/nltk/metrics/aline.py b/nltk/metrics/aline.py
--- a/nltk/metrics/aline.py
+++ b/nltk/metrics/aline.py
@@ -47,7 +47,7 @@
 inf = float("inf")
 
 # Default values for maximum similarity scores (Kondrak 2002: 54)
-C_skip = 10  # Indels
+C_skip = -10  # Indels
 C_sub = 35  # Substitutions
 C_exp = 45  # Expansions/compressions
 C_vwl = 5  # Vowel/consonant relative weight (decreased from 10)
@@ -1084,7 +1084,7 @@ def align(str1, str2, epsilon=0):
     :type epsilon: float (0.0 to 1.0)
     :param epsilon: Adjusts threshold similarity score for near-optimal alignments
 
-    :rtpye: list(list(tuple(str, str)))
+    :rtype: list(list(tuple(str, str)))
     :return: Alignment(s) of str1 and str2
 
     (Kondrak 2002: 51)


Test patch:
diff --git a/nltk/test/unit/test_aline.py b/nltk/test/unit/test_aline.py
--- a/nltk/test/unit/test_aline.py
+++ b/nltk/test/unit/test_aline.py
@@ -6,9 +6,7 @@
 
 def test_aline():
     result = aline.align("θin", "tenwis")
-    expected = [
-        [("θ", "t"), ("i", "e"), ("n", "n"), ("-", "w"), ("-", "i"), ("-", "s")]
-    ]
+    expected = [[("θ", "t"), ("i", "e"), ("n", "n")]]
 
     assert result == expected
 
@@ -31,24 +29,13 @@ def test_aline():
             ("w", "w"),
             ("e", "e"),
             ("n", "n"),
-            ("i", "-"),
         ]
     ]
 
     assert result == expected
 
     result = aline.align("tuwθ", "dentis")
-    expected = [
-        [
-            ("t", "d"),
-            ("u", "e"),
-            ("w", "-"),
-            ("-", "n"),
-            ("-", "t"),
-            ("-", "i"),
-            ("θ", "s"),
-        ]
-    ]
+    expected = [[("t", "t"), ("u", "i"), ("w", "-"), ("θ", "s")]]
 
     assert result == expected
Repository: nltk/nltk

Issue:
Error when using nltk.stem.arlstem2 module
I was trying to use the stemming function in arlstem2 object and always found an error that there is no object called adject but, i tried to fix adject and replaced it with adjective in the source code it worked perfectly.

I just wanted to mention that it works for me :)

![SharedScreenshot](https://user-images.githubusercontent.com/64975785/119942357-02522380-bf92-11eb-98ee-0fbfe7d8d5a1.jpg)

Error when using nltk.stem.arlstem2 module
I was trying to use the stemming function in arlstem2 object and always found an error that there is no object called adject but, i tried to fix adject and replaced it with adjective in the source code it worked perfectly.

I just wanted to mention that it works for me :)

![SharedScreenshot](https://user-images.githubusercontent.com/64975785/119942357-02522380-bf92-11eb-98ee-0fbfe7d8d5a1.jpg)



Discussion:

Resolving patch:
diff --git a/nltk/stem/__init__.py b/nltk/stem/__init__.py
--- a/nltk/stem/__init__.py
+++ b/nltk/stem/__init__.py
@@ -30,3 +30,5 @@
 from nltk.stem.wordnet import WordNetLemmatizer
 from nltk.stem.rslp import RSLPStemmer
 from nltk.stem.cistem import Cistem
+from nltk.stem.arlstem import ARLSTem
+from nltk.stem.arlstem2 import ARLSTem2
\ No newline at end of file
diff --git a/nltk/stem/arlstem2.py b/nltk/stem/arlstem2.py
--- a/nltk/stem/arlstem2.py
+++ b/nltk/stem/arlstem2.py
@@ -130,7 +130,7 @@ def stem1(self, token):
             if fm is not None:
                 return fm
             # strip the adjective affixes
-            adj = self.adject(token)
+            adj = self.adjective(token)
             if adj is not None:
                 return adj
             # strip the suffixes that are common to nouns and verbs


Test patch:
diff --git a/nltk/test/stem.doctest b/nltk/test/stem.doctest
--- a/nltk/test/stem.doctest
+++ b/nltk/test/stem.doctest
@@ -75,3 +75,32 @@ The 'english' stemmer is better than the original 'porter' stemmer.
 .. note::
 
     Extra stemmer tests can be found in `nltk.test.unit.test_stem`.
+
+Unit tests for ARLSTem Stemmer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    >>> from nltk.stem.arlstem import ARLSTem
+
+Create a Stemmer instance.
+
+    >>> stemmer = ARLSTem()
+
+Stem a word.
+
+    >>> stemmer.stem('يعمل')
+    'عمل'
+
+Unit tests for ARLSTem2 Stemmer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    >>> from nltk.stem.arlstem2 import ARLSTem2
+
+Create a Stemmer instance.
+
+    >>> stemmer = ARLSTem2()
+
+Stem a word.
+
+    >>> stemmer.stem('يعمل')
+    'عمل'
+
Repository: nltk/nltk

Issue:
Remove outdated names in init.py
Cf #2508 



Discussion:

Resolving patch:
diff --git a/nltk/__init__.py b/nltk/__init__.py
--- a/nltk/__init__.py
+++ b/nltk/__init__.py
@@ -52,7 +52,7 @@
 # Description of the toolkit, keywords, and the project's primary URL.
 __longdescr__ = """\
 The Natural Language Toolkit (NLTK) is a Python package for
-natural language processing.  NLTK requires Python 2.6 or higher."""
+natural language processing.  NLTK requires Python 3.6, 3.7, 3.8, or 3.9."""
 __keywords__ = [
     "NLP",
     "CL",
@@ -70,7 +70,7 @@
 __url__ = "http://nltk.org/"
 
 # Maintainer, contributors, etc.
-__maintainer__ = "Steven Bird, Edward Loper, Ewan Klein"
+__maintainer__ = "Steven Bird"
 __maintainer_email__ = "stevenbird1@gmail.com"
 __author__ = __maintainer__
 __author_email__ = __maintainer_email__
@@ -84,8 +84,10 @@
     "Intended Audience :: Science/Research",
     "License :: OSI Approved :: Apache Software License",
     "Operating System :: OS Independent",
-    "Programming Language :: Python :: 2.6",
-    "Programming Language :: Python :: 2.7",
+    "Programming Language :: Python :: 3.6",
+    "Programming Language :: Python :: 3.7",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9",
     "Topic :: Scientific/Engineering",
     "Topic :: Scientific/Engineering :: Artificial Intelligence",
     "Topic :: Scientific/Engineering :: Human Machine Interfaces",


Test patch:
Repository: nltk/nltk

Issue:
WordNetLemmatizer in nltk.stem module
What's the parameter of WordNetLemmatizer.lemmatize() in nltk.stem module?
Turn to the document, what are the candidate value of the parameter **'pos'**?
![image](https://user-images.githubusercontent.com/62245023/134791412-1ff85ba5-5eb9-4859-a3f1-3b48bdd5a6fa.png)
The default value is 'Noun'. But use the function pos_tag() to get the pos of the word, the value appears to come from several options.


Discussion:
This is indeed not particularly clear from the documentation. 
The `pos` parameter is `NOUN` by default, imported from here:
https://github.com/nltk/nltk/blob/277711ab1dec729e626b27aab6fa35ea5efbd7e6/nltk/corpus/reader/wordnet.py#L66

With other words, it is `"n"` by default.
Other valid options are `ADJ`, `ADJ_SAT`, `ADV` and `VERB`, which can be imported and used like so:
```python
>>> from nltk.corpus import wordnet as wn
>>> from nltk.stem import WordnetLemmatizer
>>> WordNetLemmatizer().lemmatize("boxing", wn.VERB)
"box"
```
However, feel free to simply use one of `"a", "s", "r", "n", "v"`.

Resolving patch:
diff --git a/nltk/stem/wordnet.py b/nltk/stem/wordnet.py
--- a/nltk/stem/wordnet.py
+++ b/nltk/stem/wordnet.py
@@ -6,8 +6,7 @@
 # URL: <http://nltk.org/>
 # For license information, see LICENSE.TXT
 
-from nltk.corpus import wordnet
-from nltk.corpus.reader.wordnet import NOUN
+from nltk.corpus import wordnet as wn
 
 
 class WordNetLemmatizer:
@@ -31,11 +30,19 @@ class WordNetLemmatizer:
         hardrock
     """
 
-    def __init__(self):
-        pass
-
-    def lemmatize(self, word, pos=NOUN):
-        lemmas = wordnet._morphy(word, pos)
+    def lemmatize(self, word: str, pos: str = wn.NOUN) -> str:
+        """Lemmatize `word` using WordNet's built-in morphy function.
+        Returns the input word unchanged if it cannot be found in WordNet.
+
+        :param word: The input word to lemmatize.
+        :type word: str
+        :param pos: The Part Of Speech tag. Valid options are `"n"` for nouns,
+            `"v"` for verbs, `"a"` for adjectives, `"r"` for adverbs and `"s"`
+            for satellite adjectives.
+        :param pos: str
+        :return: The lemma of `word`, for the given `pos`.
+        """
+        lemmas = wn._morphy(word, pos)
         return min(lemmas, key=len) if lemmas else word
 
     def __repr__(self):


Test patch: