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.
- Tutorial 1: Grammar Formalisation and Testing
- Tutorial 2: Learning Grammars from Corpora
- Tutorial 3: The Canonical Naming Game
- Tutorial 4: Modelling Emergent Communication
Documentation
The tecnical documentation of PyFCG is available at Read the Docs.
How to Cite
Temporarily anonymised for reviewing purposes (but ArXiv's your friend).
Metadata
Release files for pyfcg 3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyfcg-3.3.tar.gz | 18.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyfcg-3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.0 kB
Release files / pyfcg-3.3.tar.gz
| Download URL | pyfcg-3.3.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2f13411ac9fed1ad0c8f65dcf0ae14e78f7d87c2e4bcbf5803d96af0298bc8d
|
|
BLAKE2b-256 checksum How to use checksums |
e275ea02fc761e1069149f3cf9087b50980ac18f53bb43c0c6b7f2ce5e962456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / pyfcg-3.3-py3-none-any.whl
| Download URL | pyfcg-3.3-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
680e3b9491423d607bb77000776d1dc72c825e25d12da9d52881f20fa15385aa
|
|
BLAKE2b-256 checksum How to use checksums |
843b1279c69d096e3def3421f97a6bfc93100c504071fa41fa3c10d3752f656d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|