Skip to main content

Random news articles in any language

Project description

gobbet - Random news articles in any language

Wikinews is a wonderful free source of long-form text in a variety of world languages. gobbet provides you with access to words, sentences and paragraphs taken from Wikinews articles in any of its supported languages. This can be used as filler text for type specimens, web layouts, etc.

Example usage

from gobbet import get_news, unicode_ranges

words, headlines, paragraphs = get_news("el") # ISO language code

# words is a Wordlist object; like Counter, but with a few more methods
words = (
    words.filter_popularity(2) # Only words which occur >=2 times
         .filter_length(5)     # ... of five letters or more ...
         .filter_unicodes(unicode_ranges["Greek"]) # .. in Greek script
)

# Want to find some kerning pair words?
bigrams = words.bigrams()
# bigrams['οώ'] === {'προώθησε', 'προώθηση', 'προώθησης', 'προώρων'}

# headlines and paragraphs are just lists, but...
from gobbet import filter_length, filter_unicodes

renderable = filter_unicodes(headlines, [font.getBestCmap().keys()])

License

gobbet was written by Simon Cozens. See LICENSE for the terms of this library.

Note that Wikinews text is provided under the CC-BY 2.5 license, and your application must comply with the terms of that license in its use of the content.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gobbet-0.0.3.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

gobbet-0.0.3-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page