<commit_before>﻿"""
examples that illustrate how to query articles using different search options
"""
from eventregistry import *

er = EventRegistry(apiKey = "6e8ab56e-b4d8-4032-94cc-db5138e0370c", allowUseOfArchive=False)


# search for the phrase "<NAME>" - both words have to appear together
q = QueryArticles(keywords = "Barack Obama")
res = er.execQuery(q)

# search for articles that mention both of the two words - maybe together, maybe apart
# this form of specifying multiple keywords, concepts, etc is now depricated. When you have a list,
# use it with QueryItems.AND() or QueryItems.OR() to explicitly specify how the query should be processed
q = QueryArticles(keywords = ["Barack", "Obama"])
# set some custom information that should be returned as a result of the query
q.setRequestedResult(RequestArticlesInfo(count = 30,
    returnInfo = ReturnInfo(
        articleInfo = ArticleInfoFlags(duplicateList = True, concepts = True, categories = True, location = True, image = True))))
res = er.execQuery(q)


# search for articles that mention both of the two words - maybe together, maybe apart<commit_msg>- cleanup of the examples<commit_after>﻿"""
examples that illustrate how to query articles using different search options
"""
from eventregistry import *

er = EventRegistry(allowUseOfArchive=False)

# search for the phrase "Barack Obama" - both words have to appear together
q = QueryArticles(keywords = "Barack Obama")
res = er.execQuery(q)

# search for articles that mention both of the two words - maybe together, maybe apart
# this form of specifying multiple keywords, concepts, etc is now depricated. When you have a list,
# use it with QueryItems.AND() or QueryItems.OR() to explicitly specify how the query should be processed
q = QueryArticles(keywords = ["Barack", "Obama"])
# set some custom information that should be returned as a result of the query
q.setRequestedResult(RequestArticlesInfo(count = 30,
    returnInfo = ReturnInfo(
        articleInfo = ArticleInfoFlags(duplicateList = True, concepts = True, categories = True, location = True, image = True))))
res = er.execQuery(q)


# search for articles that mention both of the two words - maybe together, maybe apart
{'fraction_non_alphanumeric': 0.08190045248868778, 'fraction_numerical': 0.01085972850678733, 'mean_word_length': 4.927613941018767, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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}}
{'dir': 'git-commits-cleaned', 'id': '4156', 'n_tokens_mistral': 606, 'n_tokens_neox': 575, 'n_words': 262}