class_docstr: A word stemmer based on the Porter stemming algorithm.
  
  Porter, M. "An algorithm for suffix stripping."
  Program 14.3 (1980): 130-137.
  
  See http://www.tartarus.org/~martin/PorterStemmer/ for the homepage
  of the algorithm.
  
  Martin Porter has endorsed several modifications to the Porter
  algorithm since writing his original paper, and those extensions are
  included in the implementations on his website. Additionally, others
  have proposed further improvements to the algorithm, including NLTK
  contributors. Only below mode is supported currently
  PorterStemmer.NLTK_EXTENSIONS
  
  - Implementation that includes further improvements devised by
    NLTK contributors or taken from other modified implementations
    found on the web.
  
  Parameters
  ----------
      mode: Modes of stemming (Only supports (NLTK_EXTENSIONS) currently)
            default("NLTK_EXTENSIONS")
  
  Examples
  --------
  
  .. code-block:: python
  
      >>> import cudf
      >>> from cuml.preprocessing.text.stem import PorterStemmer
      >>> stemmer = PorterStemmer()
      >>> word_str_ser =  cudf.Series(['revival','singing','adjustable'])
      >>> print(stemmer.stem(word_str_ser))
      0     reviv
      1      sing
      2    adjust
      dtype: object
class_docstr_tok: ["A","word","stemmer","based","on","the","Porter","stemming","algorithm",".","Porter",",","M.","``","An","algorithm","for","suffix","stripping",".","''","Program","14.3","(","1980",")",":","130-137",".","See","http",":","\/\/www.tartarus.org\/~martin\/PorterStemmer\/","for","the","homepage","of","the","algorithm",".","Martin","Porter","has","endorsed","several","modifications","to","the","Porter","algorithm","since","writing","his","original","paper",",","and","those","extensions","are","included","in","the","implementations","on","his","website",".","Additionally",",","others","have","proposed","further","improvements","to","the","algorithm",",","including","NLTK","contributors",".","Only","below","mode","is","supported","currently","PorterStemmer.NLTK_EXTENSIONS","-","Implementation","that","includes","further","improvements","devised","by","NLTK","contributors","or","taken","from","other","modified","implementations","found","on","the","web",".","Parameters","--","--","--","--","--","mode",":","Modes","of","stemming","(","Only","supports","(","NLTK_EXTENSIONS",")","currently",")","default","(","``","NLTK_EXTENSIONS","''",")","Examples","--","--","--","--","..","code-block",":",":","python",">",">",">","import","cudf",">",">",">","from","cuml.preprocessing.text.stem","import","PorterStemmer",">",">",">","stemmer","=","PorterStemmer","(",")",">",">",">","word_str_ser","=","cudf.Series","(","[","'revival","'",",","'singing","'",",","'adjustable","'","]",")",">",">",">","print","(","stemmer.stem","(","word_str_ser",")",")","0","reviv","1","sing","2","adjust","dtype",":","object"]
docstr: Implements Step 5a from "An algorithm for suffix stripping"
  
  From the paper:
  
  Step 5a
  
      (m>1) E     ->                  probate        ->  probat
                                      rate           ->  rate
      (m=1 and not *o) E ->           cease          ->  ceas
docstr_tok: ["Implements","Step","5a","from","``","An","algorithm","for","suffix","stripping","''","From","the","paper",":","Step","5a","(","m",">","1",")","E","-",">","probate","-",">","probat","rate","-",">","rate","(","m=1","and","not","*","o",")","E","-",">","cease","-",">","ceas"]
code: def _step5a(self, word_str_ser, can_replace_mask=None):
      """Implements Step 5a from "An algorithm for suffix stripping"
  
      From the paper:
  
      Step 5a
  
          (m>1) E     ->                  probate        ->  probat
                                          rate           ->  rate
          (m=1 and not *o) E ->           cease          ->  ceas
      """
  
      can_replace_mask = build_can_replace_mask(
          len_mask=len(word_str_ser), mask=can_replace_mask
      )
      # Note that Martin's test vocabulary and reference
      # implementations are inconsistent in how they handle the case
      # where two rules both refer to a suffix that matches the word
      # to be stemmed, but only the condition of the second one is
      # true.
      # Earlier in step2b we had the rules:
      #     (m>0) EED -> EE
      #     (*v*) ED  ->
      # but the examples in the paper included "feed"->"feed", even
      # though (*v*) is true for "fe" and therefore the second rule
      # alone would map "feed"->"fe".
      # However, in THIS case, we need to handle the consecutive rules
      # differently and try both conditions (obviously; the second
      # rule here would be redundant otherwise). Martin's paper makes
      # no explicit mention of the inconsistency; you have to infer it
      # from the examples.
      # For this reason, we can't use _apply_rule_list here.
  
      ##
  
      # logic is equivalent to below
      # if word.endswith('e'):
      #  stem = self._replace_suffix(word, 'e', '')
      #  if self._measure(stem) > 1:
      #      return stem  rule_1
      #  if self._measure(stem) == 1 and not self._ends_cvc(stem):
      #      return stem  rule_2
      #
  
      e_suffix_flag = ends_with_suffix(word_str_ser, "e")
      stem = replace_suffix(
          word_str_ser, "e", "", e_suffix_flag & can_replace_mask
      )
  
      measure_gt_1_flag = measure_gt_n(stem, 1)
  
      # if self._measure(stem) > 1:
      rule_1_flag = measure_gt_1_flag
  
      # if measure==1 and not self._ends_cvc(stem):
      measure_eq_1_flag = measure_eq_n(stem, 1)
      does_not_ends_with_cvc_flag = ~ends_cvc(stem)
      rule_2_flag = measure_eq_1_flag & does_not_ends_with_cvc_flag
  
      overall_rule_flag = (
          (rule_1_flag | rule_2_flag) & e_suffix_flag & can_replace_mask
      )
  
      return replace_suffix(word_str_ser, "e", "", overall_rule_flag)
  
imports: from .porter_stemmer_utils.measure_utils import has_positive_measure, measure_gt_n, measure_eq_n
  from .porter_stemmer_utils.len_flags_utils import len_eq_n, len_gt_n
  from .porter_stemmer_utils.consonant_vowel_utils import contains_vowel, is_consonant
  from .porter_stemmer_utils.porter_stemmer_rules import ends_with_suffix, ends_with_double_constant, last_char_not_in, last_char_in, ends_cvc
  from .porter_stemmer_utils.suffix_utils import get_stem_series, get_str_replacement_series, replace_suffix
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 9 for calling the PorterStemmer obj's underlying member method code with example usage: obj._step5a(word_str_ser, can_replace_mask) and returns: replace_suffix