File size: 487 Bytes
20b7679
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674b430
20b7679
674b430
20b7679
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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