# 'Peg' object has no attribute 'format': parsing with ACE via pyDelphin

**URL:** <https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227>\
**Category:** PyDelphin Tools\
**Created:** [November 30, 2018, 10:00pm UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227 "2018-11-30T22:00:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 30, 2018, 10:00pm UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/1 "2018-11-30T22:00:52Z")

</div>

I am trying to process a testsuite with ACE, via pydelphin.

I created a toy testsuite with mkprof:

```auto
delphin.sh mkprof --input toy.txt --relation Relations output/tsdb/

```

I took the Relations file from logon/lingo/lkb/src/tsdb/skeletons/english/. (I don’t know if that is right.)

Then:

```auto
ts = itsdb.TestSuite('output/tsdb/')

```

Then I do:

```auto
with ace.AceParser('grammar.dat',executable='ace-0.9.30/ace') as cpu:
    ts.process(cpu)

```

Something is wrong however (probably with the profile?) as I get the following:

 ![16%20PM](https://delphinqa.ling.washington.edu/uploads/default/original/1X/bcff87feff46ccdea7bee601bc7db4f07a5a995d.png)

Upon inspecting:

 ![01%20PM](https://delphinqa.ling.washington.edu/uploads/default/original/1X/863b0a67f01d8425f7d8a55ded741fb1414ac656.png)

Is it obvious to anyone where I am making the wrong step?

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 30, 2018, 11:42pm UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/2 "2018-11-30T23:42:30Z")

</div>

I believe I was not importing the pydelphin module correctly and python managed to find something else called SExpr :). This particular issue seems to be resolved :).

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [December 1, 2018, 4:41am UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/3 "2018-12-01T04:41:45Z")

</div>

Yes it sounds like you have more than one version of PyDelphin. The `format()` method was added to the S-Expression parser `delphin.util.SExpr` in version v0.7.1, and that version also stopped using the `Peg` parsing functionality and introduced the `TestSuite.process()` method. I would `pip uninstall pydelphin` (maybe also with `pip3`) and make sure you’re using a virtualenv to manage dependencies for your project. Hopefully that will keep things clear and reproducible.

---

<div class="post-metadata">

**Author:** ![arademaker](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/arademaker/32/45_2.png) [@arademaker](https://delphinqa.ling.washington.edu/u/arademaker)\
**Post date:** [December 2, 2018, 12:53am UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/4 "2018-12-02T00:53:31Z")

</div>

Hi Olga and Michael,

I am also in the process of collecting a corpus with ~10k sentences to run ERG and see identify the coverage and the reason for missing analysis. I am curious to understand what you are calling a **testsuite** and what would be the benefits to use that instead of manually execute the grammar over a text file with one sentence per line and inspect the results in the output file.

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [December 2, 2018, 3:24am UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/5 "2018-12-02T03:24:17Z")

</div>

Hi Alexandre,

In this context, a testsuite means a list of sentences, grammatical or ungrammatical, associated with a number of files of a certain type and a directory structure, which all make it possible to store and explore the results of parsing in [incr tsdb()].

I really like [Michael’s docs](https://pydelphin.readthedocs.io/en/latest/tutorials/itsdb.html) on the matter.

In short, some of the benefits of using [incr tsdb()] include comparison of two testsuites and generally a number of convenient ways of examining the results. Much better than doing that manually. And everything is stored, so you can look at it again next day and start from where you finished, etc. And there is some treebanking tool.

The cons are that the software is a bit challenging to use sometimes. But possible :). Michael has some utilities in pydelphin which allow to compare testsuites as well.

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [December 2, 2018, 11:58pm UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/6 "2018-12-02T23:58:52Z")

</div>

Thanks, Olga. I want to add that an input item can yield more than one output, or zero outputs, and in a flat text file it can become easy to lose track of which outputs correspond to which inputs. The test suites help manage that, as well as store performance-related information, such as the time and memory required for a parse, estimates of the size of the search space for a parse, reasons for parse failures, reranker scores for multiple analyses, etc. These additional details can be quite useful, depending on the task, especially (but not solely) if the task is grammar development and evaluation (hence the terminology of “test” and “profile”).

---

<div class="post-metadata">

**Author:** ![arademaker](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/arademaker/32/45_2.png) [@arademaker](https://delphinqa.ling.washington.edu/u/arademaker)\
**Post date:** [December 4, 2018, 9:59am UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/7 "2018-12-04T09:59:07Z")

</div>

Thank you both. I am reading the docs. Many things to learn! My task is mainly the grammar evaluation. Given a set of sentences I want to determine what the reason when a sentence was not parsed and which sentences generate more readings and why. I suspect some ambiguities are caused by compound terms not considered as such.

BTW, sorry for changing the focus of the thread!

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [December 4, 2018, 8:01pm UTC](https://delphinqa.ling.washington.edu/t/peg-object-has-no-attribute-format-parsing-with-ace-via-pydelphin/227/8 "2018-12-04T20:01:08Z")

</div>

@arademaker I created a [new topic](https://delphinqa.ling.washington.edu/t/testsuites-and-grammar-profiling-tools/230) for this discussion. Let’s continue there.
