Example #1
0
def report(model_file, text_file):
    pl = Pipeline()
    model = KNN.load(model_file)
    nlp = en_core_web_sm.load()
    make_doc = lambda text: nlp(unidecode(text).strip())

    text = [line for line in open(text_file) if line.strip()]
    docs = [make_doc(line) for line in text]
    sentences = [sent.text for doc in docs for sent in doc.sents]

    print('\n'.join(text))

    predictions = pl.predict(model, sentences, print_pred=False)
    print('\n \n ###############  Soft Skills  ############\n')
    print(
        *[sent for sent, pred in zip(sentences, predictions) if 'yes' == pred],
        sep='\n')