Exemplo n.º 1
0
    def frobnicate(self, rawWords):
	mGrams = []
	for w in rawWords:
	    if w in self.knownWords: continue
	    if w in self.specialEvents: continue
	    fragments = self.fragmentize(w)
	    fragments = ['<s>'] + fragments + ['</s>']
	    mGrams += mGramCounts.mGramsFromSequence(fragments, self.order)
	return mGrams
Exemplo n.º 2
0
    def frobnicate(self, rawWords):
	mGrams = []
	for w in rawWords:
	    if w in self.knownWords: continue
	    if w in self.specialEvents: continue
	    fragments = self.fragmentize(w)
	    fragments = ['<s>'] + fragments + ['</s>']
	    mGrams += mGramCounts.mGramsFromSequence(fragments, self.order)
	return mGrams
Exemplo n.º 3
0
    def frobnicate(self, rawWords):
	phon = []
	for w in rawWords:
	    if w in self.specialEvents:
		phon.append(w)
	    elif w in self.lexicon:
		phon += self.lexicon[w]
		phon += ['#1']
	    else:
#               phon += ['mul', '#1']
		pass
	return mGramCounts.mGramsFromSequence(phon, self.order)
Exemplo n.º 4
0
    def frobnicate(self, rawWords):
	phon = []
	for w in rawWords:
	    if w in self.specialEvents:
		phon.append(w)
	    elif w in self.lexicon:
		phon += self.lexicon[w]
		phon += ['#1']
	    else:
#               phon += ['mul', '#1']
		pass
	return mGramCounts.mGramsFromSequence(phon, self.order)
Exemplo n.º 5
0
    def frobnicateWithFragmentRange(self, rawWords):
	return mGramCounts.mGramsFromSequence(
	    [  f
	       for w in rawWords
	       for f in self.frobnicateWord(w) ],
	    self.order)
Exemplo n.º 6
0
    def frobnicateWithFragmentRange(self, rawWords):
	return mGramCounts.mGramsFromSequence(
	    [  f
	       for w in rawWords
	       for f in self.frobnicateWord(w) ],
	    self.order)