{"id":21590,"library":"morfessor","title":"Morfessor","description":"Morfessor is a tool for unsupervised morphological segmentation of words, often used in NLP and computational linguistics. It supports both morfessor-baseline and morfessor-cat (a cascade model). Current version 2.0.6, with infrequent releases.","status":"active","version":"2.0.6","language":"python","source_language":"en","source_url":"https://github.com/aalto-speech/morfessor","tags":["nlp","morphology","segmentation","unsupervised"],"install":[{"cmd":"pip install morfessor","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Direct import of the class from the package is required, not just the module.","wrong":"import morfessor","symbol":"Morfessor","correct":"from morfessor import Morfessor"},{"note":"The submodule is not exposed; BaselinModel is in the top-level namespace.","wrong":"from morfessor.baseline import BaselineModel","symbol":"BaselineModel","correct":"from morfessor import BaselineModel"}],"quickstart":{"code":"from morfessor import Morfessor\n\n# Initialize and segment a word\nmodel = Morfessor()\nresult = model.segment('unhappiness')\nprint(result)  # ['un', 'happiness']","lang":"python","description":"Basic segmentation using the default Morfessor model."},"warnings":[{"fix":"Upgrade Python to 3.6 or later. Use pip install 'morfessor<2.0.0' if legacy Python is needed.","message":"Python 3.6+ required starting from version 2.0.0. Python 2 is no longer supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace `MorfessorBaseline` with `Morfessor` in imports and instantiation.","message":"The API changed significantly in version 2.0.0: the main class is now `Morfessor` instead of `MorfessorBaseline`. Old code using `MorfessorBaseline` will break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Train the model using `model.load_data('corpus.txt')` or `model.train_batch()` before calling `segment()`.","message":"Pretrained models are not included. The `Morfessor` class must be trained on data before segmenting. Using without training will produce trivial splits.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Import from the top-level: `from morfessor import Morfessor`.","cause":"Trying to import from a submodule that does not exist in version 2.x.","error":"ModuleNotFoundError: No module named 'morfessor.baseline'"},{"fix":"Use `Morfessor` instead of `MorfessorBaseline`.","cause":"Using the old class name from version 1.x.","error":"MorfessorBaseline not defined"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}