stemmer

package module
Version: v0.0.0-...-c9f2ce1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2017 License: MIT Imports: 2 Imported by: 4

README

stemmer

A library in golang that implements the PorterStemmer algorithm for stemming words.

usage

package main

import "github.com/caneroj1/stemmer"

func main() {
  str := "running"

  // stem a single word
  stem := stemmer.Stem(str)

  // stem = RUN

  strings := []string{
    "playing",
    "skies",
    "singed",
  }

  // stem a list of words
  stems := stemmer.StemMultiple(strings)

  // stems = [PLAI SKI SIN]

  // stem a list of words in place, modifying the original slice
  stemmer.StemMultipleMutate(strings)
  
  // strings = [PLAI SKI SIN]
  
  // stem a list of words concurrently. this also stems in place, modifying
  // the original slice.
  // NOTE: the order of the strings is not guaranteed to be the same.
  stemmer.StemConcurrent(strings)

  // strings = [PLAI SKI SIN]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stem

func Stem(input string) string

Stem is the entry function into the stemmer. We check to make sure the word isn't too short, and then we convert it to all uppercase

func StemConcurrent

func StemConcurrent(words *[]string)

StemConcurrent accepts a pointer to a slice of strings and stems them in place. It tries to offload the work into multiple threads. It makes no guarantees about the order of the stems in the modified slice.

func StemMultiple

func StemMultiple(words []string) (output []string)

StemMultiple accepts a slice of strings and stems each of them.

func StemMultipleMutate

func StemMultipleMutate(words *[]string)

StemMultipleMutate accepts a pointer to a slice of strings and stems them in place. It modifies the original slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL