Skip to main content

Reports language coverage given a set of unicode values

Project description

https://travis-ci.org/jackjennings/smorgasbord.svg?branch=master

Smörgåsbord tests sets of unicode characters to determine what language support is covered.

This library deveoped as a tool for type designers only as an approximate guide for planning purposes. Regional variation in letterforms is left as a exercise for the designer, and detection isn’t a planned feature.

The Smorgasbord class inherits from UnicodeSet and supports the same features.

Supports Python 2.6 – 3.x

from smorgasbord import Smorgasbord

>>> bord = Smorgasbord([97, "b", "c", u"ü", u"\u0660"])
Smorgasbord([u"a", u"c", u"b", u"\xfc", u"\u0660"])

# Reports are accessed though the "reports" dict using the language code
>>> en = bord.reports["en"]

# Basic information about the report's language is accessible
>>> en.language.code
"en"
>>> en.language.name
"English"
>>> en.language.characters
FrozenUnicodeSet([u"a", u"b", u"c", ...])

# Amount of coverage is availbe as float and string representations
>>> en.coverage
0.057
>>> en.coverage.percentage
u"5.7%"

# Sets of glyphs can be accessed
>>> en.covered
FrozenUnicodeSet([u"a", u"b", u"c"])
>>> en.uncovered
FrozenUnicodeSet([u"d", u"e", u"f", ...])

# Reports can also return a boolean value for completeness:
>>> en.complete
False
>>> en.incomplete
True

Supported Languages

Language Files

Each language is defined in a text file. Characters are separated by spaces, and lines starting with a # are ignored as comments. Line breaks can and should be used to wrap lines to 80 characters maximum.

For example, the en.txt definition for English:

# Language: English
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

The first line is a special comment that will be parsed as the language name. Other special comments may be added in the future, but for now only Language is supported.

Custom Language Files

Custom langauges files can be set at runtime by supplying a path to a folder.

Smorgasbord.language_paths.prepend("/my/path/to/language/files/dir")

Language files are searched for in each succesive folder, using the first matching file. Language files included with this package can be overriden by prepending a local folder; an en.txt language file in the local folder will be used in preference to the internal en.txt.

Alternatively, the language_paths array can be replaced to only use locally available language files:

Smorgasbord.language_paths = ["/my/path/to/language/files/dir"]

Contributing

  1. Fork this repository

  2. Add your language file to the languages directory or modify an existing file

  3. Add you language to the list of supported languages in this README

  4. Commit the change with a brief description (e.g. created en.txt, added ñ to es.txt)

  5. Create a pull request

Roadmap

This is a quick list of features that will need to be added in the near future (and will probably comprise a 1.0 release).

  • Lazily evaluate reports. Currently the library loads all language files when a Smorgasbord is initialized, which will get slow, fast. This should happen at the latest possible moment.

  • Unicode ranges in language files. Adding support for unicode ranges will probably be necesary for languages with large character sets.

  • Better language support. Probably starting with languages using the latin alphabet, and continue in subjective order of easiest to define and number of speakers.

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

smorgasbord-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smorgasbord-0.0.1-py2.7.egg (10.6 kB view details)

Uploaded Egg

File details

Details for the file smorgasbord-0.0.1.tar.gz.

File metadata

  • Download URL: smorgasbord-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for smorgasbord-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c613342e49d158bb4208d5529d24d6651bed5044cf30f7979b47573c16170af1
MD5 853b1ebbc4aed38cccdba9aef8fc93ae
BLAKE2b-256 c89c468e9440a2919760124b0b9d4a3335e19a3fe4622b683349b4d2cede5904

See more details on using hashes here.

File details

Details for the file smorgasbord-0.0.1-py2.7.egg.

File metadata

File hashes

Hashes for smorgasbord-0.0.1-py2.7.egg
Algorithm Hash digest
SHA256 c0062ed067e6bddbce5a967484b0333f70ca916926dbdcca75bf40ff5f474b5d
MD5 8c76f0225176620504286ac0ce3bb103
BLAKE2b-256 e97caa83ba355bc7985d5e506bea854963bd180d81def45dd393135c93758ad0

See more details on using hashes here.

Supported by

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