<jupyter_start><jupyter_text>N-Gram Ranking<jupyter_code># TODO: push to S3
# exports to a flat file
get_bigrams(content).to_csv('../data/output/output_data_ngram_bigrams.csv', index=False)
# TODO: push to S3
# exports to a flat file
get_trigrams(content).to_csv('../data/output/output_data_ngram_trigrams.csv', index=False)<jupyter_output><empty_output><jupyter_text>Named-Entity Recognition<jupyter_code>def get_entities(entities, ent_type):
    group_list = []
    for entity in entities:
        if entity.label_ == ent_type:
            group_list.append(entity.text)
    df_entities = pd.DataFrame(Counter(group_list).most_common(20))
    df_entities.columns=['entity', 'count']
    return df_entities
nlp = spacy.load("en_core_web_sm", disable=["tagger", "parser", "textcat"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13284132841328414, 'fraction_numerical': 0.004920049200492005, 'mean_word_length': 5.898305084745763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '473485', 'license': 'MIT', 'n_tokens_mistral': 299, 'n_tokens_neox': 294, 'n_words': 47, 'path': 'notebooks/.ipynb_checkpoints/kivy-loans-00-checkpoint.ipynb', 'repo_name': 'ecdedios/kiva-loans-nlp', 'size': '813'}