Home > brede > brede_str_ngram.m

brede_str_ngram

PURPOSE ^

brede_str_ngram - N-gram

SYNOPSIS ^

function varargout = brede_str_ngram(S, varargin)

DESCRIPTION ^

 brede_str_ngram      - N-gram 

       function [G, chr] = brede_str_ngram(S, 'PropertyName',
           'PropertyValue' )
       function M = brede_str_ngram(S, 'PropertyName',
           'PropertyValue') 

       Input:    S     String or cell of strings

       Property: Chars {['a':'z' ' ']} Characters to include in
                       the construction of the N-gram 
                 Info  [ 0 | Integer ] Amount of information
                 N     [ 1 | {2} | 3 ] Length of the N-gram
 
       Output:   G     N-gram matrix
                 char  Characters
                 M     'Mat' structure with N-gram matrix

       This function produces a character N-gram matrix from a string
       or a set of strings. The variation of the N-grams will be in
       the columns and the rows will correspond to the input strings.

       N=1 will product a unigram for character - just counting the
       occurence of each character. N=2 will make a character bigram
       count. 

       Example:
         % Example strings
         S = { 'hippocampus' 'ppp' };

         % Construct unigram matrix
         M = brede_str_ngram(S, 'N', 1);
         brede_ui_mat(M)

         % Construct bigram matrix
         M = brede_str_ngram(S, 'N', 2);
         brede_ui_mat(M)

       See also BREDE, BREDE_STR, BREDE_STR_SPLIT, BREDE_STR_STR2MAT.

 $Id: brede_str_ngram.m,v 1.5 2007/08/10 15:34:32 fn Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 27-Nov-2009 18:11:22 by m2html © 2005