MIREParse/fileshare/files/MIParser-stable.py
def addBigrams(self, words):
		"""Creates a list of bigrams in an utterance. A bigram here is a list of
			two words (that include the tagging information). These bigrams are 
			then added to the bigram hash tables."""
		self.myData.counts["wordCnt"] += len(words)
		bigramList = []
		for i in range(len(words)-1):
			bigram = [words[i], words[i+1]]
			bigramList.append(bigram)
		self.myData.counts["bigramCnt"] += len(bigramList)
		for b in bigramList:
			# add the bigram to the tables
			#word1 = string.split(b[0], TAGSEP)
			#word2 = string.split(b[1], TAGSEP)
			brownsplit=compiled.match(b[0]);
			word1=[brownsplit.group(1), brownsplit.group(2)];
			brownsplit=compiled.match(b[1]);
			word2=[brownsplit.group(1), brownsplit.group(2)];

			#print "After the split:"
			#print word1
			#print word2

			# lower case if function word
			#if word1[TOKEN] in functionWordsEN:
			word1[TOKEN] = string.lower(word1[TOKEN])
			#if word2[TOKEN] in functionWordsEN:
			word2[TOKEN] = string.lower(word2[TOKEN])

			# add to directional hash tables
			self.addUDHash([ word1[TOKEN], word1[TYPE], word2[TOKEN], word2[TYPE] ])

			self.addToHash(word1[TOKEN], self.tokens)
			self.addToHash(word2[TOKEN], self.tokens)
			self.addToHash(word1[TYPE], self.types)
			self.addToHash(word2[TYPE], self.types)

			self.addToHash(word1[TOKEN]+" "+word2[TOKEN], self.totoBigrams)
			self.addToHash(word1[TOKEN]+" "+word2[TYPE], self.totyBigrams)
			self.addToHash(word1[TYPE]+" "+word2[TOKEN], self.tytoBigrams)
			self.addToHash(word1[TYPE]+" "+word2[TYPE], self.tytyBigrams)
Creates a list of bigrams in an utterance. A bigram here is a list of
			two words (that include the tagging information). These bigrams are 
			then added to the bigram hash tables.
Creates a list of bigrams in an utterance. A bigram here is a list of
two words (that include the tagging information). These bigrams are
then added to the bigram hash tables.
Creates a list of bigrams in an utterance . A bigram here is a list of two words ( that include the tagging information ) . These bigrams are then added to the bigram hash tables .
def addBigrams(self, words):
		self.myData.counts["wordCnt"] += len(words)
		bigramList = []
		for i in range(len(words)-1):
			bigram = [words[i], words[i+1]]
			bigramList.append(bigram)
		self.myData.counts["bigramCnt"] += len(bigramList)
		for b in bigramList:
			brownsplit=compiled.match(b[0]);
			word1=[brownsplit.group(1), brownsplit.group(2)];
			brownsplit=compiled.match(b[1]);
			word2=[brownsplit.group(1), brownsplit.group(2)];
			word1[TOKEN] = string.lower(word1[TOKEN])
			word2[TOKEN] = string.lower(word2[TOKEN])
			self.addUDHash([ word1[TOKEN], word1[TYPE], word2[TOKEN], word2[TYPE] ])
			self.addToHash(word1[TOKEN], self.tokens)
			self.addToHash(word2[TOKEN], self.tokens)
			self.addToHash(word1[TYPE], self.types)
			self.addToHash(word2[TYPE], self.types)
			self.addToHash(word1[TOKEN]+" "+word2[TOKEN], self.totoBigrams)
			self.addToHash(word1[TOKEN]+" "+word2[TYPE], self.totyBigrams)
			self.addToHash(word1[TYPE]+" "+word2[TOKEN], self.tytoBigrams)
			self.addToHash(word1[TYPE]+" "+word2[TYPE], self.tytyBigrams)
def addBigrams ( self , words ) : self . myData . counts [ "wordCnt" ] += len ( words ) bigramList = [ ] for i in range ( len ( words ) - 1 ) : bigram = [ words [ i ] , words [ i + 1 ] ] bigramList . append ( bigram ) self . myData . counts [ "bigramCnt" ] += len ( bigramList ) for b in bigramList : brownsplit = compiled . match ( b [ 0 ] ) ; word1 = [ brownsplit . group ( 1 ) , brownsplit . group ( 2 ) ] ; brownsplit = compiled . match ( b [ 1 ] ) ; word2 = [ brownsplit . group ( 1 ) , brownsplit . group ( 2 ) ] ; word1 [ TOKEN ] = string . lower ( word1 [ TOKEN ] ) word2 [ TOKEN ] = string . lower ( word2 [ TOKEN ] ) self . addUDHash ( [ word1 [ TOKEN ] , word1 [ TYPE ] , word2 [ TOKEN ] , word2 [ TYPE ] ] ) self . addToHash ( word1 [ TOKEN ] , self . tokens ) self . addToHash ( word2 [ TOKEN ] , self . tokens ) self . addToHash ( word1 [ TYPE ] , self . types ) self . addToHash ( word2 [ TYPE ] , self . types ) self . addToHash ( word1 [ TOKEN ] + " " + word2 [ TOKEN ] , self . totoBigrams ) self . addToHash ( word1 [ TOKEN ] + " " + word2 [ TYPE ] , self . totyBigrams ) self . addToHash ( word1 [ TYPE ] + " " + word2 [ TOKEN ] , self . tytoBigrams ) self . addToHash ( word1 [ TYPE ] + " " + word2 [ TYPE ] , self . tytyBigrams )
Creates a list of bigrams in an utterance.
Creates a list of bigrams in an utterance .
"""Creates a list of bigrams in an utterance. A bigram here is a list of
			two words (that include the tagging information). These bigrams are 
			then added to the bigram hash tables.""" # add the bigram to the tables #word1 = string.split(b[0], TAGSEP) #word2 = string.split(b[1], TAGSEP) #print "After the split:" #print word1 #print word2 # lower case if function word #if word1[TOKEN] in functionWordsEN: #if word2[TOKEN] in functionWordsEN: # add to directional hash tables
self
words