def makeVector(w, lang=None): fv = FeatureVector() for ind, c in enumerate(w): fv.add(str(ind) + "-" + c) for ind, f in enumerate(splitWord(w,2)): fv.add(str(ind) + "-" + f) for ind, f in enumerate(splitWord(w, 3)): fv.add(str(ind) + "-" + f) if lang is not None: fv.setLabel(lang) return fv
def makeVector(w, lang): fv = FeatureVector() for f in splitWord(w,2): fv.add(f) fv.setLabel(lang) return fv