Package gmisclib :: Module find_ngram
[frames] | no frames]

Module find_ngram

source code

This module lets you search through label files to find particular ngrams.


Version: $Revision: 1.7 $

Functions
 
matches(data, pattern) source code
 
find_mark(ngram, fname, datatype=1)
ngram = list of labels.
source code
 
find_lab(ngram, fname, loose=0)
ngram = list of labels.
source code
 
find(ngram, data)
ngram = list of labels.
source code
Variables
  WildAnyOne = re.compile(r'.')
  __package__ = 'gmisclib'

Imports: re, xwaves_mark, xwaves_lab, DataError, NoSuchFileError, DataOutOfOrderError, BadFileFormatError, Error


Function Details

find_mark(ngram, fname, datatype=1)

source code 

ngram = list of labels. fname = file name for xwaves_mark datafile. datatype = xwaves_mark.PHONE or xwaves_mark.WORD

This function returns all instances (even overlapping instances) of the specified N-gram in the file. The return format is [ (end_time, label), ... ], where the zeroth entry in the list is the symbol before the start of the N-gram. It's end time is the beginning of the N-gram.

In the argument list, the N-gram is an array of labels; the labels need to match the file's labels exactly.

find_lab(ngram, fname, loose=0)

source code 

ngram = list of labels. fname = file name for xwaves_lab datafile.

This function returns all instances (even overlapping instances) of the specified N-gram in the file. The return format is [ (end_time, label), ... ], where the zeroth entry in the list is the symbol before the start of the N-gram. It's end time is the beginning of the N-gram.

In the argument list, the N-gram is an array of labels; the labels need to match the file's labels exactly.

find(ngram, data)

source code 

ngram = list of labels. data = list of (time, label, ...) as produced by xwaves_lab.py or similar.

This function returns all instances (even overlapping instances) of the specified N-gram in the file. The return format is [ [ label, ...], ... ] . It is a list of n-grams, and each n-gram is a list of entities, and each entities is a tuple which marks when it ends, what it is specifically, and perhaps other things.

In the argument list, the N-gram is an array of labels; the labels need to match the file's labels exactly.