Skip to content

Commit

Permalink
Merge pull request #5 from AYLIEN/add-wiki-current-events-portal-source
Browse files Browse the repository at this point in the history
Adding WikimediaSignal and tools for searching Wikipedia Currents Events portal
  • Loading branch information
chrishokamp authored Dec 4, 2023
2 parents 31ee570 + aa2173e commit 43aab95
Show file tree
Hide file tree
Showing 12 changed files with 5,682 additions and 88 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ These notebooks let you try out `news-signals` without installing anything!

The Colab notebooks above are also available as jupyter notebooks in [research/news-signals-example-notebooks](research/news-signals-example-notebooks)

**2023-11-30: NEW**: [Create_Wikimedia_Signals.ipynb](research/news-signals-example-notebooks/Create_Wikimedia_Signals.ipynb) shows how to build and explore a `WikimediaSignal` which does not a NewsAPI account and works out-of-the-box for anyone.

## Quickstart

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.1
0.4.0
23 changes: 22 additions & 1 deletion news_signals/dataset_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,31 @@ def transform(signal):
return dataset


def add_wikipedia_current_events(
dataset,
wikidata_client=None,
wikipedia_endpoint=None,
overwrite_existing=False
):
def transform(signal):
return signal.add_wikipedia_current_events(
wikidata_client=wikidata_client,
wikipedia_endpoint=wikipedia_endpoint,
overwrite_existing=overwrite_existing
)
try:
dataset.map(transform)
except WikidataIDNotFound as e:
logger.error(f"Could not find Wikidata ID for signal: {e}, did not apply the pageviews transformation.")
return dataset



REGISTRY = {
"add_anomalies": add_anomalies,
"add_summaries": add_summaries,
"add_wikimedia_pageviews": add_wikimedia_pageviews
"add_wikimedia_pageviews": add_wikimedia_pageviews,
"add_wikipedia_current_events": add_wikimedia_pageviews
}


Expand Down
Loading

0 comments on commit 43aab95

Please sign in to comment.