Skip to main content

A Python port of Fluid Construction Grammar

Project description

PyFCG

A Python interface to FCG and Babel, built on FCG Go.

Installation

The Python integration of FCG (aka PyFCG) is distributed as a pip-installable package. To install this package from PyPI, run the following command.

$ pip install pyfcg

Use

Once pip-installed, PyFCG can readily be imported as a module into Python programs. It is customary to define fcg as an alias for the PyFCG module, so that all functionality is available within the fcg namespace (functions and variables are thereby prefixed with fcg.)

You initialise PyFCG as follows:

>>> import pyfcg as fcg
>>> fcg.init()

Many FCG functions depend on the fcg-go precompiled binary, which you loaded (or download if necessary) by calling the init() function. On macOS, you will need to accept opening the application bundle by clicking "open" in the popup window.

Example: Creating an FCG Agent

The Agent class will usually be your main entry point. The idea is that an agent has a grammar (of type Grammar), which in turn holds constructions (of type Construction). In PyFCG, a grammar will always be tied to an agent. Upon creation, an agent is automatically initialised with an empty grammar, i.e. a grammar that holds zero constructions.

>>> demo_agent = fcg.Agent()

>>> demo_agent
<Agent: agent (id: agent-42) ~ 0 constructions>

>>> demo_agent.grammar.size()
0

Walkthrough Tutorials

A more in-depth showcase of PyFCG's functionalities can be found in the following interactive notebooks. Each of them walks you through the process of integrating PyFCG in a typical use case of FCG.

Documentation

The tecnical documentation of PyFCG is available at Read the Docs.

How to Cite

Van Eecke, P., & Beuls, K. (2025). PyFCG: Fluid Construction Grammar in Python. arXiv preprint.

@article{vaneecke2025pyfcg,
    author = {Paul {Van Eecke} and Katrien Beuls},
    title = {PyFCG: Fluid Construction Grammar in Python},
    year = {2025},
    journal = {arXiv preprint arXiv:},
    doi = {10.48550/arXiv.2505.12920},
}

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

pyfcg-0.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

pyfcg-0.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file pyfcg-0.2.tar.gz.

File metadata

  • Download URL: pyfcg-0.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pyfcg-0.2.tar.gz
Algorithm Hash digest
SHA256 637cf4b5cc6299959600f3269755c37742c4ed47cd2d26f3b6209d6f29a0074a
MD5 1f0645fae13d72471185b2ac2bb31ef6
BLAKE2b-256 abc033fbef4fcc44a8c82d93fbb2cd70c2106bfab9baefea09a6fbb6938235b4

See more details on using hashes here.

File details

Details for the file pyfcg-0.2-py3-none-any.whl.

File metadata

  • Download URL: pyfcg-0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pyfcg-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d174ba18ea510b1c65d44142202b73fb12c843ec2951e18c5135318a668dd62
MD5 55b9abfc4ac3b6676796aa9d2d03bec1
BLAKE2b-256 862b1885ffc536e29912dfad896ffd4cd662a9cff6c40e3aae6f27d6a62e0edb

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