Skip to content
Permalink
Browse files

Mengubah dictionary dari list ke dictionary

Mengubah dictionary dari list ke dictionary
  • Loading branch information...
sanspa authored and har07 committed Sep 23, 2018
1 parent c784cd7 commit b31d6f67c24ee78d76d5095d405433f9cc774603
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/Sastrawi/Dictionary/ArrayDictionary.py
@@ -2,7 +2,7 @@ class ArrayDictionary(object):
"""description of class"""

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

@@ -14,14 +14,13 @@ def count(self):

def add_words(self, words):
"""Add multiple words to the dictionary"""
for word in words:
self.add(word)
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.append(word)
self.words[word]=word



0 comments on commit b31d6f6

Please sign in to comment.
You can’t perform that action at this time.