def process_word(s): if any( [l in string.ascii_lowercase for l in s] ): s = jaffna_transliterate(s) #print(u"Transliterated to %s"%s) #print(u"Checking in NN '%s'"%s) try: f = Feature.get(s) scaled_feature = scaler.transform( np.array( f.data() ).reshape(1,-1) ) y = nn.predict(scaled_feature ) #print( scaled_feature ) #print( y ) if y.ravel() > 0: return u"%s என்பது தமிழ் வார்த்தையாக இருக்கலாம்"%s else: return u"%s என்பது ஆங்கில வார்த்தையாக இருக்கலாம்"%s except Exception as ioe: return ioe.message return
def process_word(s): if any([l in string.ascii_lowercase for l in s]): s = jaffna_transliterate(s) #print(u"Transliterated to %s"%s) #print(u"Checking in NN '%s'"%s) try: f = Feature.get(s) scaled_feature = scaler.transform(np.array(f.data()).reshape(1, -1)) y = nn.predict(scaled_feature) #print( scaled_feature ) #print( y ) if y.ravel() > 0: return u"%s என்பது தமிழ் வார்த்தையாக இருக்கலாம்" % s else: return u"%s என்பது ஆங்கில வார்த்தையாக இருக்கலாம்" % s except Exception as ioe: return ioe.message return
def process_word(s): if any([l in string.ascii_lowercase for l in s]): s = jaffna_transliterate(s) print(u"Transliterated to %s" % s) print(u"Checking in NN '%s'" % s) try: f = Feature.get(s) scaled_feature = scaler.transform(np.array(f.data()).reshape(1, -1)) y = nn.predict(scaled_feature) print(scaled_feature) print(y) if y.ravel() > 0: print(u"%s -> TAMIL world (most likely)" % s) else: print(u"%s -> ENG word (most likely)" % s) except Exception as ioe: print("SKIPPING => ", ioe.message) return
def process_word(s): if any( [l in string.ascii_lowercase for l in s] ): s = jaffna_transliterate(s) print(u"Transliterated to %s"%s) print(u"Checking in NN '%s'"%s) try: f = Feature.get(s) scaled_feature = scaler.transform( np.array( f.data() ).reshape(1,-1) ) y = nn.predict(scaled_feature ) print( scaled_feature ) print( y ) if y.ravel() > 0: print(u"%s -> TAMIL world (most likely)"%s) else: print(u"%s -> ENG word (most likely)"%s) except Exception as ioe: print("SKIPPING => ",ioe.message) return