Giter VIP home page Giter VIP logo

cldflex's People

Contributors

fmatter avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cldflex's Issues

check for None when splitting on Sentence_Number.Phrase_Number

In line 406 of flex2csv.py, you split an ID into sentence number (before period) and phrase number (after period). This fails if the sentence number had not been retrieved.

Be tolerant with records without sentence numbers. Users might still want to convert them.

As a quick fix, I used

    if "." in rec.get("Sentence_Number", "noperiod"):
        rec["Sentence_Number"], rec["Phrase_Number"] = rec["Sentence_Number"].split(".")
    return rec

but try/catch or checking for "Sentence_Number" in rec should also work

enclitlics double

For the attached input XML file, enclitics are outputted twice in both the vernacular line (=da,=peyang) and the gloss line (=NOM,=COM).

ause=da=da	llɨg	kälsre=peyang=peyang
...
old woman=NOM=NOM	boy	small=COM=COM

Expected:

ause=da	llɨg	kälsre=peyang
old woman=NOM	boy	small=COM

In the XML file, we find two instances of "da", but only one "NOM" in uppercase, suggesting that indeed certain fields are outputted twice.

<morph type="enclitic" guid="d7f713e1-e8cf-11d3-9764-00c04f186933">
   <item type="txt" lang="kit">=da</item>
   <item type="cf" lang="kit">=da</item>
   <item type="gls" lang="en">=NOM</item>
   <item type="msa" lang="en">nominal enclitic</item>
</morph>
<item type="gls" lang="en">nom</item>
<item type="pos" lang="en">nominal enclitic</item>

test.xml.txt

be tolerant with segnum language

In line 420 of flex2csv.py you have

...
   (f"segnum_{conf['gloss_lg']}_phrase", "Sentence_Number"),
...

I do not know how often there is a different "segnum" per language in flex files. In my case, the segnum language was set to French, and the value was "3.1", so not particularly localized. The program failed hard and produced no output.

I can of course prepare some yaml file to take care of this, but maybe one could in the case of only one segnum being present for a given sentence simply default to that segnum instead of requiring the language to be specified.

~/.config/cldf/catalog.ini has no entry for glottolog'

I try to convert a file in script.

from cldflex.flex2csv import convert
flexinputfilepath = "ende.xml"
corpus = convert(flexinputfilepath)

works fine, as far as I can tell. But I want CLDF, so I say

from cldflex.flex2csv import convert
flexinputfilepath = "ende.xml"
corpus = convert(flexinputfilepath,cldf=True)

This gives me

KeyError: 'Config /home/snordhoff/.config/cldf/catalog.ini has no entry for glottolog'

https://github.com/fmatter/cldflex tells me "pass a dict to the convert methods." I have tried

convert(filename, conf={'Glottocode':'abcd1234'},cldf=True)
convert(filename, conf={'glottolog':'abcd1234'},cldf=True)

, to no avail.

I have also created a yaml file with the content Glottocode: abcd1234, as asked for by https://github.com/fmatter/cldflex. However, the script complains that it does not find an ini file, and that there is no entry for "glottolog". So I wonder whether yaml or ini is required. In any case, I have also created an ini file in ~/.config.cldf. I give the content below

[glottolog]
Glottocode = abcd1234
glottolog = abcd1234

This does not help either.
Could you share information how to provide the relevant glotto-information, or, otherwise, how to bypass the test (I do not need the glotto information for my use case).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.