{"id":16489931,"url":"https://github.com/crowdagger/genere","last_synced_at":"2026-05-10T21:50:33.201Z","repository":{"id":62439360,"uuid":"180784396","full_name":"crowdagger/genere","owner":"crowdagger","description":"A library for randomization of text respecting grammatical gender of sentences","archived":false,"fork":false,"pushed_at":"2019-04-19T23:46:24.000Z","size":104,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-25T23:54:15.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdagger.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-11T12:10:22.000Z","updated_at":"2020-05-30T19:04:57.000Z","dependencies_parsed_at":"2022-11-01T22:00:38.681Z","dependency_job_id":null,"html_url":"https://github.com/crowdagger/genere","commit_stats":null,"previous_names":["lise-henry/genderly","crowdagger/genere","lise-henry/genere"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crowdagger/genere","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fgenere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fgenere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fgenere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fgenere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdagger","download_url":"https://codeload.github.com/crowdagger/genere/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fgenere/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32873150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T13:45:52.575Z","updated_at":"2026-05-10T21:50:33.183Z","avatar_url":"https://github.com/crowdagger.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/lise-henry/genere.svg?branch=master)](https://travis-ci.org/lise-henry/genere)\n\n# genere\n\nGenere is a library to generate (possibly randomized) text with options to match the (grammatical) gender\nof various elements.\n\n## Example\n\n```rust\nuse genere::Generator;\nlet json = r#\"\n{\n   \"hero\": [\"John[m]\", \"Joan[f]\"],\n   \"job[hero]\": [\"wizard/witch\"],\n   \"main[hero]\": [\"{hero}. He/She is a {job}.\"]\n}\"#;\n\nlet mut gen = Generator::new();\ngen.add_json(json).unwrap();;\nlet result = gen.instantiate(\"main\").unwrap();\nassert!(\u0026result == \"John. He is a wizard.\"\n       || \u0026result == \"Joan. She is a witch.\");\n```\n\n\n## Features\n\n### Binary or Rust library\n\nIt is possible to use Genere as a binary:\n\n```bash\n$ genere main \u003c file.json\n```\nwill instantiate the `main` symbol in the `file.json` file.\n\nGenere is, however, primarily a [Rust](https://rust-lang.org) library, so it can be used in programs written in Rust: you only have to add\n\n```toml\ngenere = \"0.1\"\n```\n\nIn the `dependencies` section of your `Cargo.toml` file.\n\n### Text generation\n\nGenere is inspired by [Tracery](http://tracery.io/) and thus has a similar syntax to allow\nyou to easily generate randonized text:\n\n```rust\nlet json = r#\"\n{\n    \"name\": [\"John\", \"Johana\", \"Vivienne\", \"Eric\"],\n    \"last_name\": [\"StrongArm\", \"Slayer\", \"The Red\"],\n    \"class\": [\"mage\", \"warrior\", \"thief\", \"rogue\", \"barbarian\"],\n    \"race\": [\"human\", \"dwarvish\", \"elvish\", \"vampire\"],\n    \"text\": [\"{name} {last_name} is a {race} {class}.\",\n\t     \"Meet {name} {last_name}, A proud {class}!\"]\n}\n\"#;\n\n```\n\nmight display \"Johana  Slayer is a vampire warrior.\"\n\nBasically, you define a list of symbols which will be replaced (randomly) by one version\nof the string in the corresponding array when you \"call\" them using the `{symbol`} syntax.\n\nNot that once a symbol has been \"instantiated\", ils value is fixed. So if you had:\n\n```json\n\"text\": [\"Meet {name} {last_name}. {name} is a proud {class}.\"]\n```\n\nit is guaranteed that both replacements for `{name}` will be identical.\n\nIf you want to get a (possibly) different instantiation, you need to use `{{symbol}}`:\n\n```json\n\"text\": [\"Meet {name} {last_name}. {name} is a proud {class}. There is also {{name}}, a {{class}}.\"]\n```\n\n### Capitalization\n\nWhen declared, symbols are case-insensitive. When they are referred to in content replacements,\nthe capitalization of the symbol will impact the capitalization of\nthe replacement: if thhe symbol is in lowercase, the content is\nnot touched; if only the first letter of the symbol is in\nuppercase, the first letter of the replacement content will be\nchanged to uppercase; and if the symbol is all in uppercase, the\nsame will be applied for the replacement content.\n\n```rust\nlet json = r#\"\n{\n    \"dog\": [\"a good dog\"],\n    \"text1\": [\"This is {dog}\"],\n    \"text2\": [\"This is {DOG}\"],\n    \"text3\": [\"{Dog}\"]\n}\n\"#;\n\n```\n\nwill display \"This is a good dog\", \"This is A GOOD DOG\" and \"A good dog\" for \"text1\", \"text2\" and \"text3\" respectively.\n\n### Gender adaptation\n\nGenere seeks to allow easy generation of sentences that are grammaticaly gender accurate:\n\n```rust\nlet json = r#\"\n{\n    \"name\": [\"John[m]\", \"Johana[f]\", \"Vivienne[f]\", \"Eric[m]\"],\n    \"class\": [\"mage\", \"warrior\", \"thief\", \"rogue\", \"barbarian\"],\n    \"text[name]\": [\"Meet {name}. He/She is a proud {class}!\"]\n}\n\"#;\n\n```\n\nwill make sure to display \"He\" or She\" according to the gender specified in the symbol `name`.\n\nYou can set a gender to these values using the `[m]`, `[f]` or `[n]`. Similarly, you can\ntell genere that a symbol depends on another's symbol gender by using `[symbol]` in the symbol name. E.g., `text[main]` means that the gender in `main`'s replacement strings will be determined by `name`'s gender.\nIt is also possible to specify a neutral gender, by using `[n]` in the definition and by\nadding a `/` in the replacement string (e.g. `He/She/They`). If it isn't specified in the\nreplacement string, both male and female version will be outputted (e.g. `He/She` instead of `Them`).\n\nSometimes a sentence might use various gendered elements and not just depend on only one symbol's gender.\nFor each gender variation, it is possible to specify a \"dependency\":\n\n```json\n\"text[hero]\": [\"He/She is called {hero}. His/Her son/daughter[child] is named {child}.\"]\n```\n\nHere, the gender of `hero` will be used to determine between `He/She` and `His/Her`, but\nthe gender of `child` will be used to pick between `son/daughter`.\n\n#### Spaces in gender adaptation\n\nWhen you use this gender syntax, the '/' will only consider the word before and the word\nafter, not allowing to have spaces in your expressions. If you want to insert a space in a\ngender adaptation expression, you must escape it with `~`, e.g.: \"du/de~ la\"\n\n### Additional gender syntax\n\nIt is also possible to use the \"median point\" syntax used e.g. in french: \"C'est un·e sorci·er·ère.\" is equivalent to \"C'est un/une sorcier/sorcière\".\n\n### Escaping\n\nIf you want to use the '[', ']', '{', '}', '/' and '·' characters in your text, you can use\nthe escape character '\\~'. E.g., \"\\~{foo}\" will display \"{foo}\" instead of trying to find the symbol `foo` and replace it with its content. You can also use \"~~\" if you want to display the tilde symbol.\n\n### License\n\nGenere is published under the Mozilla Public License, version 2.0. For more information, see the [License](LICENSE).\n\n### ChangeLog\n\nSee [ChangeLog](ChangeLog.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Fgenere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdagger%2Fgenere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Fgenere/lists"}