(self, ngram, separator=',', expandSubPaths = True, pathFrequency = None)
Adds the path(s) of a single n-gram to the path statistics object.

        @param ngram: An ngram representing a path between nodes, separated by the separator character, e.g. 
            the 4-gram a;b;c;d represents a path of length three (with separator ';')

        @param separator: The character used as separator for the ngrams (',' by default)

        @param expandSubPaths: by default all subpaths of the given ngram are generated, i.e. 
            for the trigram a;b;c a path a->b->c of length two will be generated 
            as well as two subpaths a->b and b->c of length one

        @weight pathFrequency: the number of occurrences (i.e. frequency) of the ngram
Adds the path(s) of a single n-gram to the path statistics object.
Adds the path ( s ) of a single n - gram to the path statistics object .
def addPath(self, ngram, separator=',', expandSubPaths = True, pathFrequency = None):
        """
        Adds the path(s) of a single n-gram to the path statistics object.

        @param ngram: An ngram representing a path between nodes, separated by the separator character, e.g. 
            the 4-gram a;b;c;d represents a path of length three (with separator ';')

        @param separator: The character used as separator for the ngrams (',' by default)

        @param expandSubPaths: by default all subpaths of the given ngram are generated, i.e. 
            for the trigram a;b;c a path a->b->c of length two will be generated 
            as well as two subpaths a->b and b->c of length one

        @weight pathFrequency: the number of occurrences (i.e. frequency) of the ngram
        """

        fields = ngram.rstrip().split(separator)
        path = ()        
        for i in range(0, len(fields)):
            path += (fields[i],)

        # add the occurrences as *longest* path to the second component of the numpy array
        if pathFrequency != None:
            self.paths[len(path)-1][path] += (0, pathFrequency)
        else:
            self.paths[len(path)-1][path] += (0, 1)

        if expandSubPaths:
            for k in range(0, len(path)-1):
                for s in range(len(path)-k):
                    # for all start indices from 0 to n-k

                    subpath = ()
                    # construct subpath
                    for i in range(s, s+k+1):
                        subpath += (path[i],)
                    # add subpath weight to first component of occurrences
                    if pathFrequency != None:                        
                        self.paths[k][subpath] += (pathFrequency, 0)
                    else:
                        self.paths[k][subpath] += (1, 0)
def addPath ( self , ngram , separator = ',' , expandSubPaths = True , pathFrequency = None ) : fields = ngram . rstrip ( ) . split ( separator ) path = ( ) for i in range ( 0 , len ( fields ) ) : path += ( fields [ i ] , ) # add the occurrences as *longest* path to the second component of the numpy array if pathFrequency != None : self . paths [ len ( path ) - 1 ] [ path ] += ( 0 , pathFrequency ) else : self . paths [ len ( path ) - 1 ] [ path ] += ( 0 , 1 ) if expandSubPaths : for k in range ( 0 , len ( path ) - 1 ) : for s in range ( len ( path ) - k ) : # for all start indices from 0 to n-k subpath = ( ) # construct subpath for i in range ( s , s + k + 1 ) : subpath += ( path [ i ] , ) # add subpath weight to first component of occurrences if pathFrequency != None : self . paths [ k ] [ subpath ] += ( pathFrequency , 0 ) else : self . paths [ k ] [ subpath ] += ( 1 , 0 )