fsa3 - #Hc########...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #Hc######## ###@###ss###d##Z##d##d##k##l##Z###d##e##f##d## ## ##YZ##d##e##f##d## ## ##YZ##d# #e##f##d## ## ##YZ##d #e##f##d # ## ##YZ##e##h###d###d #<h###d##d##<h###d###d##<h###d###d##<#d###d##<h##g##d##g## ##Z##e##h###d###d #<h###d##d##<h###d#d##g###d##<h###d###d##<h##g##d##g## ##Z #e##h###d###d #<h###d##d##<h###d###d##<h###d##d##<#d###d##<h##g##d##g## ##Z #e##h###d###d #<h###d##d##<h###d###d##<h###d##d##<#d###d##<h##g##d##g##d##h###d###d #<h###d###d##<h###d###d##<h###d###d##<#d###d##<h##g## ##Z##e##h###d###d #<h###d##d##<h###d#d##g###d##<h###d###d##<h##g##d##g##d##h###d###d #<h###d###d##<h###d##d##g###d##<h###d###d##<h##g## ##Z #d##S(####sX### FSA module This module implements simple deterministic, non-deterministic, and weighted finite state automata. It follows the description in Chapters 2 and 6 of Jurafsky and Martin (2008). @author: Rob Malouf @organization: Dept. of Linguistics, San Diego State University @contact: rmalouf@mail.sdsu.edu @version: 3 @since: 10-April-2008 i (####t####deepcopyt####FSAc############B###sA###e##Z##d##Z##d##d## ##Z##d# # ##Z##d## ##Z##d## ##Z##d##d## ##Z##RS(####s#### General finite-state automaton class An FSA consists of:- an alphabet (C{self.alphabet})- a state-transition table (C{self.transition_table})- an initial state (C{self.initial})- a set of final states (C{self.final}) i####c###########C###sG###|##|##_##x #|##i##D]{#}##xr#|##D]j#}##t##|##| ###d## ##p###|##|###g##|##|##<n###x8#|##|###D],#}##y##|##i##|####WqZ####t##d##| ### ##qZ#XqZ#Wq #Wq##W|##|##_##y##|##i##|##i####Wn#####t##d##|### ##n##Xy2#t##| ## ##|##_##x##|##i##D]##}##|##i##|####q #WWn#####t##d##|### ##n##Xt## ##| ##_##x'#|##i##D]##}##|##i##i##|##i## ## ###q##Wd##S(####s^### Create a new FSA object @param T: the transition function @type T: a C{list} of C{dict}s @param finals: final states @type finals: C{list} @param initial: initial state (by default, 0) @type initial: C{int} @raise ValueError: the FSA is mis-specified somehow t####__getitem__s####%s not a valid states####%s not a valid initial states####%s not valid final statesN( ###t####transition_tablet####hasattrt ###ValueErrort####initialt####sett####finalst####alphabett####updatet####keys(####t ####selft####TR####R####t####statet####symbolt####newStatet####final(####(####s.### /Users/Sarie/Documents/School/Ling 581/fsa3.pyt####__init__####s:##### # ####################### ############# ######### # ###c############C###sL###d##|##i##i###}##|##d##|##i###7}##x##t##t##|...
View Full Document

Page1 / 53

fsa3 - #Hc########...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online