Module maleo.stopword_remover.ArrayDictionary

Expand source code Browse git
class ArrayDictionary(object):
    """description of class."""

    def __init__(self, words=None):
        self.words = {}
        if words:
            self.add_words(words)

    def contains(self, word):
        return word in self.words

    def count(self):
        return len(self.words)

    def add_words(self, words):
        """Add multiple words to the dictionary."""
        self.words = dict(zip(words, words))

    def add(self, word):
        """Add a word to the dictionary."""
        if not word or word.strip() == '':
            return
        self.words[word] = word

Classes

class ArrayDictionary (words=None)

description of class.

Expand source code Browse git
class ArrayDictionary(object):
    """description of class."""

    def __init__(self, words=None):
        self.words = {}
        if words:
            self.add_words(words)

    def contains(self, word):
        return word in self.words

    def count(self):
        return len(self.words)

    def add_words(self, words):
        """Add multiple words to the dictionary."""
        self.words = dict(zip(words, words))

    def add(self, word):
        """Add a word to the dictionary."""
        if not word or word.strip() == '':
            return
        self.words[word] = word

Methods

def add(self, word)

Add a word to the dictionary.

Expand source code Browse git
def add(self, word):
    """Add a word to the dictionary."""
    if not word or word.strip() == '':
        return
    self.words[word] = word
def add_words(self, words)

Add multiple words to the dictionary.

Expand source code Browse git
def add_words(self, words):
    """Add multiple words to the dictionary."""
    self.words = dict(zip(words, words))
def contains(self, word)
Expand source code Browse git
def contains(self, word):
    return word in self.words
def count(self)
Expand source code Browse git
def count(self):
    return len(self.words)