{"id":21769946,"url":"https://github.com/mideind/greynirengine","last_synced_at":"2025-07-13T09:34:09.349Z","repository":{"id":38447256,"uuid":"128227804","full_name":"mideind/GreynirEngine","owner":"mideind","description":"A fast, efficient natural language processing engine for Icelandic.","archived":false,"fork":false,"pushed_at":"2024-10-07T18:55:46.000Z","size":340985,"stargazers_count":62,"open_issues_count":10,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-17T14:08:52.428Z","etag":null,"topics":["earley","icelandic","natural-language-processing","nlp","parser","parsing","parsing-engine","parsing-library","python","python-library","python3"],"latest_commit_sha":null,"homepage":"https://greynir.is","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mideind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-04-05T15:41:47.000Z","updated_at":"2025-02-05T16:46:54.000Z","dependencies_parsed_at":"2024-12-31T16:11:14.172Z","dependency_job_id":"363f12fd-e1b4-41c0-9c34-c0d09850e08d","html_url":"https://github.com/mideind/GreynirEngine","commit_stats":null,"previous_names":["mideind/greynirengine","mideind/greynirpackage"],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/mideind/GreynirEngine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mideind%2FGreynirEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mideind%2FGreynirEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mideind%2FGreynirEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mideind%2FGreynirEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mideind","download_url":"https://codeload.github.com/mideind/GreynirEngine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mideind%2FGreynirEngine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265120408,"owners_count":23714490,"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":["earley","icelandic","natural-language-processing","nlp","parser","parsing","parsing-engine","parsing-library","python","python-library","python3"],"created_at":"2024-11-26T14:10:42.122Z","updated_at":"2025-07-13T09:34:09.311Z","avatar_url":"https://github.com/mideind.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-3817/)\n![Release](https://shields.io/github/v/release/mideind/GreynirEngine?display_name=tag)\n![PyPI](https://img.shields.io/pypi/v/reynir)\n[![Build](https://github.com/mideind/GreynirEngine/actions/workflows/python-package.yml/badge.svg)]()\n\n\u003cimg src=\"https://raw.githubusercontent.com/mideind/GreynirEngine/master/doc/_static/greynir-logo-large.png\" alt=\"Greynir\" width=\"200\" height=\"200\" align=\"right\" style=\"margin-left:20px; margin-bottom: 20px;\"\u003e\n\n# GreynirEngine\n\n**A fast, efficient natural language processing engine for Icelandic**\n\n## Overview\n\nGreynir is a Python 3 (\u003e=3.9) package,\npublished by [Miðeind ehf.](https://mideind.is), for\n**working with Icelandic natural language text**.\nGreynir can parse text into **sentence trees**, find **lemmas**,\ninflect **noun phrases**, assign **part-of-speech tags** and much more.\n\nGreynir's sentence trees can *inter alia* be used to extract\ninformation from text, for instance about people, titles, entities, facts,\nactions and opinions.\n\nFull documentation for Greynir is [available here](https://greynir.is/doc/).\n\nGreynir is the engine of [Greynir.is](https://greynir.is),\na natural-language front end for a database of over 10 million\nsentences parsed from Icelandic news articles, and\n[Embla](https://embla.is), a voice-driven virtual assistant app\nfor smart devices such as iOS and Android phones.\n\nGreynir includes a hand-written\n[context-free grammar](https://github.com/mideind/GreynirEngine/blob/master/src/reynir/Greynir.grammar)\nfor the Icelandic language, consisting of over 7,000 lines of grammatical\nproductions in [extended Backus-Naur format](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form).\nIts fast C++ parser core is able to cope with long and ambiguous sentences,\nusing an [Earley-type parser](https://en.wikipedia.org/wiki/Earley_parser)\nas [enhanced by Scott and Johnstone](https://www.sciencedirect.com/science/article/pii/S0167642309000951).\n\nGreynir employs the [Tokenizer](https://pypi.org/project/tokenizer/) package,\nby the same authors, to tokenize text, and\nuses [BinPackage](https://pypi.org/project/islenska/) as its database of\nIcelandic vocabulary and morphology.\n\n## Examples\n\n### Use Greynir to easily inflect noun phrases\n\n````python\nfrom reynir import NounPhrase as Nl\n\n# Create a NounPhrase ('nafnliður') object\nkarfa = Nl(\"þrír lúxus-miðar á Star Wars og tveir brimsaltir pokar af poppi\")\n\n# Print the NounPhrase in the correct case for each context\n# (þf=þolfall/accusative, þgf=þágufall/dative). Note that\n# the NounPhrase class implements __format__(), allowing you\n# to use the case as a format specification, for instance in f-strings.\n\nprint(f\"Þú keyptir {karfa:þf}.\")\nprint(f\"Hér er kvittunin þín fyrir {karfa:þgf}.\")\n````\n\nThe program outputs the following text, correctly inflected:\n\n````text\nÞú keyptir þrjá lúxus-miða á Star Wars og tvo brimsalta poka af poppi.\nHér er kvittunin þín fyrir þremur lúxus-miðum á Star Wars og tveimur brimsöltum pokum af poppi.\n````\n\n### Use Greynir to parse a sentence\n\n````python\n\u003e\u003e\u003e from reynir import Greynir\n\u003e\u003e\u003e g = Greynir()\n\u003e\u003e\u003e sent = g.parse_single(\"Ása sá sól.\")\n\u003e\u003e\u003e print(sent.tree.view)\nP                               # Root\n+-S-MAIN                        # Main sentence\n    +-IP                          # Inflected phrase\n    +-NP-SUBJ                   # Noun phrase, subject\n        +-no_et_nf_kvk: 'Ása'     # Noun, singular, nominative, feminine\n    +-VP                        # Verb phrase containing arguments\n        +-VP                      # Verb phrase containing verb\n        +-so_1_þf_et_p3: 'sá'   # Verb, 1 accusative arg, singular, 3rd p\n        +-NP-OBJ                  # Noun phrase, object\n        +-no_et_þf_kvk: 'sól'   # Noun, singular, accusative, feminine\n+-'.'                           # Punctuation\n\u003e\u003e\u003e sent.tree.nouns\n['Ása', 'sól']\n\u003e\u003e\u003e sent.tree.verbs\n['sjá']\n\u003e\u003e\u003e sent.tree.flat\n'P S-MAIN IP NP-SUBJ no_et_nf_kvk /NP-SUBJ VP so_1_þf_et_p3\n    NP-OBJ no_et_þf_kvk /NP-OBJ /VP /IP /S-MAIN p /P'\n\u003e\u003e\u003e # The subject noun phrase (S.IP.NP also works)\n\u003e\u003e\u003e sent.tree.S.IP.NP_SUBJ.lemmas\n['Ása']\n\u003e\u003e\u003e # The verb phrase\n\u003e\u003e\u003e sent.tree.S.IP.VP.lemmas\n['sjá', 'sól']\n\u003e\u003e\u003e # The object within the verb phrase (S.IP.VP.NP also works)\n\u003e\u003e\u003e sent.tree.S.IP.VP.NP_OBJ.lemmas\n['sól']\n````\n\n## Prerequisites\n\nThis package runs on CPython 3.9 or newer, and on PyPy 3.9 or newer.\n\nTo find out which version of Python you have, enter:\n\n````sh\npython --version\n````\n\nIf a binary wheel package isn't available on [PyPI](https://pypi.org\u003e)\nfor your system, you may need to have the `python3-dev` package\n(or its Windows equivalent) installed on your\nsystem to set up Greynir successfully. This is\nbecause a source distribution install requires a C++ compiler and linker:\n\n````sh\n# Debian or Ubuntu\nsudo apt-get install python3-dev\n````\n\nDepending on your system, you may also need to install `libffi-dev`:\n\n````sh\n# Debian or Ubuntu\nsudo apt-get install libffi-dev\n````\n\n## Installation\n\nTo install this package, assuming Python 3 is your default Python:\n\n````sh\npip install reynir\n````\n\nIf you have **git** installed and want to be able to edit\nthe source, do like so:\n\n````sh\ngit clone https://github.com/mideind/GreynirEngine\ncd GreynirEngine\n# [ Activate your virtualenv here if you have one ]\npip install -e .\n````\n\nThe package source code is in `GreynirEngine/src/reynir`.\n\n## Tests\n\nTo run the built-in tests, install [pytest](https://docs.pytest.org/en/latest),\n`cd` to your `GreynirEngine` subdirectory (and optionally activate your\nvirtualenv), then run:\n\n````sh\npython -m pytest\n````\n\n## Evaluation\n\nA parsing test pipeline for different parsing schemas, including the Greynir schema,\nhas been developed. It is available [here](https://github.com/mideind/ParsingTestPipe).\n\n## Documentation\n\nPlease consult [Greynir's documentation](https://greynir.is/doc/) for detailed\n[installation instructions](https://greynir.is/doc/installation.html),\na [quickstart guide](https://greynir.is/doc/quickstart.html),\nand [reference information](https://greynir.is/doc/reference.html),\nas well as important information about\n[copyright and licensing](https://greynir.is/doc/copyright.html).\n\n## Troubleshooting\n\nIf parsing seems to hang, it is possible that a lock file that GreynirEngine\nuses has been left locked. This can happen if a Python process that uses\nGreynirEngine is killed abruptly. The solution is to delete the lock file\nand try again:\n\nOn Linux and macOS:\n\n````sh\nrm /tmp/greynir-grammar  # May require sudo privileges\n````\n\nOn Windows:\n\n````cmd\ndel %TEMP%\\greynir-grammar\n````\n\n## Copyright and licensing\n\nGreynir is Copyright © 2016-2024 by [Miðeind ehf.](https://mideind.is).  \nThe original author of this software is *Vilhjálmur Þorsteinsson*.\n\n\u003ca href=\"https://mideind.is\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/mideind/GreynirEngine/master/doc/_static/mideind-horizontal-small.png\" alt=\"Miðeind ehf.\"\n    width=\"214\" height=\"66\" align=\"right\" style=\"margin-left:20px; margin-bottom: 20px;\"\u003e\u003c/a\u003e\n\nThis software is licensed under the **MIT License**:\n\n*Permission is hereby granted, free of charge, to any person*\n*obtaining a copy of this software and associated documentation*\n*files (the \"Software\"), to deal in the Software without restriction,*\n*including without limitation the rights to use, copy, modify, merge,*\n*publish, distribute, sublicense, and/or sell copies of the Software,*\n*and to permit persons to whom the Software is furnished to do so,*\n*subject to the following conditions:*\n\n**The above copyright notice and this permission notice shall be**\n**included in all copies or substantial portions of the Software.**\n\n*THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,*\n*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF*\n*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*\n*IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY*\n*CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,*\n*TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE*\n*SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*\n\nIf you would like to use this software in ways that are incompatible\nwith the standard MIT license, [contact Miðeind ehf.](mailto:mideind@mideind.is)\nto negotiate custom arrangements.\n\n----\n\nGreynirEngine indirectly embeds the [Database of Icelandic Morphology](https://bin.arnastofnun.is),\n([Beygingarlýsing íslensks nútímamáls](https://bin.arnastofnun.is)), abbreviated BÍN.\nGreynirEngine does not claim any endorsement by the BÍN authors or copyright holders.\n\nThe BÍN source data are publicly available under the\n[CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/), as further\ndetailed [here in English](https://bin.arnastofnun.is/DMII/LTdata/conditions/)\nand [here in Icelandic](https://bin.arnastofnun.is/gogn/mimisbrunnur/).\n\nIn accordance with the BÍN license terms, credit is hereby given as follows:\n\n*Beygingarlýsing íslensks nútímamáls. Stofnun Árna Magnússonar í íslenskum fræðum.*\n*Höfundur og ritstjóri Kristín Bjarnadóttir.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmideind%2Fgreynirengine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmideind%2Fgreynirengine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmideind%2Fgreynirengine/lists"}