{ "info": { "author": "Mika H\u00e4m\u00e4l\u00e4inen, Dept. of Digital Humanities, University of Helsinki", "author_email": "mika.hamalainen@helsinki.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: Finnish", "Programming Language :: Python :: 3", "Topic :: Text Processing" ], "description": "# FinMeter\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3474018.svg)](https://doi.org/10.5281/zenodo.3474018) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3473456.svg)](https://doi.org/10.5281/zenodo.3473456)\n\nFinMeter is a library for analyzing poetry in Finnish. It handels typical rhyming such as alliteration, assonance and consonance, Japanese meters and Kalevala meter. It can also be used to hyphenate Finnish.\n\n\tpip install finmeter\n\nIf you use the methods relating to semantics, metaphors and sentiment, you will need to run:\n\n\tpython3 -m finmeter.download \n\nSentiment analysis requires **tensorflow** (tested on 1.9.0 and numpy 1.16.4).\n\n## Hyphenation\n\nFinnish words can be divided into syllables like so\n\n\timport finmeter\n\tfinmeter.hyphenate(\"hattu\")\n\t>> hat-tu\n\tfinmeter.syllables(\"hattu\")\n\t>> [\"hat\", \"tu\"]\n\tfinmeter.count_sentence_syllables(\"kissa juoksi\")\n\t>> 4\n\n## Rhyming\n\nFinMeter can be used to check whether two words rhyme\n\n\timport finmeter\n\tfinmeter.assonance(\"ladata\", \"ravata\") #True\n\tfinmeter.consonance(\"kettu\", \"katti\") #True\n\tfinmeter.full_rhyme(\"pallolla\", \"kallolla\") #True\n\tfinmeter.alliteration(\"voi\", \"vehn\u00e4\") #True\n\n## Syllabic meters\n\nMeters based on the number of syllables can be assessed by FinMeter\n\n\timport finmeter\n\tfinmeter.list_possible_meters()\n\t>> ['tanka', 'kalevala', 'katauta', 'sedooka', 'bussokusekika', 'haiku', 'chooka']\n\tfinmeter.assess_meter(u\"kissa juoksee\\nkovaa juoksee\", \"haiku\")\n\t>> {'verse_results': [(False, '4/5'), (False, '4/7')], 'poem_length_error': '2/3', 'poem_length_ok': False}\n\nThe result is a dictionary cointaining information about the meter for each verse in \"verse results\" and about the overall length in \"poem_length_error\". **Note:** For Kalevala you should use *analyze_kalevala* instead.\n\n## Kalevala meter\n\nKalevala meter functionality takes the poetic foot into account and accepts verses of upto 10 syllables providing that certain poetic rules are met. In addition, the method assess other features important in Kalevala\n\n\timport finmeter\n\tfinmeter.analyze_kalevala(u\"Vesi vanhin voitehista\\nJ\u00e4n\u00f6 juoksi j\u00e4rveen\")\n\t>> [{'base_rule': {'message': '', 'result': True}, 'verse': u'Vesi vanhin voitehista', 'normal_meter': True, 'style': {'alliteration': True, 'viskuri': True}}, {'base_rule': {'message': 'Not enough syllables', 'result': False}, 'verse': u'J\\xe4n\\xf6 juoksi j\\xe4rveen', 'style': {'alliteration': True, 'viskuri': True}}]\n\nThe method returns a list of analysis results for each verse. If base_rule is True, it means that the verse follows the Kalevala meter, both in syllables and in foot.\n\n## Syllable length\n\nTo check if a syllable is short, use the following method\n\n\timport finmeter\n\tfinmeter.is_short_syllable(\"tu\") \n\t>> True\n\n# Semantics\n\nThe library has a variety of different functions realted to semantics\n\n## Concreteness\n\n\tfrom finmeter import semantics\n\n\tsemantics.concreteness(\"kissa\")\n\t>> 4.615\n\tsemantics.is_concrete(\"kissa\")\n\t>> True\n\nThe former method outputs True if the concreteness of the word is equal or greater than 3. The latter method outputs a concreteness score from 1 to 5. Both of the methods will return None for out of vocabulary words.\n\n## Semantic clusters\n\n\tfrom finmeter import semantics\n\n\tsemantics.semantic_clusters([\"kissa\", \"koira\", \"n\u00e4\u00e4t\u00e4\", \"hauki\", \"vesi\", \"lemmikki\", \"puhelin\", \"tieto|kone\", \"toimisto\"])\n\t>> [['koira', 'lemmikki', 'kissa', 'n\u00e4\u00e4t\u00e4'], ['vesi', 'hauki'], ['toimisto', 'tieto|kone', 'puhelin']]\n\tsemantics.similarity_clusters([\"koira\", \"kissa\", \"hevonen\"], [\"talo\", \"koti\", \"ovi\"])\n\t>> 0.18099508\n\tsemantics.cluster_centroid([\"koira\", \"kissa\", \"hevonen\"])\n\t>> [-5.84886856e-02 -1.10119150e-03 -3.40119563e-03......]\n\nThe library can be used to cluster words together into semantic clusters and to assess the similarity of two word clusters.\n\n# Sentiment\n\nThe library provides a somewhat functional sentiment analysis, but I wouldn't hold my breath.\n\n\tfrom finmeter import sentiment\n\tsentiment.predict(\"Olipa kakkainen leffa\")\n\t>> -2\n\tsentiment.predict(\"Kaikki on tosi kivaa\")\n\t>> 2\n\nThe possible values are -2 for strongly negative, -1 for negative, 1 for positive and 2 for strongly positive.\n\n# Metaphors\n\nThe library can give interpretations for metaphors. The lower the value, the more likely the interpretation. Example for *mies on susi*\n\n\tfrom finmeter import metaphor\n\tmetaphor.interpret(\"mies\", \"susi\", maximum=10)\n\t>> {'A': [('yksin\u00e4inen', 0), ('nuori', 3)], 'Adv': [], 'V': [('raadella', 0), ('tappaa', 1), ('ampua', 2), ('liikkua', 2), ('kaataa', 4)], 'N': [('mets\u00e4st\u00e4j\u00e4', 1), ('suu', 3), ('vaate', 4)], 'UNK': []}\n\n*maximum* is an optional parameter to limit the number of interpretations. If you do not need POS tagging, you can pass *pos_tags=False*.\n\n# Cite\n\nIf you use this library, cite the following publication\n\nMika H\u00e4m\u00e4l\u00e4inen and Khalid Alnajjar (In press).\u00a0Let's FACE it. Finnish Poetry Generation with Aesthetics and Framing. In *the Proceedings of The 12th International Conference on Natural Language Generation*.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mikahama/FinMeter", "keywords": "Finnish poetry meter syllables hyphenation rhyme", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "finmeter", "package_url": "https://pypi.org/project/finmeter/", "platform": "", "project_url": "https://pypi.org/project/finmeter/", "project_urls": { "Homepage": "https://github.com/mikahama/FinMeter" }, "release_url": "https://pypi.org/project/finmeter/2.0.1/", "requires_dist": null, "requires_python": "", "summary": "Hyphenator and poem analysis for Finnish", "version": "2.0.1" }, "last_serial": 5935736, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "fb6adf2d45944043e07e7edcf03f90ab", "sha256": "bf072cd356458cd07c503a7cd15d15e5510bbe25585291f54dd6056906ad4449" }, "downloads": -1, "filename": "finmeter-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fb6adf2d45944043e07e7edcf03f90ab", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8414, "upload_time": "2019-06-05T22:32:54", "url": "https://files.pythonhosted.org/packages/9c/47/ac60f471c565b303cbd51dec8b79fc345c2185d22e320c6f3c13c02c0ce2/finmeter-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "97033654742f1828a9b73dc6845db021", "sha256": "954bec101df352ae9c8cc4a08ba0f3df772b97648ce54abbf9ec490d27a99091" }, "downloads": -1, "filename": "finmeter-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "97033654742f1828a9b73dc6845db021", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8410, "upload_time": "2019-06-05T22:33:11", "url": "https://files.pythonhosted.org/packages/95/e2/1cf4eaeee13b1b08b4a08e3d5b438fd45a3c009f537930f58f129f43b218/finmeter-1.0.0-py3-none-any.whl" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "9e361b45bc34714661723efed47c0da0", "sha256": "d20ef86cf43f8b44631e09bd6ca22f252e81d359727b44f9bcad5f48164cecd6" }, "downloads": -1, "filename": "finmeter-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9e361b45bc34714661723efed47c0da0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 1388868, "upload_time": "2019-10-05T21:18:45", "url": "https://files.pythonhosted.org/packages/cb/e5/144404fe893a752eca3c19b39bac7ba6685d6e95cdaf70c293cffc3f8ba7/finmeter-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "142fd7e63904c676640153c729422758", "sha256": "a497c22b7c96659bbf7ceb118678da0e0e97cf2c3cde88b85ef065aa22177a1b" }, "downloads": -1, "filename": "finmeter-2.0.0.tar.gz", "has_sig": false, "md5_digest": "142fd7e63904c676640153c729422758", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1385220, "upload_time": "2019-10-05T21:18:31", "url": "https://files.pythonhosted.org/packages/f1/9a/a6edb2eec4e2c716a5dfc93067c3effd0a4fb4415b8264c12067a71f4a7e/finmeter-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "b2cae955f53fc764ed58815ab7188e33", "sha256": "890a704aacc63f455f36798337aa741e0300c6c90289de38dc6ce9f6f9b3a05d" }, "downloads": -1, "filename": "finmeter-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b2cae955f53fc764ed58815ab7188e33", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 1389025, "upload_time": "2019-10-06T19:32:31", "url": "https://files.pythonhosted.org/packages/c1/31/c8045c5bdcc7dad30f7cc599c23cda1b55eb45492fe44c43f6831ba01efc/finmeter-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3f51c56972afbb3181a225cb4c037f53", "sha256": "d9e04cafa58cf53b4242f1e62725985da6a8b639fcd7181ef6fb3a207e4a50a3" }, "downloads": -1, "filename": "finmeter-2.0.1.tar.gz", "has_sig": false, "md5_digest": "3f51c56972afbb3181a225cb4c037f53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1385369, "upload_time": "2019-10-06T19:32:16", "url": "https://files.pythonhosted.org/packages/58/51/070588848fab5c39b080a186ad9d38ec814d180f059c26c07af31d15b844/finmeter-2.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b2cae955f53fc764ed58815ab7188e33", "sha256": "890a704aacc63f455f36798337aa741e0300c6c90289de38dc6ce9f6f9b3a05d" }, "downloads": -1, "filename": "finmeter-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b2cae955f53fc764ed58815ab7188e33", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 1389025, "upload_time": "2019-10-06T19:32:31", "url": "https://files.pythonhosted.org/packages/c1/31/c8045c5bdcc7dad30f7cc599c23cda1b55eb45492fe44c43f6831ba01efc/finmeter-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3f51c56972afbb3181a225cb4c037f53", "sha256": "d9e04cafa58cf53b4242f1e62725985da6a8b639fcd7181ef6fb3a207e4a50a3" }, "downloads": -1, "filename": "finmeter-2.0.1.tar.gz", "has_sig": false, "md5_digest": "3f51c56972afbb3181a225cb4c037f53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1385369, "upload_time": "2019-10-06T19:32:16", "url": "https://files.pythonhosted.org/packages/58/51/070588848fab5c39b080a186ad9d38ec814d180f059c26c07af31d15b844/finmeter-2.0.1.tar.gz" } ] }