Un rastreador de noticias muy simple en Python. Desarrollado en la Universidad Humboldt de Berlín.
Inicio rápido | Tutoriales | Fuentes de noticias | Papel
El fondo es:
Un rastreador de noticias estáticas. ¡Fundus le permite rastrear artículos de noticias en línea con solo unas pocas líneas de código Python! Ya sea de sitios web en vivo o del conjunto de datos CC-News.
Un paquete Python de código abierto. Fundus se basa en la idea de construir algo juntos. ¡Damos la bienvenida a su contribución para ayudar al Fundus a crecer!
Para instalar desde PIP, simplemente haga:
pip install fundus
El fondo requiere Python 3.8+.
Usemos Fundus para rastrear 2 artículos de editores con sede en los Estados Unidos.
from fundus import PublisherCollection , Crawler
# initialize the crawler for news publishers based in the US
crawler = Crawler ( PublisherCollection . us )
# crawl 2 articles and print
for article in crawler . crawl ( max_articles = 2 ):
print ( article )¡Eso ya es todo!
Si ejecuta este código, debería imprimir algo como esto:
Fundus-Article:
- Title: "Feinstein's Return Not Enough for Confirmation of Controversial New [...]"
- Text: "Democrats jammed three of President Joe Biden's controversial court nominees
through committee votes on Thursday thanks to a last-minute [...]"
- URL: https://freebeacon.com/politics/feinsteins-return-not-enough-for-confirmation-of-controversial-new-hampshire-judicial-nominee/
- From: FreeBeacon (2023-05-11 18:41)
Fundus-Article:
- Title: "Northwestern student government freezes College Republicans funding over [...]"
- Text: "Student government at Northwestern University in Illinois "indefinitely" froze
the funds of the university's chapter of College Republicans [...]"
- URL: https://www.foxnews.com/us/northwestern-student-government-freezes-college-republicans-funding-poster-critical-lgbtq-community
- From: FoxNews (2023-05-09 14:37)¡Esta impresión le dice que gastó con éxito dos artículos!
Para cada artículo, los detalles de la impresión:
Tal vez quieras rastrear una fuente de noticias específica. Vamos a rastrear los artículos de noticias de Washington Times:
from fundus import PublisherCollection , Crawler
# initialize the crawler for The New Yorker
crawler = Crawler ( PublisherCollection . us . TheNewYorker )
# crawl 2 articles and print
for article in crawler . crawl ( max_articles = 2 ):
print ( article ) Para rastrear una gran cantidad de datos, Fundus se basa en el archivo web CommonCrawl , en particular el rastreo de noticias CC-NEWS . Si no está familiarizado con CommonCrawl o CC-NEWS consulte sus sitios web. Simplemente importe nuestro CCNewsCrawler y asegúrese de consultar nuestro tutorial de antemano.
from fundus import PublisherCollection , CCNewsCrawler
# initialize the crawler using all publishers supported by fundus
crawler = CCNewsCrawler ( * PublisherCollection )
# crawl 1 million articles and print
for article in crawler . crawl ( max_articles = 1000000 ):
print ( article ) Nota : Por defecto, el rastreador utiliza todos los núcleos de CPU disponibles en su sistema. Para un rendimiento óptimo, recomendamos establecer manualmente el número de procesos utilizando el parámetro processes . Una buena regla general es asignar one process per 200 Mbps of bandwidth . Esto puede variar según la velocidad del núcleo.
Nota : El rastreo anterior tomó ~ 7 horas utilizando la PublisherCollection en una máquina con una conexión de 1000 Mbps, Core i9-13905H, 64 GB de RAM, Windows 11 y sin imprimir los artículos. El tiempo estimado puede variar sustancialmente dependiendo del editor utilizado y el ancho de banda disponible. Además, no todos los editores están incluidos en el CC-NEWS Crawl (especialmente los editores con sede en EE. UU.). Para la creación de grandes corpus, uno también puede usar el rastreador regular utilizando solo los sitios sitios, lo que requiere significativamente menos ancho de banda.
from fundus import PublisherCollection , Crawler , Sitemap
# initialize a crawler for us/uk based publishers and restrict to Sitemaps only
crawler = Crawler ( PublisherCollection . us , PublisherCollection . uk , restrict_sources_to = [ Sitemap ])
# crawl 1 million articles and print
for article in crawler . crawl ( max_articles = 1000000 ):
print ( article )Proporcionamos tutoriales rápidos para comenzar con la biblioteca:
Si desea contribuir, consulte estos tutoriales:
Puede encontrar los editores actualmente admitidos aquí .
Además: agregar un nuevo editor es fácil: ¡considere contribuir al proyecto!
Consulte nuestro punto de referencia de evaluación.
La siguiente tabla resume el rendimiento general del fondo de fondo y los raspadores evaluados en términos de precisión Rouge-lSum promedio, recuperación y puntaje F1 y su desviación estándar. La tabla se clasifica en orden descendente sobre el puntaje F1:
| Raspador | Precisión | Recordar | Puntaje F1 | Versión |
|---|---|---|---|---|
| Fondo | 99.89 ± 0.57 | 96.75 ± 12.75 | 97.69 ± 9.75 | 0.4.1 |
| Trafilatura | 93.91 ± 12.89 | 96.85 ± 15.69 | 93.62 ± 16.73 | 1.12.0 |
| Noticias | 97.95 ± 10.08 | 91.89 ± 16.15 | 93.39 ± 14.52 | 1.6.13 |
| Bte | 81.09 ± 19.41 | 98.23 ± 8.61 | 87.14 ± 15.48 | / |
| text | 86.51 ± 18.92 | 90.23 ± 20.61 | 86.96 ± 19.76 | 3.0.1 |
| Colina | 85.96 ± 18.55 | 91.21 ± 19.15 | 86.52 ± 18.03 | / |
| Machecería | 82.89 ± 20.65 | 82.11 ± 29.99 | 79.90 ± 25.86 | 1.3.0 |
Cite el siguiente documento al usar el fondo o construir nuestro trabajo:
@inproceedings { dallabetta-etal-2024-fundus ,
title = " Fundus: A Simple-to-Use News Scraper Optimized for High Quality Extractions " ,
author = " Dallabetta, Max and
Dobberstein, Conrad and
Breiding, Adrian and
Akbik, Alan " ,
editor = " Cao, Yixin and
Feng, Yang and
Xiong, Deyi " ,
booktitle = " Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations) " ,
month = aug,
year = " 2024 " ,
address = " Bangkok, Thailand " ,
publisher = " Association for Computational Linguistics " ,
url = " https://aclanthology.org/2024.acl-demos.29 " ,
pages = " 305--314 " ,
}Envíe sus preguntas o comentarios por correo electrónico a Max Dallabetta
¡Gracias por su interés en contribuir! Hay muchas formas de involucrarse; Comience con nuestras pautas de contribuyentes y luego verifique estos problemas abiertos para tareas específicas.
MIT