Step 5: Residual form.

This step should always be performed.

@param  {Token} token Token to stem.
@return {Token}       Stemmed token.
541847
function residualForm (token$$1) {

                var tokenString = token$$1.string;

                if (token$$1.hasSuffix('gue') || token$$1.hasSuffix('gué') || token$$1.hasSuffix('guê')) {
                  token$$1.replaceSuffixInRegion(['ue', 'ué', 'uê'], '', 'rv');
                }

                if (token$$1.hasSuffix('cie') || token$$1.hasSuffix('cié') || token$$1.hasSuffix('ciê')) {
                  token$$1.replaceSuffixInRegion(['ie', 'ié', 'iê'], '', 'rv');
                }

                if (tokenString === token$$1.string) {
                  token$$1.replaceSuffixInRegion(['e', 'é', 'ê'], '', 'rv');
                }

                token$$1.replaceSuffixInRegion('ç', 'c', 'all');

                return token$$1;
              }
989352
function(source) {
			// transform tokens
			var tokens = this.lex(source), pos = 0, token;
			for (var i = 0, il = tokens.length; i < il; i++) {
				token = tokens[i];
				token.start = pos;
				token.end = (pos += token.value.length);
			}
			return tokens;
		}
161391
function step1a$1(token) {
                var r1 = getR1(token);

                if (!r1) {
                    return token;
                }

                var r1Match = r1.match(/(a|e|ede|ande|ende|ane|ene|hetene|en|heten|ar|er|heter|as|es|edes|endes|enes|hetenes|ens|hetens|ers|ets|et|het|ast)$/);

                if (r1Match) {
                    return token.replace(new RegExp(r1Match[1] + '$'), '');
                }

                return token;
            }
1247384
function step2$1(token) {
                var r1 = getR1(token);

                if (!r1) {
                    return token;
                }

                if (r1.match(/(d|v)t$/)) {
                    return token.slice(0, -1);
                }

                return token;
            }
288056
function ast (tokens) {
  let token = tokens[0]

  const state = {
    content: []
  }

  let current = state
  let active = current
  const stack = []
  let lineStackSize = 0 // when inline entities are used this gets incremented so that when you
  // go onto a new line we can go back to the correct location in the stack

  const l = tokens.length
  let i = 0
  let absoluteIndent = 0
  let currentIndent = 0
  let extraIndent = 0
  let prevWasType = false
  let nextParamsAreEscaped = false
  let prevParamsWereEscaped = false
  const emptyLines = []
  let handlingInlineContent = false // true when between an START_INLINE_CONTENT and END_INLINE_CONTENT
  /*
    notCreatedInlineContent
    This is true when the inline content entry has not yet been created in the parsed
    content (which is done for the first content encountered between START_INLINE_CONTENT
    and END_INLINE_CONTENT)
  */
  let notCreatedInlineContent = true

  while (i < l) {
    token = tokens[i]
    if (token.type === 'TYPE') {
      if (token.value === '') {
        nextParamsAreEscaped = true
      } else {
        prevWasType = true

        active = {
          type: token.value,
          params: [],
          content: []
        }

        while (emptyLines.length) {
          current.content.push(emptyLines.pop())
        }

        current.content.push(active)
      }
    } else if (token.type === 'PARAMS') {
      if (nextParamsAreEscaped) {
        if (active.content.length > 0) {
          active.content[active.content.length - 1] += token.value
        } else {
          active.content.push(token.value)
        }
        nextParamsAreEscaped = false
        prevParamsWereEscaped = true
      } else {
        active.params = splitParams(token.value)
      }
    } else if (token.type === 'CONTENT') {
      if (prevParamsWereEscaped) {
        active.content[active.content.length - 1] += token.value
        prevParamsWereEscaped = false
      } else if (token.value === '') {
        emptyLines.push(token.value)
      } else {
        while (emptyLines.length) {
          current.content.push(emptyLines.pop())
        }

        prevWasType = false

        if (handlingInlineContent) {
          if (notCreatedInlineContent) {
            current.content.push(token.value)
            notCreatedInlineContent = false
          } else {
            current.content[current.content.length - 1] += ' ' + token.value
          }
        } else {
          let ex = ''
          for (let k = 0; k < extraIndent; k++) {
            ex += ' '
          }
          current.content.push(ex + token.value)
        }
      }
    } else if (token.type === 'EMPTY_CONTENT') {
      emptyLines.push(token.value)
    } else if (token.type === 'START_SAME_LINE_CONTENT') {
      lineStackSize++
      stack.push(current)
      current = active
    } else if (token.type === 'END_SAME_LINE_CONTENT') {
      // keep the active as it is, even though the current is being droped back a couple of levels
      // this is so that you can do @one: @two: @three\n @four, and have @four be a child of @three (not @one)
      active = current

      // drop back down the stack until you reach where we were at the start of the line
      while (lineStackSize) {
        current = stack.pop()
        lineStackSize--
      }
      prevWasType = true
    } else if (token.type === 'START_INLINE_CONTENT') {
      handlingInlineContent = true
      notCreatedInlineContent = true
      lineStackSize++
      stack.push(current)
      current = active
    } else if (token.type === 'END_INLINE_CONTENT') {
      handlingInlineContent = false
      active = current
      current = stack.pop()
      lineStackSize--
      prevWasType = true
    } else if (token.type === 'INDENT') {
      stack.push(current)
      current = active
      absoluteIndent += token.value

      if (prevWasType) {
        currentIndent = absoluteIndent
      }

      extraIndent = absoluteIndent - currentIndent
    } else if (token.type === 'DEDENT') {
      current = stack.pop()
      active = current
      absoluteIndent -= token.value

      if (extraIndent > 0) {
        extraIndent -= token.value
      } else {
        currentIndent = absoluteIndent
      }
    }
    i++
  }

  return state.content
}
677037
public function stem($token) 
    {
        if(array_key_exists($token, $this->dictionary)){
            return $this->dictionary[$token];
        }
        return $token;
    }
610202
def triggered_token(self) -> 'CancelToken':
        
        if self._triggered.is_set():
            return self
        for token in self._chain:
            if token.triggered:
                # Use token.triggered_token here to make the lookup recursive as self._chain may
                # contain other chains.
                return token.triggered_token
        return None
218224
function process_raw(token) {
	var token = escapeRegex(token);
	return {
		type: "raw",
		piece: token + "/",
		last: token + "/?"
	};
}
930111
function stem(tree, depth) {
  // First we break out the tree into a complete list of root to leaf paths
  var paths = rootToLeaf(tree);
  var stemmedRevs;

  var result;
  for (var i = 0, len = paths.length; i < len; i++) {
    // Then for each path, we cut off the start of the path based on the
    // `depth` to stem to, and generate a new set of flat trees
    var path = paths[i];
    var stemmed = path.ids;
    var node;
    if (stemmed.length > depth) {
      // only do the stemming work if we actually need to stem
      if (!stemmedRevs) {
        stemmedRevs = {}; // avoid allocating this object unnecessarily
      }
      var numStemmed = stemmed.length - depth;
      node = {
        pos: path.pos + numStemmed,
        ids: pathToTree(stemmed, numStemmed)
      };

      for (var s = 0; s < numStemmed; s++) {
        var rev = (path.pos + s) + '-' + stemmed[s].id;
        stemmedRevs[rev] = true;
      }
    } else { // no need to actually stem
      node = {
        pos: path.pos,
        ids: pathToTree(stemmed, 0)
      };
    }

    // Then we remerge all those flat trees together, ensuring that we dont
    // connect trees that would go beyond the depth limit
    if (result) {
      result = doMerge(result, node, true).tree;
    } else {
      result = [node];
    }
  }

  // this is memory-heavy per Chrome profiler, avoid unless we actually stemmed
  if (stemmedRevs) {
    traverseRevTree(result, function (isLeaf, pos, revHash) {
      // some revisions may have been removed in a branch but not in another
      delete stemmedRevs[pos + '-' + revHash];
    });
  }

  return {
    tree: result,
    revs: stemmedRevs ? Object.keys(stemmedRevs) : []
  };
}
1291759
function step1c(token) {
    var r1 = getR1(token);

    if (!r1) {
        return token;
    }

    if (r1.match(/(erte|ert)$/)) {
        return token.replace(/(erte|ert)$/, 'er');
    }

    return token;
}
506378
function stripToken(val, exp) {
    exp = exp || constants_2.TOKEN_ANY_EXP;
    return val.trim().replace(exp, '');
}
411099
public function stem($token) 
    {
        if(strlen($token) < $this->minimumTokenLength) {
            return $token;
        }        
        return preg_replace("/".$this->regexExpression."/i", '', $token);        
    }
713379
function customFragment (token, tokens) {
  let escaping = false
  let fragment = ''
  token = tokens.shift() // remove opened {
  while (true) {
    if (!token) {
      throw new Error('A custom fragment requires "}" to terminate')
    }
    if (escaping) {
      if (includes('{}', token)) {
        fragment += token
      } else {
        fragment += `\\${token}`
      }
      escaping = false
    } else if (token === '\\') {
      escaping = true
    } else if (token === '}') {
      break
    } else {
      fragment += token
    }
    token = tokens.shift()
  }
  return { _type: customFragment.name, fragment }
}
572574
private static void processToken( String token, Stack<String> stack, Properties props )
    {
        if( "}".equals( token ) )
        {
            String name = stack.pop();
            String open = stack.pop();
            if( "${".equals( open ) )
            {
                startProperty( name, props, stack );
            }
            else
            {
                push( stack, "${" + name + "}" );
            }
        }
        else
        {
            if( "$".equals( token ) )
            {
                stack.push( "$" );
            }
            else
            {
                push( stack, token );
            }
        }
    }
297259
private Token token(Token prev) {
    if (curChar == EOF) {
      return null;
    }
    if (curChar == '{') {
      char nextChar = lookahead();
      if (nextChar == '{') {
        return leftCurlyBracket(prev);
      } else if (nextChar >= 'a' && nextChar <= 'z') {
        return key(prev);
      } else {
        throw new IllegalArgumentException(
            "Unexpected first character '" + nextChar + "'; must be lower case a-z.");
      }
    }
    return text(prev);
  }
189904
function tokenStackLex() {
    var token;
    token = tstack.pop() || lexer.lex() || EOF;
    // if token isn't its numeric value, convert
    if (typeof token !== 'number') {
        if (token instanceof Array) {
            tstack = token;
            token = tstack.pop();
        }
        token = self.symbols_[token] || token;
    }
    return token;
}
264564
function (header, prevToken) {
        var options = this.options;

        if (header.depth > options.maxDepth) return;

        var headerText = utils.getHeader(header.text, prevToken);

        if (!headerText) return;

        var anchor = this._getAnchor(header.text, prevToken),
            indent = utils.getIndent(this._usedHeaders, header.depth);

        this._usedHeaders.unshift({
            depth: header.depth,
            indent: indent
        });

        this.data += indent + options.bullet + ' [' + headerText.replace(/\\/g, '\\\\') + '](#' + anchor + ')' + EOL;
    }