# Porter2 Stemmer is just the Porter Stemmer?

**URL:** <https://discuss.elastic.co/t/porter2-stemmer-is-just-the-porter-stemmer/9856>\
**Category:** Elasticsearch\
**Created:** [November 28, 2012, 6:24am UTC](https://discuss.elastic.co/t/porter2-stemmer-is-just-the-porter-stemmer/9856 "2012-11-28T06:24:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Sander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_sander/32/838_2.png) [@Michael\_Sander](https://discuss.elastic.co/u/Michael_Sander)\
**Post date:** [November 28, 2012, 6:24am UTC](https://discuss.elastic.co/t/porter2-stemmer-is-just-the-porter-stemmer/9856/1 "2012-11-28T06:24:27Z")

</div>

The documentation for the "Stemmer" filter indicates that porter2 is an  
available option:  
[http://www.elasticsearch.org/guide/reference/index-modules/analysis/stemmer-tokenfilter.html](http://www.elasticsearch.org/guide/reference/index-modules/analysis/stemmer-tokenfilter.html)

However, I think there may be a bug here because I think "porter2" may just  
map to the porter stemmer. I tried stemming a word both on the porter and  
porter2 stemmers. Both stemmed the word "stayed" to "stai". That is the  
correct result for the porter stemmer, but it is the incorrect result for  
the porter2 stemmer. I verified this using the python stemmer library.  
According to that library, porter stems "stayed" to "stai" and porter2  
stems "stayed" to "stay".

So I took a look into the code and I found the following  
in StemmerTokenFilterFactory.java:  
...  
} else if ("porter".equalsIgnoreCase(language)) {  
return new PorterStemFilter(tokenStream);  
} else if ("porter2".equalsIgnoreCase(language)) {  
return new SnowballFilter(tokenStream, new PorterStemmer());  
...

Notice that in both cases a Porter stemmer is instantiated, not a porter2  
stemmer. Any thoughts on why this is not a bug?

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 29, 2012, 1:18am UTC](https://discuss.elastic.co/t/porter2-stemmer-is-just-the-porter-stemmer/9856/2 "2012-11-29T01:18:40Z")

</div>

I agree it looks like a bug. I created an issue for it  
[The Porter2 Stemmer Token Filter is just Porter Stemmer · Issue #2451 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2451) Thanks for  
report.

As a workaround, you can use "english" instead of "porter2" as a filter  
language.

On Wednesday, November 28, 2012 1:24:27 AM UTC-5, Michael Sander wrote:

> The documentation for the "Stemmer" filter indicates that porter2 is an  
> available option:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/analysis/stemmer-tokenfilter.html)
> 
> However, I think there may be a bug here because I think "porter2" may  
> just map to the porter stemmer. I tried stemming a word both on the porter  
> and porter2 stemmers. Both stemmed the word "stayed" to "stai". That is the  
> correct result for the porter stemmer, but it is the incorrect result for  
> the porter2 stemmer. I verified this using the python stemmer library.  
> According to that library, porter stems "stayed" to "stai" and porter2  
> stems "stayed" to "stay".
> 
> So I took a look into the code and I found the following  
> in StemmerTokenFilterFactory.java:  
> ...  
> } else if ("porter".equalsIgnoreCase(language)) {  
> return new PorterStemFilter(tokenStream);  
> } else if ("porter2".equalsIgnoreCase(language)) {  
> return new SnowballFilter(tokenStream, new PorterStemmer());  
> ...
> 
> Notice that in both cases a Porter stemmer is instantiated, not a porter2  
> stemmer. Any thoughts on why this is not a bug?

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:02am UTC](https://discuss.elastic.co/t/porter2-stemmer-is-just-the-porter-stemmer/9856/3 "2017-07-06T03:02:18Z")

</div>


