'''
Created on Oct 9, 2013

@author: taochen
'''

class Dictionary:
    '''
    
    Attributes:
        docs: A list of docs where each item is a list of words.
        id_word: dict<id: word>
        word_id: dict<word: id>
        
    '''

    def __init__(self):
        self.docs = dict()
        self.id_word = dict()
        self.word_id = dict()
    
    def load_file(self, file_path):
        """Load the documents into a list of docs.
        Args:
            file_path: The file path of documents.
        Returns:
            self.docs.
        """
        
    def process_word(self, word):
        """Stem word and filter out non-meaningful word (e.g., stop words).
        Consider use: https://pypi.python.org/pypi/stemming/1.0 or
                      http://text-processing.com/demo/stem/
     
        Args:
            word: the word to be processed
        Returns:
            A bool value indicate whether keep this word or not, and the processed word.
        """
        
    def cut_low_freq(self, docs, min_freq=1):
        """Filter out rare words that occur less than min_freq."""
    
    def word_to_id(self, word):
        """Return the id of the query word."""
    
    def id_to_word(self, word_id):
        """Return the word of the query id."""
        
    def doc_to_ids(self, doc):
        
        
        
@@ -37,17 +37,25 @@
  taochen
+, yiping
 %0A
-
 '''%0A%0Acla
@@ -273,35 +273,8 @@
 f):%0A
-        self.docs = dict()%0A
     
@@ -538,32 +538,479 @@
     %22%22%22%0A        
+f = open(file_path, %22r%22)%0A        sentences = f.readlines()%0A %0A        word_count = 0%0A%0A        for sentence in sentence:  %0A            for word in sentence.strip().split(%22 %22):%0A                if not (word in self.word_id):  #word not in dictionary%0A                    word_id%5Bword%5D = word_count%0A                    word_count += 1%0A%0A        #self.doc = %5B%5Bself.word_id%5Bword%5D for word in sentence.strip().split(%22 %22)%5D for sentence in sentences%5D%0A%0A    '''
 %0A    def process
@@ -1753,26 +1753,47 @@
     
+'''
     %0A
-     
+#end of class dictionary
    
-%0A
         
@@ -1784,16 +1784,17 @@
 onary           
+%0A

add simple method to dictionary