Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a new property to detect tags that may be (or MUST be) used as Wref's #63

Closed
kosloot opened this issue Jan 21, 2019 · 2 comments
Closed
Assignees
Labels
enhancement ready Implemented but not released yet
Milestone

Comments

@kosloot
Copy link
Collaborator

kosloot commented Jan 21, 2019

In the code for folia.py and libfolia, there are several places where we have to check if a Word, Phoneme or Morpheme is to be handled special, e.g. as a Wref.

Examples: (folia.py)

            if isinstance(child, (Word, Morpheme, Phoneme)):
                #Include REFERENCES to word items instead of word items themselves
                attribs['{' + NSFOLIA + '}id'] = child.id
            if isinstance(c,Word) or isinstance(c,Morpheme) or isinstance(c, Phoneme):
                targets.append(c)
                if type is layerclass:
                    for e2 in layer.select(AbstractSpanAnnotation,set,True, (True, Word, Morpheme)):
                        if not isinstance(e2, AbstractSpanRole) and self in e2.wrefs():
                            yield e2

(in the latter case I even wonder if Phoneme is missing there?)

Examples from folia_impl.cxx

    for ( const auto& el : data ) {
      if ( ( el->element_id() == Word_t ||
	     el->element_id() == Phoneme_t ||
	     el->element_id() == Morpheme_t )
	   && el->refcount() > 0 ){
	xmlNode *t = XmlNewNode( foliaNs(), "wref" );
    if ( c->parent() &&
	 !( c->element_id() == WordReference_t
	    || c->element_id() == Word_t
	    || c->element_id() == Morpheme_t
	    || c->element_id() == Phoneme_t ) ) {

etc.

Maybe it is a good idea to create a property to select those special cases, where Word, Morpheme and Phoneme have a property REFERABLE, or such. It makes the code clearer, faster and more robust.

@kosloot kosloot added this to the v2.0 milestone Jan 21, 2019
@proycon
Copy link
Owner

proycon commented Jan 21, 2019

That's a good idea indeed, I'll think of something.

proycon added a commit that referenced this issue Feb 4, 2019
@proycon
Copy link
Owner

proycon commented Feb 4, 2019

I added a property that will be called WREFABLE in the C++ code.

@proycon proycon added the ready Implemented but not released yet label Feb 4, 2019
proycon added a commit that referenced this issue Mar 7, 2019
@proycon proycon closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ready Implemented but not released yet
Projects
None yet
Development

No branches or pull requests

2 participants