Skip to main content

Contributors Forks Stargazers Issues MIT License

Downloads


Logo

morphemes

A practical Python Library for identifying morphemes in the english language.


Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

A simple and practical solution for obtaining morpheme information for a word. The majority of the logic uses a simple lookup strategy based off of the MorphoLex-en project. Unknown's ie. names of people & places are all counted as 1 morpheme.
This is a non-contextual solution intended to feed more complex logic for NLP.

(back to top)

Built With

(back to top)

Getting Started

Using this library is fairly routine and easy. More detail will be added to this section as we get closer to the first release.

Prerequisites

This project was developed with Python 3.9 other versions of Python 3 should work.

Installation

pip install morphemes

(back to top)

Usage

Using the morphemes library is very simple.

  1. Import the library
  2. Create an instance of the Morphemes class
    1. Optional - Specify a data path where the morphemes database will be stored. If no data path is specified local app storage will be used.
  3. Use the library by calling the parse function.

Example:

from morphemes import Morphemes

path = "./data"

m = Morphemes(path) #Data path is optional, local storage will be used if left out.
print(m.parse("organizationally"))

Output:

{
  "word": "organizationally",
  "status": "FOUND_IN_DATABASE",
  "morpheme_count": 5,
  "tree": [
    {
      "children": [
        {
          "text": "organ",
          "type": "root"
        },
        {
          "text": "ize",
          "type": "bound"
        }
      ],
      "type": "free"
    },
    {
      "text": "ion",
      "type": "bound"
    },
    {
      "text": "al",
      "type": "bound"
    },
    {
      "text": "ly",
      "type": "bound"
    }
  ]
}

Types definition:

  • root: Root value of the word (some morphemes may have multiple roots (example: milkshake)
  • bound: adds to the root morphemes. Does not contribute meaning on it's own.
  • free: A word which can be used on its own. There can be multiple free types in a single morphem (example: milkshake)

Words which are not found are marked with status NOT_FOUND and will default to 1 morpheme. This will be improved in future releases.

NOTE: the data path specified is where the morphemes library will store a database containing morphemes from MorphoLex-en along with other lookups to help properly detect morphemes.

(back to top)

Roadmap

  • Morpheme detection of known words
  • Handling of common names and places (counted as 1 morpheme)
  • Handling of unknown words

See the open issues for a full list of proposed features (and known issues).

(back to top)

Developers

Clone the repo and use the Make file to build a local version: make install

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Do you want other languages supported? Are you an fluent speaker of the language you want? Help contribute and grow this project in to a more universal morpheme solution!

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

ECSC, ltd - ecsctechdepartment@gmail.com

Project Link: https://github.com/ecscstatsconsulting/morphemes

(back to top)

Acknowledgments

(back to top)

Metadata

Release files for morphemes 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for morphemes 1.2.0
File Size Uploaded Provenance Actions
morphemes-1.2.0.tar.gz 11.4 kB Without provenance Details for morphemes-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for morphemes 1.2.0
File Interpreter ABI Platform Actions
morphemes-1.2.0-py3-none-any.whl Python 3 none any Details for morphemes-1.2.0-py3-none-any.whl

Total release size: 21.6 kB

Release files / morphemes-1.2.0.tar.gz

Download URL morphemes-1.2.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
14637571ea020c3c4ce1b4483ed9a3d817471d09fba96304781959bf27e022da
BLAKE2b-256 checksum
How to use checksums
e415baf404685806e358dcb8b1658f13dcd03fda8045a81393c234de9d124edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / morphemes-1.2.0-py3-none-any.whl

Download URL morphemes-1.2.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
170898e90b72997d16b11406e54e736cb2cc3302a7f5c4c06811b0abe43ab947
BLAKE2b-256 checksum
How to use checksums
bc6dd687412c3e1d4e7d63d995cf94268786b3bed4a12aad0b3c5e7e37940a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for morphemes 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page