LingConv / compute_lng.py
mohdelgaar's picture
Update layout and samples
674b430
raw
history blame
487 Bytes
from lng.lca.lc_anc import lca
from lng.L2SCA.analyzeText import sca
import lftk
import spacy
nlp = spacy.load("en_core_web_sm")
def extract_lftk(text):
if text == '':
return [0.] * 220
doc = nlp(text)
LFTK = lftk.Extractor(doc)
feats = LFTK.extract()
return list(feats.values())
def compute_lng(text):
lca_feats = lca(text)
sca_feats = sca(text)
lftk = extract_lftk(text)
all_feats = lca_feats + sca_feats + lftk
return all_feats