dkpro / dkpro-pycas

Library for working with UIMA CAS XMI files in Python. This library is deprecated. Use DKPro Cassis instead!
https://github.com/dkpro/dkpro-cassis
Apache License 2.0
3 stars 3 forks source link

help getting started #3

Closed mromanello closed 6 years ago

mromanello commented 6 years ago

Hi,

What would be the best place for me to learn how to use the pyCAS library?

I had a look at the tests, but I was wondering if you have any somehow more descriptive code (e.g. notebook) about the creation of a CAS-XMI file?

Many thanks in advance

reckart commented 6 years ago

@mromanello I'm afraid we have no tutorial code on it. The use-case we had was reading in an existing XMI+typesystem, make modifications to it and write it out again. If the test cases do not include an example where a CAS is created from scratch, then it might even not be possible - I do knot know.

mromanello commented 6 years ago

no, no, my use case is simply to create a CAS starting from a file in another format and already existing XMI+typesystem

reckart commented 6 years ago

Having had a quick look at the CasFactory, it seems that the case to create a CAS from scratch (i.e. using a type system but without a pre-existing XMI file) is currently not considered:

https://github.com/dkpro/dkpro-pycas/blob/219b16a9285fb16f1081ba491705cbf4b91f36fc/pycas/pycas/cas/core/CasFactory.py#L27-L35

But maybe (?) it could easily be implemented by adding another construction method which simply skips these two lines?

https://github.com/dkpro/dkpro-pycas/blob/219b16a9285fb16f1081ba491705cbf4b91f36fc/pycas/pycas/cas/core/CasFactory.py#L33-L34

mromanello commented 6 years ago

ok, before I start getting my hands dirty with the code, a couple of questions:

mromanello commented 6 years ago

actually, this test seems to cover the creation of a CAS from scratch (but without using the CASFactory):

https://github.com/dkpro/dkpro-pycas/blob/219b16a9285fb16f1081ba491705cbf4b91f36fc/pycas/test/TestCasReader.py#L415-L500

reckart commented 6 years ago

Indeed :)

reckart commented 6 years ago

No idea.

I guess the commands to run the test are as documented here?: https://docs.python.org/2/library/unittest.html

So something like this might work:

python -m unittest TestCasReader
mromanello commented 6 years ago

thanks. anyway I think I've figured it out, see the PR ;) hope it can be accepted.