{"id":13695693,"url":"https://github.com/google-research/turkish-morphology","last_synced_at":"2025-04-08T03:10:21.972Z","repository":{"id":62585565,"uuid":"187641602","full_name":"google-research/turkish-morphology","owner":"google-research","description":"A two-level morphological analyzer for Turkish.","archived":false,"fork":false,"pushed_at":"2022-03-15T18:16:53.000Z","size":619,"stargazers_count":170,"open_issues_count":4,"forks_count":27,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-31T17:18:30.035Z","etag":null,"topics":["google","morphological-analyser","morphology","natural-language-processing","natural-language-understanding","nlp","turkish"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-research.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-20T13:02:45.000Z","updated_at":"2025-03-09T16:01:05.000Z","dependencies_parsed_at":"2022-11-03T21:48:57.364Z","dependency_job_id":null,"html_url":"https://github.com/google-research/turkish-morphology","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fturkish-morphology","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fturkish-morphology/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fturkish-morphology/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Fturkish-morphology/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-research","download_url":"https://codeload.github.com/google-research/turkish-morphology/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"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":["google","morphological-analyser","morphology","natural-language-processing","natural-language-understanding","nlp","turkish"],"created_at":"2024-08-02T18:00:32.423Z","updated_at":"2025-04-08T03:10:21.942Z","avatar_url":"https://github.com/google-research.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Python"],"readme":"# Turkish Morphology\n\n![](https://github.com/google-research/turkish-morphology/workflows/Linux%20Build%20Status/badge.svg)\n\nA two-level morphological analyzer for Turkish.\n\nThis is not an official Google product.\n\n## Components\n\nThis implementation is composed of three layers:\n\n* **Lexicons:**\n\n  This layer includes wide-coverage [Turkish lexicons][3] which are manually\n  annotated and validated for part-of-speech and morphophonemic irregularities.\n  They are intended to be used in building Turkish natural language processing\n  tools, such as morphological analyzers. The set of base lexicons that we\n  provide includes annotated lexical items for 47,202 words. The tagsets and\n  the annotation scheme are described in the [lexicon annotation guidelines][4].\n\n* **Morphotactics:**\n\n  This layer includes [a set of FST definitions][5] which are implemented in a\n  custom format which is similar to AT\u0026T FSM format (only difference being that\n  we can use strings as state names and input/output labels for each transition\n  instead of integers). With each of these FSTs we define the suffixation\n  patterns and the morpheme inventories together with their corresponding\n  output morphological feature category-value pairs for a given part-of-speech.\n  Overall morphotactic model and the morphological feature category-value\n  tagsets are described in the [morphotactic model guidelines][6].\n\n* **Morphophonemics:**\n\n  This layer includes [a set of Thrax grammars][7], where each implements a\n  standalone morphophonemic process (such as vowel harmony, vowel drop,\n  consonant voicing and consonant drop and so on). Composition of the exported\n  FSTs defined in these Thrax grammars yield the [morphophonemic model][8] of\n  Turkish.\n\nThe first level of the morphological analysis is implemented by the\nmorphophonemic model, which takes a Turkish word and transforms it into the\nintermediate representation. The output of the first level is all possible\nhypotheses of word stem annotations with morphophonemic irregularities followed\nby the meta-morphemes that correspond to the suffixes that are realized in the\nsurface form.\n\n```\nInput: affında\nOutput: af\"+SH+NDA\n```\n\nLexicon entries and morphotactic FST definitions are composed and compiled into\na single FST which acts as the second level of the morphological analysis,\nnamely the morphotactic model. Morphotactic model takes the intermediate\ntape as the input and transforms it to all possible human-readable morphological\nanalyses that can be generated from the hypotheses generated by the first level.\n\n```\nInput: af\"+SH+NDA\nOutput: (af[NN]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc])+[Proper=False]\n```\n\nSee [Interpreting Human-Readable Morphological Analysis][12] section for a\ndescription of such human-readable morphological analysis.\n\n## How to Parse Words\n\nTo morphologically parse a word, simply run below from the project root\ndirectory.\n\n```\nbazel run -c opt scripts:print_analyses -- --word=[WORD_TO_PARSE]\n```\n\nThis will morphologically parse the input word against the two-level\nmorphological analyzer and output a set of human-readable morphological\nanalysis, as such:\n\n```\nbazel run -c opt scripts:print_analyses -- --word=geldiğinde\n\u003e Morphological analyses for the word 'geldiğinde':\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3pl])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3pl])+[Proper=True]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3sg])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3sg])+[Proper=True]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3pl])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3pl])+[Proper=True]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3sg])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([NOMP]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc]+[Copula=PresCop]+[PersonNumber=V3sg])+[Proper=True]\n\u003e (gel[VB]+[Polarity=Pos])([VN]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([VN]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+Hn[Possessive=P2sg]+NDA[Case=Loc])+[Proper=True]\n\u003e (gel[VB]+[Polarity=Pos])([VN]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc])+[Proper=False]\n\u003e (gel[VB]+[Polarity=Pos])([VN]-DHk[Derivation=PastNom]+[PersonNumber=A3sg]+SH[Possessive=P3sg]+NDA[Case=Loc])+[Proper=True]\n```\n\nIf the input string is not accepted as a Turkish word, morphological analyzer\noutputs an empty result.\n\n```\nbazel run -c opt scripts:print_analyses -- --word=foo\n\u003e 'foo' is not accepted as a Turkish word\n```\n\n## Interpreting Human-Readable Morphological Analysis\n\nAn example output human-readable morphological analysis is as follows;\n\n**Input Word** (*evlerindekilerin* = those that belongs to ones in their\nhomes):\n\n```\nbazel run -c opt scripts:print_analyses -- --word=evlerindekilerin\n```\n\n**Sample Output Morphological Analysis String**:\n\n```\n(ev[NN]+[PersonNumber=A3sg]+lArH[Possessive=P3pl]+NDA[Case=Loc])([PRF]-ki[Derivation=Pron]+lAr[PersonNumber=A3sg]+[Possessive=Pnon]+NHn[Case=Gen])+[Proper=False]\n```\n\nHuman-readable morphological analyses can be decomposed into parts:\n\n* **Inflectional groups:**\n\n  Each human-readable morphological analysis is composed of inflectional groups.\n  An inflectional group is a sub-word span, and it is created by affixation of a\n  derivational morpheme. Inflectional group analyses are enclosed in\n  parenthesis. Above example contains two inflectional groups:\n   - `(ev[NN]+[PersonNumber=A3sg]+lArH[Possessive=P3pl]+NDA[Case=Loc])`\n   - `([PRF]-ki[Derivation=Pron]+lAr[PersonNumber=A3pl]+[Possessive=Pnon]+NHn[Case=Gen])`\n\n* **Word stem:**\n\n  First inflectional group contains the word stem (e.g. `ev` is the root form\n  for the above example input word *evlerindekilerin*).\n\n* **Analysis of morphemes:**\n\n  Within each inflectional group meta-morphemes and\n  their corresponding morphological feature category-value tags are separated\n  with either `+` or `-` delimiters. (e.g. `+[PersonNumber=A3sg]`,\n  `+lArH[Possessive=P3pl]`, `-ki[Derivation=Pron]`, etc.). Strings that are\n  immediate followers of the delimiters `+` or `-` are the meta-morphemes (e.g.\n  `NDA` is the meta-morpheme in morpheme analysis `+NDA[Case=Loc]`).\n  Morphological feature category-value tags are enclosed in brackets right\n  after the meta-morphemes (e.g. `Case` is the feature category and `Loc` is\n  feature value in morpheme analysis `+NDA[Case=Loc]`).\n\n* **Part-of-speech:**\n\n  Part-of-speech tag of each inflectional group is the first bracketed tag of\n  the inflectional group (e.g. `NN` is the part-of-speech of the first\n  inflectional group and `PRF` is for the second inflectional group).\n\n* **Inflectional vs. Derivational morphemes:**\n\n  Meta-morphemes that are separated with `+` delimiter do not create a new\n  inflectional group. They are inflectional morphemes (e.g.\n  `+[PersonNumber=A3sg]`, `+NDA[Case=Loc]`, `+[Possessive=Pnon]`, etc.).\n  Meta-morphemes that are separated with `-` delimiter create a new\n  inflectional group. They are the derivational morphemes (e.g.\n  `-ki[Derivation=Pron]`). Therefore, first meta-morpheme in an inflectional\n  group always follows the delimiter `-`, but not `+`.\n\n* **Surface realization of inflections:**\n\n  Some meta-morphemes are not realized in the surface form. These meta-morphemes\n  do not correspond to a span of characters in the input word. For them we do\n  not output any meta-morpheme in the morpheme analysis (e.g.\n  `+lArH[Possessive=P3pl]` and `+NDA[Case=Loc]` are realized in the surface\n  form, thus they have explicit meta-morphemes `lArH` and `NDA` in their\n  morpheme analysis. However, `+[PersonNumber=A3sg]` and `+[Possessive=Pnon]`\n  are not realized in the surface form, therefore only morphological feature\n  category-value tags are output for them in their morpheme analysis).\n\n* **Surface realization of derivations:**\n\n  Derivational morphemes must always realize in the surface form. They always\n  correspond to a span of characters in the input word. Therefore, we always\n  output non-empty meta-morphemes in the corresponding morpheme analysis of\n  derivational morphemes. Meaning that no zero-derivations are allowed in the\n  morphotactic model.\n\n* **Proper noun analysis:**\n\n  An optional proper noun feature analysis is output at the end of each\n  inflectional group (e.g. `+[Proper=False]` which follows the second\n  inflectional group). Proper noun feature category can take two values `True`\n  or `False`. If it is specified as `True`, the inflectional group that it\n  follows is considered to be a part of a proper noun. This feature is used to\n  capture the internal structure of proper nouns that are composed of multiple\n  words (e.g. for multi-word movie names the true part-of-speech and\n  morphological feature of words that compose a multi-word movie name can be\n  annotated, while marking the fact that they are part of a proper noun using\n  this feature).\n\n  Proper noun feature analysis is omitted for some of the inflectional groups\n  to have a compact representation and to minimize the number of morphological\n  analyses generated by the morphological analyzer. In such cases, proper noun\n  feature analysis of an inflectional group applies to all preceding\n  inflectional groups that does not have one (e.g. first inflectional group of\n  the above example inherits its proper noun feature analysis `Proper=False`\n  from the second inflectional group).\n\n## Python API\n\nWe also provide a [Python API][15] that can be used to morphologically analyze\nTurkish words, generate Turkish word forms from morphological analyses, parse\nhuman-readable morphological analyses into protobuf messages, validate their\nstructural well-formedness and to generate human-readable analyses from them.\nYou can see some example use cases in [`//examples`][17].\n\nIf you are using [Bazel][16], you can depend on this repository as an external\ndependency of your project by adding the following to your WORKSPACE file:\n\n```\ngit_repository(\n  name = \"google_research_turkish_morphology\",\n  remote = \"https://github.com/google-research/turkish-morphology.git\",\n  tag = \"{version-tag}\",\n)\n```\n\nThen, you can simply use\n`@google_research_turkish_morphology//turkish_morphology:analyze`\n(or other modules of the API) as a dependecy of your relevant `py_library` or\n`py_binary` BUILD targets.\n\nThe API is also available on PyPi. To install the latest release from PyPi, run:\n\n```\npython3 -m pip install turkish-morphology\n```\n\nTo install from source, run below from the project root directory (preferably\nwithin a Python virtual environment):\n\n```\nbazel build //...\nbazel-bin/setup install\n```\n\n## Requirements\n\nTo build and run the morphological analyzer install [Bazel version 5.0.0][9] and\n[Python 3.9][10]. All other intrinsic dependencies will be imported, built and\ntaken care of by Bazel according to the [WORKSPACE][2] setup throughout the\nfirst invocation of the morphological analyzer runtime. If you are installing\nfrom PyPi, you need [pip][14].\n\n## Citing\n\nIf you use or discuss the code, data or tools from this repository in your work,\nplease cite:\n\nÖztürel, A., Kayadelen, T. \u0026 Demirşahin, I (2019, September). [A syntactically\nexpressive morphological analyzer for Turkish][13]. In Proceedings of the 14th\nInternational Conference on Finite-State Methods and Natural Language\nProcessing (pp. 65-75).\n\n```\n@inproceedings{\n    title = \"A Syntactically Expressive Morphological Analyzer for Turkish\",\n    author = \"\\\"{O}zt\\\"{u}rel, Adnan and Kayadelen, Tolga and Demir\\c{s}ahin,\n        I\\c{s}{\\i}n\",\n    booktitle = \"Proceedings of the 14th International Conference on Finite-State\n        Methods and Natural Language Processing\",\n    month = \"23--25\" # sep,\n    year = \"2019\",\n    address = \"Dresden, Germany\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://www.aclweb.org/anthology/W19-3110\",\n    pages = \"65--75\",\n}\n```\n\n## License\n\nUnless otherwise noted, all original files are licensed under an\n[Apache License, Version 2.0][1].\n\n[1]: LICENSE\n[2]: WORKSPACE.bazel\n[3]: ./src/analyzer/lexicon/base\n[4]: ./src/analyzer/lexicon/README.md\n[5]: ./src/analyzer/morphotactics/model\n[6]: ./src/analyzer/morphotactics/README.md\n[7]: ./src/analyzer/morphophonemics\n[8]: ./src/analyzer/morphophonemics/model.grm\n[9]: https://docs.bazel.build/versions/master/install.html\n[10]: https://www.python.org/downloads/\n[12]: #interpreting-human-readable-morphological-analysis\n[13]: https://www.aclweb.org/anthology/W19-3110\n[14]: https://pip.pypa.io/en/stable/installing/\n[15]: ./turkish_morphology\n[16]: https://bazel.build/\n[17]: ./examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Fturkish-morphology","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-research%2Fturkish-morphology","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Fturkish-morphology/lists"}