Release date: 2024-08-06
- Double-quote characters are no longer parsed as roles or symbols (#143)
Release date: 2023-11-14
This release has two user-facing changes: the addition and removal of support for Python versions, and fixed reification directions for a few roles. Most of the changes in this release are for maintenance, such as updates to the way docs are built (#131), how the project is managed (#126), and how CI workflows are run (#124).
- Removed support for Python 3.6 (#123)
- Removed support for Python 3.7 (#123)
- Added support for Python 3.10 (#123)
- Added support for Python 3.11 (#123)
- Added support for Python 3.12 (#123)
- Swapped source/target for reifications (#122)
:accompanier
:example
:poss
- The installation extras
test
,docs
, anddev
(#125)
Release date: 2022-09-01
--encoding
option for thepenman
command (#109)encoding
parameter onpenman.load
andpenman.dump
(#109)
Release date: 2021-09-13
- Only regular ASCII spaces are breaking; others are treated as literal characters and may appear in symbols. (#99)
Release date: 2021-03-01
- Active but incompletely documented roles to the AMR model (#89):
:ARG6
:ARG7
:ARG8
:ARG9
:wiki
:range
- Duplicate edges no longer cause crashes with
layout.appears_inverted()
(#87) - Single-letter concepts (e.g.,
(i / i)
) no longer cause strange reconfigurations nor spurious errors about a cycle (#90) - Format epigraph data only after configuring the tree (#93)
- The return code of
penman --check
is now 1 if any graph failed the check, not just the last one.
Release date: 2021-02-22
- When configuring a tree, ensure surface alignments don't get inverted (#92)
- A root logger is now initialized when the
penman
command is used and not merely by importing thepenman
library (#95)
Release date: 2020-07-06
A no-op model is added to allow inspection of graphs without deinverting triples, and Penman is now a bit more threadsafe for multiprocessing applications.
penman.layout.Pop
class is now part of the public API (#85)penman.models.noop
model for tree-like graph usage (#84)
penman.layout
no longer checksPOP
for object identity (#85)
Release date: 2020-05-10
This 1.0 release is not a huge difference from the previous version,
but it represents a commitment to support the API or announce any
changes, as required by semantic versioning.
For this reason, some unused or unnecessary components have been
removed from the public API, and several functions that are expected
to be commonly used, such as parse()
and format()
for tree
operations, have been given aliases in the top-level penman
module. Consequently, there's less emphasis for creating a
PENMANCodec
object for most decoding or encoding tasks.
penman.tree.Tree.walk()
(#74)
penman.lexer
is now non-public (#77)penman.interface
is removed from the public API but remains temporarily for backward compatibility (#78)penman.layout.has_valid_layout()
; it was unusedstrict
parameter onconfigure()
andreconfigure()
inpenman.layout
parse_triples()
now prepends a colon to roles (#80)Graph.edges()
no longer returns instances whose concepts are also variables (#81)
- Make
parse()
,format()
,interpret()
, andconfigure()
available at the top-level module (#75) - Make
iterparse()
,iterdecode()
,parse_triples()
, andformat_triples()
available at the top-level module (#78) - Move the implementations of
parse()
andformat()
to separate modules from PENMANCodec (#76) - Make
penman.tree.Tree
available at the top-level module - Rename
penman.main
topenman.__main__
sopython -m penman
works as expected (#79)
Release date: 2020-02-14
This release improves the amount and behavior of functions for
processing inputs from the penman
command. It also replaces the
previous release's Model.check()
with Model.errors()
, which is
generally more useful. Finally, the new penman.constant
module is
introduced for dealing with constant values in their interpreted
datatypes.
penman.model.Model.errors()
replacesModel.check()
(#65)penman.constant
module for constant values (#69)penman.graph.Instance
subtype ofTriple
(#66)penman.model.Model.alphanumeric_order()
(#72)penman.layout.rearrange()
:attributes_first
parameter (#62)
penman.model.Model.check()
replaced byModel.errors()
(#65)
- Don't flush standard streams in
penman
command (#60)
- Return exit code of 1 when
penman --check
finds errors (#63) - Moved the
Branch
andNode
types frompenman.tree
topenman.types
penman.model.Model.canonical_order()
is now just a shortcut for callingis_role_inverted()
andalphanumeric_order()
(#72)--rearrange
and--reconfigure
can now take multiple ordered sorting criteria (#70)- The order of operations for processing inputs has changed so users can do more with shorter pipelines (#71)
Release date: 2020-02-06
- Avoid another source of concepts becoming nodes (#61)
- Only configure one tree branch for new triples (#67)
Release date: 2020-01-28
Release date: 2020-01-22
Add triple sorting to the reconfigure()
function and make it
available at the command line.
penman.model.Model.original_order()
takes aRole
instead of aBranch
argument (#53)penman.model.Model.canonical_order()
takes aRole
instead of aBranch
argument (#53)penman.model.Model.random_order()
takes aRole
instead of aBranch
argument (#53)
Release date: 2020-01-16
Partially revert some changes regarding the parsing of surface
alignments as they caused issues, particular when strings contain ~
characters.
ALIGNMENT
production inpenman.lexer.PATTERNS
(this reverts a change in v0.9.0) (#50)
- Disallow tildes in the
ROLE
andSYMBOL
patterns (this reverts a change in v0.9.0) (#50) ALIGNMENT
tokens are joined to their previousROLE
,SYMBOL
, orSTRING
, which means they can now be separated with a space (for example,(a / alpha ~1)
)
Release date: 2020-01-07
Added support for node relabeling and dereification, and also optimized parsing time by simplifying the work done during parsing.
penman.tree.Tree.reset_variables()
(#41)--make-variables=FMT
command-line option (#41)penman.surface.AlignmentMarker.from_string()
(#45)penman.model.Model.is_role_reifiable()
(wasis_reifiable()
)penman.model.Model.is_concept_dereifiable()
(#40)penman.model.Model.dereify()
(#40)penman.layout.get_pushed_variable()
(#39)penman.layout.node_contexts()
penman.transform.dereify_edges()
(#40)--dereify-edges
command-line option (#40)penman.graph.Graph.instances()
(#48)
penman.lexer.Token.value
property (#44)FLOAT
andINTEGER
productions inpenman.lexer.PATTERNS
(#44)penman.codec.PENMANCodec.ATOMS
(#44)penman.codec.PENMANCodec.IDENTIFIERS
(#44)COMMA
andCARET
productions inpenman.lexer.PATTERNS
(#43)triples
parameter for the following (#42):penman.interface.decode()
penman.interface.loads()
penman.interface.load()
penman.interface.encode()
penman.interface.dumps()
penman.interface.dump()
penman.codec.encode()
penman.codec.decode()
ALIGNMENT
production inpenman.lexer.PATTERNS
(#45)penman.model.Model.is_reifiable()
(nowis_role_reifiable()
)
- Remove support for numeric data detection and casting (#44)
- Allow commas and carets in the
SYMBOL
pattern (#43) - Allow tildes in the
ROLE
andSYMBOL
patterns (#45) - Surface alignments are extracted and formatted in
penman.layout
, notpenman.lexer
orpenman.codec
(#45) - Tree branches are simple 2-tuples:
(role, target)
(#45) penman.layout.appears_inverted()
better detects inverted triples when the target in the serialization was just a variable (#47)- Nodes without concepts get a default concept of
None
(again); this means that(b :ARG0-of (a))
is 3 triples instead of 1, but it will help distinguish node attributes from true edges. penman.layout.interpret()
no longer deinverts attributes; doing so leads to triples with constants as a source (or treating constants as variables); this requires looking at the variables of tree nodes to determine which are attributes.penman.graph.Graph.attributes()
no longer returns:instance
triples (#48)
Release date: 2019-12-12
This release adds a handful of minor functions and expands the documentation.
penman.layout.appears_inverted()
(#37)- Tree branch sorting functions (#31)
penman.model.Model.original_order()
penman.model.Model.canonical_order()
penman.model.Model.random_order()
penman.layout.rearrange()
(#31)--rearrange=(canonical|random)
command-line option
Release date: 2019-11-25
-q
/--quiet
command line option-v
/--verbose
command line option- Loggers that print some diagnostic information at the DEBUG and INFO levels
- Remove superfluous
POP
layout markers when graphs have duplicated triples (#34) - Avoid
KeyError
on edge and attribute reification when graphs have duplicated triples (#35)
Model.reify()
no longer inverts the incoming triple
Release date: 2019-11-21
The v0.7.0 release was missing a declaration for the new
penman.models
sub-package, so it was not available for new
installs. This release fixes that.
- The
penman.models
package is now declared insetup.py
- The documentation now looks one level up when building (this is just "in case", as I think the missing package problem was the real culprit for faulty documentation builds.)
Release date: 2019-11-21
This release comprises a major restructuring from previous
versions. No longer is there a single penman.py
module, but the
penman
package, which has the following modules:
__about__
- package meta-informationcodec
- high-level parsing and formattingepigraph
- epigraphical markersexceptions
- exception classesgraph
- triple and graph classesinterface
-load()
,dump()
, etc.layout
- interpretation and configuration of treeslexer
- low-level parsingmain
- command-line interfacemodel
- semantic model classsurface
- surface alignment informationtransform
- tree and graph transformationstree
- tree classtypes
- static type checking definitions
In addition, there is a models
sub-package for provided semantic
models, although it currently only contains one: models.amr
.
While some of the original API is preserved through imports in
penman/__init__.py
, there are a number of backward-incompatible
changes in this release. Changes that affect the old API are listed
below, but otherwise the new functionality is under the added
modules.
- Removed support for Python 2.7
- Removed support for Python 3.3
- Removed support for Python 3.4
- Removed support for Python 3.5
- Added support for Python 3.6
- Added support for Python 3.7
- Added support for Python 3.8
penman.Graph.epidata
penman.Graph.metadata
penman.PENMANCodec.parse()
penman.PENMANCodec.parse_triples()
penman.PENMANCodec.iterparse()
penman.PENMANCodec.format()
penman.PENMANCodec.format_triples()
penman.codec
penman.epigraph
penman.epigraph.Epidatum
penman.exceptions
penman.exceptions.GraphError
penman.exceptions.LayoutError
penman.exceptions.SurfaceError
penman.exceptions.ModelError
penman.graph
penman.graph.CONCEPT_ROLE
penman.graph.Edge
penman.graph.Attribute
penman.layout
penman.layout.LayoutMarker
penman.layout.Push
penman.layout.POP
penman.layout.interpret()
penman.layout.configure()
penman.layout.reconfigure()
penman.layout.has_valid_layout()
penman.lexer
penman.lexer.PATTERNS
penman.lexer.PENMAN_RE
penman.lexer.TRIPLE_RE
penman.lexer.Token
penman.lexer.TokenIterator
penman.lexer.lex()
penman.model
penman.model.Model
penman.models
penman.models.amr
penman.models.amr.roles
penman.models.amr.normalizations
penman.models.amr.reifications
penman.models.amr.model
penman.surface
(#19)penman.surface.AlignmentMarker
penman.surface.Alignment
penman.surface.RoleAlignment
penman.surface.alignments()
penman.surface.role_alignments()
penman.transform
penman.transform.canonicalize_roles()
penman.transform.reify_edges()
(#27)penman.transform.reify_attributes()
penman.transform.indicate_branches()
penman.tree
(#16)penman.tree.Tree
penman.tree.is_atomic()
- docopt dependency (#20)
penman.EncodeError
penman.AMRCodec
penman.Triple.inverted
penman.PENMANCodec.is_relation_inverted()
penman.PENMANCodec.invert_relation()
penman.PENMANCodec.handle_triple()
penman.PENMANCodec.triples_to_graph()
penman.original_order()
penman.out_first_order()
penman.alphanum_order()
- Graphs can no longer be encoded with attributes as the top (#15)
- For AMR, both
:mod
and:domain
are for non-inverted relations, although their inverses can be canonicalized to the other (#26) - Epigraphical layout markers allow the tree structure to be preserved without modifying the pure graph's triples (#25)
- Restructured project as a package
- Use Sphinx-generated documentation
- Replaced "relation" with "role" when "role" is intended.
- Replaced "node type" and "node label" with "concept"
- Replaced "node identifier" with "variable"
- Roles now include the colon (
:ARG0
, notARG0
), following convention penman.PENMANCodec
no longer takes theindent
orrelation_sort
parameterspenman.PENMANCodec.encode()
now takesindent
andcompact
parameterspenman.PENMANCodec.iterdecode()
works on streams (#21)penman.PENMANCodec
now reads comments with metadata (#23)penman.PENMANCodec
no longer accepts non-symbol variables (#13)penman.dump()
now writes iteratively to a stream (#22)- The following no longer take the
cls
parameter for a codec class, nor**kwargs
to configure that class, but instead amodel
parameter for the semantic model:penman.decode()
penman.encode()
penman.loads()
penman.dumps()
penman.load()
penman.dump()
- The following now take the formatting parameters
indent
andcompact
:penman.encode()
penman.dumps()
penman.dump()
penman.Graph.triples
is now a member variable instead of a methodpenman.Graph
class is mutable (#32)- Concepts (node labels) in
penman.Graph
now have a special role known to thepenman.graph
module, which can help avoid some reentrancy issues (#29)
Release date: 2017-10-04
- Value-cast patterns terminated with
$
to invalid casts (#9) - Raise EncodeError when attempting to encode empty graphs (#14)
- Redefine NODETYPE_RE for AMRCodec (#17)
- Remove specific float and int parsing in variables/nodetypes for the default parser (the numeric values are still parses as atoms) (#17)
Release date: 2017-03-14
- Some additional regular expressions on
PENMANCodec
to influence parsing behavior CONTRIBUTING.md
- Allow numeric and string variables and node types
- Grammar in README now more accurately reflect parsing behavior (and vice versa)
Release date: 2017-03-04
- By default, always preserve relation order when given (fixes #6)
__version_info__
now gives integers for numeric parts
PenmanError
as a exception base classEncodeError
for errors during encoding; derived fromPenmanError
- Functions for ordering relations (these behave like
sorted()
, in that they take and return a list). Note that the type relation (given bycodec.TYPE_REL
), if present, always appears first, regardless of the sorting method.original_order
- the default; return the list as-isout_first_order
- sort all true orientations before inverted orientations; otherwise order is retainedalphanum_order
- former default; sort relations alphabetically with embedded integers sorted numerically (likesort -V
)
- Added disclaimer to
README.md
saying that this module is not affiliated with ISI, the PENMAN project, or the AMR project Triple
objects can now have aninverted
attribute that can be given as a fourth instantiation parameter. The object is still treated as a 3-tuple, sosrc, rel, tgt = triple
still works (andtriple[3]
will not get the inversion status; usetriple.inverted
). Valid values areFalse
(true orientation),True
(inverted orientation), andNone
(no orientation specified).--indent
option for commandline usageAMRCodec
with a more restrictive grammar and special inversions
DecodeError
now derives fromPenmanError
PENMANCodec
now takes arelation_sort
parameter whose value is a function that sortsTriple
objects (see Added above)- Updated the PEG definition in
README.md
, and accompanying prose.
Release date: 2017-02-20
- Numeric conversion in
PENMANCodec.handle_triple()
now happens to both sources and targets, andhandle_triple()
is now run on the top, as well. Fixes #4 Graph.__str__()
now initializes a default codec for serialization.- Incorrect script usage fixed in README.md and from
penman.py --help
- Updated documentation
Release date: 2017-01-13
- Properly trim off ^ in triple-conjunction parsing.
TOP_VAR
andTOP_REL
are added toPENMANCodec
(these were module-level variables prior to v0.4.0); they are only used for triple-conjunctions. If left asNone
, they will not be printed or interpreted.PENMANCodec.triples_to_graph
to instantiate a Graph with awareness of codec configuration (e.g.TOP_VAR
,TYPE_REL
, etc.)
PENMANCodec.handle_value()
- value conversion is now done inPENMANCodec.handle_triple()
, which has access to relation name, etc.
- Decoupled
Graph
from the codec by removing thecodec
parameter and its usage in the class methods. Graphs can be instantiated with awareness of the codec via the codec'striples_to_graph()
method. PENMANCodec
returns all node type triples before other edge triples.PENMANCodec
reads/writes TOP nodes in triple conjunctions ifTOP_VAR
andTOP_REL
are set (see above).- Default node types are no longer stored as triples. This means a graph
like
(a / a :ARG b)
cannot say ifb
is a node or just a symbol. Let's see how far this gets us before re-adding such support. PENMANCodec.handle_triple()
now manages value conversion- PENMAN serialization now sorts relations like
sort -V
Release date: 2017-01-01
This release is a major rewrite of the serialization mechanism. Now a serialization codec manages the interface between graphs and PENMAN or triple conjunctions, and it can be instantiated with parameters or subclassed to customize behavior.
PENMANCodec
class for managing serialization to/from PENMAN and triple conjunctionsGraph.attributes()
returns terminal relations
- Module-level
TOP
andTOP_RELATION
are no longer used for customizing serialization behavior (seePENMANCodec
) Graph.concepts()
Graph.constants()
Triple.is_inverted()
(usePENMANCodec.is_relation_inverted()
)
Graph.to_triples()
is nowGraph.triples()
and no longer has anormalize
parameter, but can now be filtered bysource
,relation
, andtarget
, as withGraph.edges()
andGraph.attributes()
Graph.edges()
only returns triples between nonterminal nodes- Default relation for node types is
instance
, sinceinstance-of
seems to not be used, documented, or intuitive. load()
,loads()
,dump()
, anddumps()
now take acls
parameter for a serialization codec, and any additional**kwargs
are passed to its constructor.
Release date: 2017-01-01
TOP
andTOP_RELATION
as module-level variablesis_relation_inverted()
invert_relation()
Graph.top
Graph.variables()
Graph.concepts()
Graph.constants()
Graph.edges()
Graph.from_triples()
can take an explicittop=...
parameter- The
indent
parameter toGraph.to_penman()
now takes a range of values:indent=True
is the default with adaptive indentationindent=False
andindent=None
do not insert newlines and use a single space to delimit fieldsindent=N
, whereN
is an integer, indents N spaces after a newline
load()
,loads()
,dump()
, anddumps()
can now take atriples=...
parameter (default: False); if True, read/write as triples
Release date: 2016-11-09
- PENMAN serialization uses slightly more sophisticated default weights for choosing when to invert edges, which prevents some ugly graphs.
Graph.to_triples()
takes anormalize=True
parameter (defaultFalse
) to uninvert inverted edges.- Running the script with
--triples
now prints the logical conjunction of triples (e.g.instance-of(b, bark-01) ^ ARG0(b, d) ^ instance-of(d, dog)
).
Release date: 2016-11-08
First release with very basic functionality.
Triple
namedtuple for edge information (source, relation, target)Graph
stores graph data and provides methods for accessload()
/loads()
reads Penman files/stringsdump()
/dumps()
writes Penman files/strings