<jupyter_start><jupyter_text>Feature extraction from news headlines using NLP<jupyter_code>import pandas as pd
import spacy
from spacy import displacy
nlp = spacy.load("en_core_web_trf")
finviz_df = pd.read_parquet("../../finstar-pipelines/data/sp500/news/finviz/Symbol=MRNA")
#finfinviz_df
newsapi_df = pd.read_parquet("../../finstar-pipelines/data/sp500/news/newsapi/Symbol=MRNA")
#newsapi_df
doc = nlp(finviz_df.Title[0])

for ent in doc.ents:
    print(ent.text, ent.start_char, ent.end_char, ent.label_)
displacy.render(doc, style="ent")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13986013986013987, 'fraction_numerical': 0.012237762237762238, 'mean_word_length': 6.253164556962025, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '473065', 'license': 'Apache-2.0', 'n_tokens_mistral': 234, 'n_tokens_neox': 226, 'n_words': 36, 'path': 'notebooks/20210821-nlp-features.ipynb', 'repo_name': 'JungeAlexander/finstar', 'size': '572'}