matchzoo.preprocessors.units.stop_removal

Module Contents

class matchzoo.preprocessors.units.stop_removal.StopRemoval(lang:str='english')

Bases: matchzoo.preprocessors.units.unit.Unit

Process unit to remove stop words.

Example

>>> unit = StopRemoval()
>>> unit.transform(['a', 'the', 'test'])
['test']
>>> type(unit.stopwords)
<class 'list'>
stopwords

Get stopwords based on language.

Params lang:language code.
Returns:list of stop words.
transform(self, input_:list)

Remove stopwords from list of tokenized tokens.

Parameters:
  • input – list of tokenized tokens.
  • lang – language code for stopwords.
Return tokens:

list of tokenized tokens without stopwords.