{"id":13765963,"url":"https://github.com/sedthh/lara-hungarian-nlp","last_synced_at":"2025-05-10T21:32:29.116Z","repository":{"id":112708917,"uuid":"83783425","full_name":"sedthh/lara-hungarian-nlp","owner":"sedthh","description":"NLP class for rapid ChatBot development in Hungarian language","archived":false,"fork":false,"pushed_at":"2019-03-07T13:41:05.000Z","size":1522,"stargazers_count":29,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-17T01:33:16.554Z","etag":null,"topics":["chatbot","hungarian","hungarian-language","lemmatizer","nlp","python3","stemmer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sedthh.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":"2017-03-03T09:49:34.000Z","updated_at":"2024-01-25T17:36:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"32fe172a-3eba-41b1-a189-5a458e6e224c","html_url":"https://github.com/sedthh/lara-hungarian-nlp","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sedthh%2Flara-hungarian-nlp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sedthh%2Flara-hungarian-nlp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sedthh%2Flara-hungarian-nlp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sedthh%2Flara-hungarian-nlp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sedthh","download_url":"https://codeload.github.com/sedthh/lara-hungarian-nlp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253485659,"owners_count":21916058,"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":["chatbot","hungarian","hungarian-language","lemmatizer","nlp","python3","stemmer"],"created_at":"2024-08-03T16:00:49.713Z","updated_at":"2025-05-10T21:32:28.890Z","avatar_url":"https://github.com/sedthh.png","language":"Python","funding_links":[],"categories":["Tools"],"sub_categories":["Morphology"],"readme":"## **Lara** is a super fast, lightweight Python3 NLP library for ChatBot AI development in Hungarian language. \n\nInstead of being an all purpose NLP tool, **Lara** was created to fit the [quirks and uniqueness](https://en.wikipedia.org/wiki/Agglutinative_language) of the Hungarian (online) [language](https://en.wikipedia.org/wiki/Hungarian_language) as much as possible. The library is capable of matching inflected forms of keywords in text messages written in Hungarian. It also comes with functions for text processing, and can even identify common expressions and small talk topics in discussions.\n\n# Table of contents\n\n1. [About Lara](#about-lara)\n\t1. [Find intents](#find-intents)\n\t2. [Extract information](#extract-information)\n\t3. [Handle common topics](#handle-common-topics)\n\t4. [Create ML features](#create-ml-features)\n\t5. [And much more](#and-much-more)\n2. [Licensing](#licensing)\n\n## About Lara\n\nHere is a short list of things you can easily do with **Lara** in Hungarian. For full documentation and further examples, **CHECK OUT [THE WIKI](https://github.com/sedthh/lara-hungarian-nlp/wiki)**. A complete case study on [how to make ChatBots and Virtual Assistants](https://chatbotsmagazine.com/a-complete-case-study-for-developing-smart-assistants-79316be80e89) in foreign languages is also available. \n\n\n#### Find intents\n\nWith the Intents() Class, developers can easily match almost every possible inflected form of any keyword in Hungarian language. For example:\n\n```python\nfrom lara import parser\n\nragozott_forma\t= {\n\t\"to_do\"\t\t: [{\"stem\":\"csinál\",\"wordclass\":\"verb\"}],\n}\nragozott_talalat= parser.Intents(ragozott_forma)\n```\n\nWill `match` the intent `\"to_do\"` in the following sentences:\n- Ő mit **csinál** a szobában?\n- Mit fogok még **csinálni**?\n- Mikor **csináltad** meg a szekrényt?\n- **Megcsináltatták** a berendezést.\n- Teljesen **kicsinálva** érzem magamat ettől a melegtől.\n- **Csinálhatott** volna mást is.\n- **Visszacsinalnad** az ekezeteket a billentyuzetemen, kerlek?\n- Vigyázz, hogy el ne gépeld a **csniálni** igét!\n\nBy defining the `wordclass` and `stem` of a keyword, **Lara** will generate possible patterns for text matching, without having to rely on large dictionaries!\n\n```python\nfrom lara import parser\n\nalma_intents\t= {\n\t\"alma\"\t\t: [{\"stem\":\"alma\",\"wordclass\":\"noun\"}],\n\t\"szed\"\t\t: [{\"stem\":\"szed\",\"wordclass\":\"verb\"}],\n\t\"piros\"\t\t: [{\"stem\":\"piros\",\"wordclass\":\"adjective\"}]\n}\nalma_test\t= parser.Intents(alma_intents)\nprint(alma_test.match(\"Mikor szedjük le a pirosabb almákat?\"))\n\n\u003e\u003e\u003e {'alma': 1, 'szed': 2, 'piros': 2}\n```\n\n#### Extract information\n\nIt allows simple text processing:\n\n```python\nfrom lara import parser\n\ntweet\t\t= 'A robotok elveszik a munkát! #NLP #ChatBot'\nhashtags\t= parser.Extract(tweet).hashtags()\nprint(hashtags)\n\n\u003e\u003e\u003e ['#nlp','#chatbot']\n```\n\nAnd normalization of extracted strings:\n\n```python\nfrom lara import parser\n\nsms\t\t= 'Hívj fel! A számom 30/123 4567!'\ninfo\t\t= parser.Extract(sms)\nprint(info.phone_numbers(False))\nprint(info.phone_numbers(True))\n\n\u003e\u003e\u003e ['30/123 4567']\n\u003e\u003e\u003e ['+36 30 1234567']\n```\n\nIt uses Black Magic™:\n\n```python\nfrom lara import parser\n\nsorcery\t\t= 'Hívj fel ezen a számon 2018 IV. huszadikán mondjuk délután nyolc perccel háromnegyed kettő előtt!'\ninfo\t\t= parser.Extract(sorcery)\nprint(info.dates())\nprint(info.times())\n\t\n\u003e\u003e\u003e ['2018-04-20']\n\u003e\u003e\u003e ['13:37']\n```\n\n\n#### Handle common topics\n\nCommon entities are included:\n\n```python\nfrom lara import parser, entities\n\nuser_text\t= 'Igen, köszönöm a segítséget!'\n\ncommon\t= entities.common()\nprint(parser.Intents(common).match_set(user_text))\n\n\u003e\u003e\u003e {'yes', 'thx', 'help'}\n```\n\nSeveral small talk topics are also automatically handled:\n\n```python\nfrom lara import parser, entities\n\nuser_text\t= 'Te egy ember vagy, vagy egy intelligens számítógép vagy?'\n\nchitchat\t= entities.smalltalk()\nchitchat_match\t= parser.Intents(chitchat).match_set(user_text)\nif 'user_love' in chitchat_match:\n\tprint('Én is téged.')\nelif 'are_you_a_robot' in chitchat_match:\n\tprint('Egy számítógépet akkor nevezhetünk intelligensnek, ha át tud verni egy embert, hogy őt is embernek higgye.')\n\t\n\u003e\u003e\u003e Egy számítógépet akkor nevezhetünk intelligensnek, ha át tud verni egy embert, hogy őt is embernek higgye.\n```\n\n\n#### Create ML features\n\nRule based stemmers can help you create features from short Hungarian texts for Machine Learning models, without the need for large dictionaries:\n\n```python\nfrom lara import stemmer, nlp\n\ntext \t= '''\n\tA szövegbányászat a strukturálatlan vagy kis mértékben strukturált \n\tszöveges állományokból történő ismeret kinyerésének tudománya; \n\tolyan különböző dokumentumforrásokból származó szöveges ismeretek\n\tés információk gépi intelligenciával történő kigyűjtése és \n\treprezentációja, amely a feldolgozás előtt rejtve és feltáratlanul \n\tmaradt az elemző előtt. \n\t'''\n\nclean\t= nlp.remove_stopwords(text)\nstems\t= stemmer.tippmix(clean)\nbigrams = nlp.ngram(stems,2)\nprint(bigrams)\n\n\u003e\u003e\u003e ['szövegbányász strukturál', 'strukturál kis', 'kis mér', 'mér strukturál', 'strukturál szöveg', 'szöveg állományok', ... 'mar elemz']\n\n```\n\n#### And much more\n\nUse keywords in actual sentences:\n\n```python\nfrom lara import nlp, stemmer\n\nquery\t= \"Toto - Afrika\"\n\t\nparts\t= query.split('-')\nartist\t= stemmer.inverse(parts[0],'től')\t# \"tól\" and \"től\" are both valid\ntitle\t= stemmer.inverse(parts[1],'t')\nthe\t= nlp.az(title)\n\t\nprint('A zenelejátszó program az alábbi számot játssza:')\nprint(artist,the,title)\n\n\u003e\u003e\u003e A zenelejátszó program az alábbi számot játssza:\n\u003e\u003e\u003e Tototól az Afrikát\n```\n\nBetter understand poetry:\n\n```python\nfrom lara import nlp\n\nhuszt\t= ['Bús düledékeiden, Husztnak romvára megállék;',\n\t'Csend vala, felleg alól szállt fel az éjjeli hold.']\n\nfor line in husz:\n\tprint(nlp.metre(line))\n\t\n\u003e\u003e\u003e ['-', 'u', 'u', '-', 'u', 'u', '-', '-', '-', '-', '-', 'u', 'u', '-', '-']\n\u003e\u003e\u003e ['-', 'u', 'u', '-', 'u', 'u', '-', '-', 'u', 'u', '-', 'u', 'u', '-']\n```\n\n## Licensing\n\nLara is available under the MIT license starting from version 2.0.0 and up.\n\nFeel free to use it for your Hungarian ChatBot solutions and NLP Research purposes. [Let me know](https://github.com/sedthh) if you've used it in an interesting project. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsedthh%2Flara-hungarian-nlp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsedthh%2Flara-hungarian-nlp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsedthh%2Flara-hungarian-nlp/lists"}