{"id":17688249,"url":"https://github.com/neroist/nimcorpora","last_synced_at":"2025-03-30T21:28:04.291Z","repository":{"id":84101052,"uuid":"583959670","full_name":"neroist/nimcorpora","owner":"neroist","description":"A Nim interface for Darius Kazemi's Corpora project.","archived":false,"fork":false,"pushed_at":"2023-01-10T18:49:01.000Z","size":688,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T01:41:24.891Z","etag":null,"topics":["corpora","nim"],"latest_commit_sha":null,"homepage":"https://neroist.github.io/nimcorpora/nimcorpora.html","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neroist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-31T16:41:32.000Z","updated_at":"2023-01-11T11:19:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a409240-7629-4eba-803c-af67cd525414","html_url":"https://github.com/neroist/nimcorpora","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroist%2Fnimcorpora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroist%2Fnimcorpora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroist%2Fnimcorpora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neroist%2Fnimcorpora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neroist","download_url":"https://codeload.github.com/neroist/nimcorpora/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246382645,"owners_count":20768244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["corpora","nim"],"created_at":"2024-10-24T11:43:53.880Z","updated_at":"2025-03-30T21:28:04.269Z","avatar_url":"https://github.com/neroist.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nimcorpora [![nimble](https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble.png)](https://nimble.directory/pkg/nimcorpora)\nA Nim interface for Darius Kazemi's [Corpora](https://github.com/dariusk/corpora) project. - [**Documentation**](https://neroist.github.io/nimcorpora/nimcorpora.html)\n\nInspired by [pycorpora](https://github.com/aparrish/pycorpora).\n\n## Installation \nInstall via:\n```\nnimble install nimcorpora\n```\n\nYou can also install by github and git link like so:\n```\nnimble install https://github.com/neroist/nimcorpora\n```\n\nor \n\n```\nnimble install https://github.com/neroist/nimcorpora.git\n```\n\nAfter installation, Corpora's data will be installed to the packages's directory. If this fails for whatever reason, [report an error](https://github.com/neroist/nimcorpora/issues/new) and install and put the data in the `data/` directory in the package directory.\n\n## Documentation\nSee https://neroist.github.io/nimcorpora/nimcorpora.html\n\n## Example/Showcase\n```nim\nimport std/json\n\nimport nimcorpora\n\n# Get corpora object (needed to access data)\nlet corpora = newCorpora()\n\n# Get all categories (aka directories in the data)\necho corpora.getCategories()\necho corpora.categories # or you can do it like this\n\n# Get all subcategories (aka the json files in the data)\necho corpora.getSubcategories()\necho corpora.subcategories # or you can do it like this aswell\necho corpora.getSubcategories(\"animals\") # you can also get all subcategories under\n                                         # a specific category (e.g. animals)\necho corpora.getSubcategories([\"animals\", \"archetypes\"]) # or you could get all subcategories under\n                                                         # under MULTIPLE categories mwuahahaha \u003e:)\n\n# get file (subcategory) contents\n#* input `path` as subcategory (e.x \"animals/ant_anatomy\")\n#* Note that these procs return a JsonNode\necho pretty corpora.getFile(\"animals/ant_anatomy\")\necho pretty corpora.getFile(\"animals\", \"ant_anatomy\") # you can also put the category\n                                               # and subcateory as different params\n\n# you can also get multiple files at once, via category and subcategory names\nfor file in corpora.getFiles(\"animals\", [\"ant_anatomy\", \"birds_antarctica\"]):\n  echo pretty file\n\n# or you could get multiple files via their paths\nfor file in corpora.getFiles([\"animals/birds_north_america\", \"animals/cats\"]):\n  echo pretty file\n\n# or under a specific category\nfor file in corpora.getFiles(\"archetypes\"):\n  echo pretty file\n\n# or even under multiple categories\nfor category in corpora.getFilesByCategories([\"architecture\", \"art\"]):\n  for file in category:\n    echo pretty file\n\n# Update data\n# This updates the data downloaded when nimcorpora was first installed \necho \"Updating Corpora data...\"\ncorpora.update(output = on) #* -d:ssl needed for this proc!\n\necho \"\" # spacing\n\n# Install data\n# Installs Corpora data into current directory\necho \"Installing Corpora data...\"\ninstallCorporaData() #* -d:ssl needed for this proc aswell!\n```\n\nAdditional examples available at [`examples/`](/examples)\n\n\n## Distribution\nFor distributing an application, make sure the directory containing Corpora's data is **neighboring the directory of the executable**\n\nSo, the preferred file structure for distributing is:\n```\nyour_application/\n  bin/\n    your_executable\n    ...\n    \n  data/\n    ...\n```\n\nTo install the data there, you can either use `installCorporaData()` or include the data by default in you application directory\n\nIn addition, `update()`, by default, updates the data in the package's directory. When compiling a release build, `update()` instead updates the data in the `data/` directory. So, make sure to compile with `-d:release` when distributing so `update()` works correctly for distributing.\n\n## License\nNimcorpora is licensed under the [BSD Zero clause license](/LICENSE) 🎉\n\n###### Made with ❤️ with Nim\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneroist%2Fnimcorpora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneroist%2Fnimcorpora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneroist%2Fnimcorpora/lists"}