Skip to main content

flexicon is a library for accessing FieldWorks Language Explorer (FLEx) [1] projects.

flexicon handles the necessary initialisation of the FLEx engine, and provides a class (FLExProject) for opening a FLEx project and working with its contents.

For the GUI application that runs Python scripts/plugins on FLEx databases see FLExTools [2].

Requirements

Python 3.8 - 3.13.

Python for .NET [3] version 3.0.3+.

FieldWorks Language Explorer 9.0.17 - 9.3.1.

32-bit vs 64-bit

The Python architecture must match that of FieldWorks. I.e. Install 32-bit Python for 32-bit Fieldworks, and 64-bit Python for 64-bit Fieldworks.

Installation

Run: pip install pyflexicon

Documentation

Full API documentation is published at https://flexicon.langtech.cloud.

The rendered HTML API help is also bundled and accessible from Python via flexicon.APIHelpFile.

Every GetAll returns a loop/len()/index/re-iterate-able collection regardless of its concrete type (EnumerableWrapper, list, or a SmartCollection subtype) – see docs/getall-contract.md for the full guarantee.

Usage

Basic usage:

import flexicon
flexicon.FLExInitialize()
p = flexicon.FLExProject()
p.OpenProject('parser-experiments')
p.GetPartsOfSpeech()
# ['Adverb', 'Noun', 'Pro-form', 'Pronoun', 'Verb', 'Copulative verb', 'Ditransitive verb', 'Intransitive verb', 'Transitive verb', 'Coordinating connective']

# The API documentation is an HTML file
os.startfile(flexicon.APIHelpFile)
...
p.CloseProject()
flexicon.FLExCleanup()

Version 2.0+ Operations Classes

Version 2.0 introduces comprehensive Operations classes providing CRUD (Create, Read, Update, Delete) methods for all major FLEx data types. These are organized into topic areas matching FLEx’s structure:

  • Grammar: Parts of Speech, Phonemes, Grammatical Categories, Morphology

  • Lexicon: Entries, Senses, Examples, Pronunciations, Variants, Etymology

  • Texts & Words: Texts, Wordforms, Analyses, Paragraphs, Segments

  • Notebook: Notes, People, Locations, Anthropology data

  • Lists: Publications, Agents, Overlays, Possibility Lists

  • System: Writing Systems, Custom Fields, Project Settings

Example usage:

import flexicon
flexicon.FLExInitialize()

project = flexicon.FLExProject()
project.OpenProject('MyProject', writeEnabled=True)

# Create a new lexical entry
entry = project.LexEntry.Create("run", "stem")

# Add a sense with gloss
sense = project.LexEntry.AddSense(entry, "to move rapidly on foot")
project.Senses.SetGloss(sense, "run", "en")

# Set part of speech
verb = project.POS.Find("Verb")
project.Senses.SetPOS(sense, verb)

# Add an example sentence
example = project.Examples.Create(sense,
    "The dog runs in the park.", "en")

project.CloseProject()
flexicon.FLExCleanup()

All v1.x API methods remain available for backward compatibility.

What’s New in v2.2

Version 2.2 introduces Wrapper Classes and Smart Collections that simplify working with polymorphic types in FieldWorks. These eliminate the need for manual type checking and casting.

Key Features:

  • Automatic Type Casting: No more checking ClassName or casting to concrete types

  • Smart Collections: Type-aware display showing diversity of data

  • Convenience Filters: Easy filtering without manual type checks

  • Capability-Based API: Check what’s available instead of checking type

  • Zero Breaking Changes: All existing code continues to work

Example - Phonological Rules (v2.2):

from flexicon import FLExProject
from flexicon.wrappers import PhonologicalRule

project = FLExProject()
project.OpenProject('MyProject')

# Get all rules - returns smart collection with wrapped objects
rules = project.PhonologicalRuleOperations().GetAll()

# Type-aware display
print(rules)  # Shows: PhRegularRule: 7, PhMetathesisRule: 3, etc.

# Convenience filters
regular_rules = rules.regular_rules
metathesis_rules = rules.metathesis_rules

# Transparent property access across types
for rule in rules:
    if rule.has_output_specs:
        print(f"Outputs: {rule.output_segments}")
    if rule.has_metathesis_parts:
        print(f"Metathesis: {rule.left_part}, {rule.right_part}")

Currently Supported Domains:

  • Grammar: Phonological Rules, Phonological Contexts

  • Lexicon: Morphosyntactic Analyses (MSAs)

More domains coming in v2.3+

Migration Guide: See MIGRATION.md for detailed examples comparing old and new API.

Contract Testing

A pre-commit hook verifies that LibLCM API dependencies stay consistent as you develop. On machines with FieldWorks installed, the full suite checks every type and member flexicon depends on and detects regressions across LibLCM upgrades.

Setup: python hooks/install.py

See Contract Testing Guide for details.


Download files

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

Source Distribution

pyflexicon-4.3.0.tar.gz (792.5 kB view details)

Uploaded Source

Built Distribution

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

pyflexicon-4.3.0-py3-none-any.whl (806.1 kB view details)

Uploaded Python 3

File details

Details for the file pyflexicon-4.3.0.tar.gz.

File metadata

  • Download URL: pyflexicon-4.3.0.tar.gz
  • Upload date:
  • Size: 792.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyflexicon-4.3.0.tar.gz
Algorithm Hash digest
SHA256 92f065d18b02e71fd63c3abfe75494fa78208b212ce13753d188ce90df1bfb42
MD5 ef860a2308228a2d0d463b5e1aac01b0
BLAKE2b-256 f4e6f321937896d557630517a7ed09515adf1652fba21d9e22f497e00c7583b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexicon-4.3.0.tar.gz:

Publisher: publish.yml on MattGyverLee/flexicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyflexicon-4.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyflexicon-4.3.0-py3-none-any.whl
  • Upload date:
  • Size: 806.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyflexicon-4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa68a83823f9c6170470e49eccd8509ac57d8516416fbc61d0341c5d69db0e61
MD5 81fae5039e796d36010c5531846e5c8f
BLAKE2b-256 c737e933e189e77f6214da1f18a0635f0bc9d876c3c3cf699da475f008d29f2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyflexicon-4.3.0-py3-none-any.whl:

Publisher: publish.yml on MattGyverLee/flexicon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

4.4.1

2 files

4.4.0

2 files

4.3.1

2 files

This release

4.3.0 This release

2 files

4.2.1

2 files

4.2.0

2 files

4.1.2

2 files

4.1.1

2 files

4.1.0

2 files

Supported by

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