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 1c from "An algorithm for suffix stripping"
  
  From the paper:
  
  Step 1c
  
      (*v*) Y -> I                    happy        ->  happi
                                      sky          ->  sky
docstr_tok: ["Implements","Step","1c","from","``","An","algorithm","for","suffix","stripping","''","From","the","paper",":","Step","1c","(","*","v","*",")","Y","-",">","I","happy","-",">","happi","sky","-",">","sky"]
code: def _step1c(self, word_str_ser, can_replace_mask=None):
      """Implements Step 1c from "An algorithm for suffix stripping"
  
      From the paper:
  
      Step 1c
  
          (*v*) Y -> I                    happy        ->  happi
                                          sky          ->  sky
      """
      can_replace_mask = build_can_replace_mask(
          len_mask=len(word_str_ser), mask=can_replace_mask
      )
  
      def nltk_condition(stem):
          """
          This has been modified from the original Porter algorithm so
          that y->i is only done when y is preceded by a consonant,
          but not if the stem is only a single consonant, i.e.
  
          (*c and not c) Y -> I
  
          So 'happy' -> 'happi', but
          'enjoy' -> 'enjoy'  etc
  
          This is a much better rule. Formerly 'enjoy'->'enjoi' and
          'enjoyment'->'enjoy'. Step 1c is perhaps done too soon; but
          with this modification that no longer really matters.
  
          Also, the removal of the contains_vowel(z) condition means
          that 'spy', 'fly', 'try' ... stem to 'spi', 'fli', 'tri' and
          conflate with 'spied', 'tried', 'flies' ...
          """
  
          # equivalent to
          # len(stem) > 1 and self._is_consonant(stem, len(stem) - 1)
          len_gt_1_mask = len_gt_n(stem, 1)
          last_char_is_consonant_mask = is_consonant(stem, -1)
          return len_gt_1_mask & last_char_is_consonant_mask
  
      def original_condition(stem):
          return contains_vowel(stem)
  
      return apply_rule_list(
          word_str_ser,
          [
              (
                  "y",
                  "i",
                  nltk_condition
                  if self.mode == "NLTK_EXTENSIONS"
                  else original_condition,
              )
          ],
          can_replace_mask,
      )[0]
  
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 5 for calling the PorterStemmer obj's underlying member method code with example usage: obj._step1c(word_str_ser, can_replace_mask) and returns: apply_rule_list, unknown, contains_vowel