diff --git a/README b/README
new file mode 100644
index 000000000..e69de29bb
diff --git a/nltk/stem/porter.py b/nltk/stem/porter.py
index cb04f5213..c20e14f91 100644
--- a/nltk/stem/porter.py
+++ b/nltk/stem/porter.py
@@ -648,17 +648,21 @@ class PorterStemmer(StemmerI):
             word, [("ll", "l", lambda stem: self._measure(word[:-1]) > 1)]
         )
 
-    def stem(self, word):
-        stem = word.lower()
+    def stem(self, word, to_lowercase=True):
+        """
+        :param to_lowercase: if `to_lowercase=True` the word always lowercase
+        """
+        stem = word.lower() if to_lowercase else word
 
         if self.mode == self.NLTK_EXTENSIONS and word in self.pool:
-            return self.pool[word]
+            return self.pool[stem]
 
         if self.mode != self.ORIGINAL_ALGORITHM and len(word) <= 2:
             # With this line, strings of length 1 or 2 don't go through
             # the stemming process, although no mention is made of this
             # in the published algorithm.
-            return word
+            return stem
+
 
         stem = self._step1a(stem)
         stem = self._step1b(stem)

Porter stemmer returns a capital instead of lowercase 
This output is unexpected. The `In` returns the capitalize `In` from PorterStemmer's output.

```python
>>> from nltk.stem import PorterStemmer
>>> porter = PorterStemmer()
>>> porter.stem('In')
'In'
```

More details on https://stackoverflow.com/q/60387288/610569
diff --git a/nltk/test/unit/test_stem.py b/nltk/test/unit/test_stem.py
index 52a0d6652..f578c1f66 100644
--- a/nltk/test/unit/test_stem.py
+++ b/nltk/test/unit/test_stem.py
@@ -143,3 +143,16 @@ class PorterTest(unittest.TestCase):
         Ensures that 'oed' can be stemmed without throwing an error.
         """
         assert PorterStemmer().stem('oed') == 'o'
+
+
+    def test_lowercase_option(self):
+        """Test for improvement on https://github.com/nltk/nltk/issues/2507
+
+        Ensures that stems are lowercased when `to_lowercase=True`
+        """
+        porter = PorterStemmer()
+        assert porter.stem('On') == 'on'
+        assert porter.stem('I') == 'i'
+        assert porter.stem('I', to_lowercase=False) == 'I'
+        assert porter.stem('Github') == 'github'
+        assert porter.stem('Github', to_lowercase=False) == 'Github'

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
click==8.1.8
cycler==0.11.0
exceptiongroup==1.2.2
fonttools==4.38.0
gensim==4.2.0
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
joblib==1.3.2
kiwisolver==1.4.5
matplotlib==3.5.3
-e git+https://github.com/nltk/nltk.git@750e488569b6f80c72ae6ca74eff90eae55e6c4e#egg=nltk
numpy==1.21.6
oauthlib==3.2.2
packaging==24.0
Pillow==9.5.0
pluggy==1.2.0
pyparsing==3.1.4
pytest==7.4.4
python-crfsuite==0.9.10
python-dateutil==2.9.0.post0
regex==2024.4.16
requests==2.31.0
requests-oauthlib==2.0.0
scikit-learn==1.0.2
scipy==1.7.3
six==1.17.0
smart-open==7.1.0
threadpoolctl==3.1.0
tomli==2.0.1
tqdm==4.67.1
twython==3.9.1
typing_extensions==4.7.1
urllib3==2.0.7
wrapt==1.16.0
zipp==3.15.0

name: nltk
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==3.4.1
      - click==8.1.8
      - cycler==0.11.0
      - exceptiongroup==1.2.2
      - fonttools==4.38.0
      - gensim==4.2.0
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - joblib==1.3.2
      - kiwisolver==1.4.5
      - matplotlib==3.5.3
      - numpy==1.21.6
      - oauthlib==3.2.2
      - packaging==24.0
      - pillow==9.5.0
      - pluggy==1.2.0
      - pyparsing==3.1.4
      - pytest==7.4.4
      - python-crfsuite==0.9.10
      - python-dateutil==2.9.0.post0
      - regex==2024.4.16
      - requests==2.31.0
      - requests-oauthlib==2.0.0
      - scikit-learn==1.0.2
      - scipy==1.7.3
      - six==1.17.0
      - smart-open==7.1.0
      - threadpoolctl==3.1.0
      - tomli==2.0.1
      - tqdm==4.67.1
      - twython==3.9.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - wrapt==1.16.0
      - zipp==3.15.0
prefix: /opt/conda/envs/nltk

nltk/test/unit/test_stem.py::PorterTest::test_lowercase_option
nltk/test/unit/test_stem.py::SnowballTest::test_arabic nltk/test/unit/test_stem.py::SnowballTest::test_german nltk/test/unit/test_stem.py::PorterTest::test_vocabulary_martin_mode nltk/test/unit/test_stem.py::PorterTest::test_vocabulary_nltk_mode nltk/test/unit/test_stem.py::PorterTest::test_vocabulary_original_mode
nltk/test/unit/test_stem.py::SnowballTest::test_russian nltk/test/unit/test_stem.py::SnowballTest::test_short_strings_bug nltk/test/unit/test_stem.py::SnowballTest::test_spanish nltk/test/unit/test_stem.py::PorterTest::test_oed_bug
nltk/stem/porter.py README
nltk/stem/porter.py README