vector_space_model/Int/VSM-master/vsm.py
def initialize_terms_and_postings():
    """Reads in each document in document_filenames, splits it into a
    list of terms (i.e., tokenizes it), adds new terms to the global
    dictionary, and adds the document to the posting list for each
    term, with value equal to the frequency of the term in the
    document."""
    global dictionary, postings
    for id in document_filenames:
        f = open(document_filenames[id],'r')
        document = f.read()
        f.close()
        terms = tokenize(document)
        unique_terms = set(terms)
        dictionary = dictionary.union(unique_terms)
        for term in unique_terms:
            postings[term][id] = terms.count(term)
Reads in each document in document_filenames, splits it into a
    list of terms (i.e., tokenizes it), adds new terms to the global
    dictionary, and adds the document to the posting list for each
    term, with value equal to the frequency of the term in the
    document.
Reads in each document in document_filenames, splits it into a
list of terms , adds new terms to the global
dictionary, and adds the document to the posting list for each
term, with value equal to the frequency of the term in the
document.
Reads in each document in document_filenames splits it into a list of terms adds new terms to the global dictionary and adds the document to the posting list for each term with value equal to the frequency of the term in the document .
def initialize_terms_and_postings():
    global dictionary, postings
    for id in document_filenames:
        f = open(document_filenames[id],'r')
        document = f.read()
        f.close()
        terms = tokenize(document)
        unique_terms = set(terms)
        dictionary = dictionary.union(unique_terms)
        for term in unique_terms:
            postings[term][id] = terms.count(term)
def initialize_terms_and_postings ( ) : global dictionary , postings for id in document_filenames : f = open ( document_filenames [ id ] , 'r' ) document = f . read ( ) f . close ( ) terms = tokenize ( document ) unique_terms = set ( terms ) dictionary = dictionary . union ( unique_terms ) for term in unique_terms : postings [ term ] [ id ] = terms . count ( term )
Reads in each document in document_filenames, splits it into a
list of terms (i.e., tokenizes it), adds new terms to the global
dictionary, and adds the document to the posting list for each
term, with value equal to the frequency of the term in the
document.
Reads in each document in document_filenames splits it into a list of terms ( i . e . tokenizes it ) adds new terms to the global dictionary and adds the document to the posting list for each term with value equal to the frequency of the term in the document .
"""Reads in each document in document_filenames, splits it into a
    list of terms (i.e., tokenizes it), adds new terms to the global
    dictionary, and adds the document to the posting list for each
    term, with value equal to the frequency of the term in the
    document."""