Skip to main content

Python librairy for parsing NooJ's dictionary files

Project description

pynooj

Python library for parsing NooJ's dictionary files.

Overview

pynooj is a Python library that parses NooJ dictionary files (.dic) and extracts lexical information including inflected forms, lemmas, grammatical categories, and morphological traits.

For more information about NooJ, visit the NooJ website.

Installation

pip install pynooj

Usage

Basic Example

from pynooj import read_dic

# Parse a NooJ dictionary file
entries = read_dic("path/to/dictionary.dic")

# Each entry is a dictionary containing:
# - "inflected form": the word form
# - "lemma": the base form (optional)
# - "category": grammatical category (e.g., "V", "N", "A")
# - "traits": morphological attributes

for entry in entries:
    print(entry["inflected form"], "→", entry["lemma"])
    print(f"  Category: {entry['category']}")
    print(f"  Traits: {entry['traits']}")

Dictionary File Format

NooJ dictionary files use a comma-separated format:

inflected_form,lemma,category+Trait1=Value1+Trait2=Value2

Examples:

amo,amare,V+Theme=INF+FLX=GP1_INF+GP=1
casa,casa,N+Number=SG+Gender=F

API Reference

read_dic(path)

Parses a NooJ dictionary file and returns a list of lexical entries.

Parameters:

  • path (str): Path to the .dic file

Returns:

  • List of dictionaries, each containing:
    • "inflected form": the word form (string)
    • "lemma": the base form (string, optional)
    • "category": grammatical category (string)
    • "traits": dictionary of morphological traits (dict)

Running Tests

To run the test suite with unittest:

python -m unittest discover -s tests

Publishing to PyPI

Prerequisites

Ensure you have the necessary tools installed:

pip install build twine

Steps

  1. Update version in pyproject.toml

  2. Build the package:

    python -m build
    
  3. Upload to PyPI:

    twine upload dist/*
    
  4. Upload to TestPyPI (optional, for testing):

    twine upload --repository testpypi dist/*
    

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

See the LICENSE file for details.

Related Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynooj-0.1.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynooj-0.1.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file pynooj-0.1.3.tar.gz.

File metadata

  • Download URL: pynooj-0.1.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pynooj-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d9445a9c1ad191f9eddb21ac1f406cecf2290ffa6cb206b1c201670579558488
MD5 e6dafb66b28a0ad877c6f79905d6f303
BLAKE2b-256 805b08181f96b0a2d4e111c51d83655c228ed3dd3d74f153b7be113608ff582f

See more details on using hashes here.

File details

Details for the file pynooj-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pynooj-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pynooj-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b215d89808fb5801e32ef619afab15bbc7df280259a5921735e79b96b630a5b
MD5 f6101904e781e57d9c6893b1478cd172
BLAKE2b-256 e89ba29808d5c912fdbb08065d90bae1e7a01941c162f9a7f0a1e1ec14a57cb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page