Select attribute value within attribute with multiple values

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Select attribute value within attribute with multiple values

Vanessa Juloux
Dear all,

I am currently parsing TEI data within R, amongst which @ana attributes in a <ref> that have several values.
My apologies for this post in the TEI list, but since parsing TEI data is very specific, I hope you will be able to help me since I am looking for an answer for few days now.

Do you know how is working the hierarchy of multiple attribute values?

Example in TEI: <ref ana="whatAction #ktu1-3_ii_l6b_tḫtṣb #confrontation #action">Action, subcategory confrontation
                                        <stage ana="whatResult #result #defeate_ofOpposition"/></ref>

The parsing in R is done with getNodeSet and xmlGetAttr functions:

interpRef <- getNodeSet(doc,"//ns:ref[contains(@ana, 'whatAction')]", ns)
#interpRef=paste0("'#",interpRef,"'")
interpRef_ana <- for (i in 1:length(interpRef)) print(paste(xmlGetAttr(interpRef[[i]],"ana")))

Result:
[1] "whatAction #ktu1-3_ii_l6b_tḫtṣb #confrontation #action"
Do you know how I can select relevant attribute value from @ana? I would like to have only:
[1] "#ktu1-3_ii_l6b_tḫtṣb #confrontation"


A suggestion?

In advance, thank you very much.

Best,
Vanessa
Reply | Threaded
Open this post in threaded view
|

Re: Select attribute value within attribute with multiple values

Vanessa Juloux
Dear all,

Following my previous email, I just want to tell you that I found a solution.
For those who might be interested for parsing TEI data within R:

#getNodeSet from //ns:, then
listInterp <- unlist(nodelist)
listInterp
 for (i in 1:length(interp)) {
   {
   (cbind(
    (a=(KTU = (xmlGetAttr(interp[[i]],"ana")))), 
    (b=(verb.category = (xmlGetAttr(interpRef[[i]],"ana")))),
    (c=(Character = (xmlGetAttr(interpPers[[i]],"ana")))),
    (d=(State =(xmlGetAttr(interpPers_State[[i]],"ana")))),
    (e= Location = (xmlGetAttr(interpPlace_Loc[[i]],"ana")))
     ))
   listInterp[[i]] <- (paste(word(word(a,-1)), collapse=": ", (word(b, -2, -1)), (word(c, -2)), (word(d, -1)), (word(e, -1)))) #to select attribute values
    }
   listInterp <- unlist(lapply(listInterp,gsub,pattern="#",replacement="")) #to replace # by empty space  
}
listInterp

> Result for listInterp (sample)
[1] "ktu1-3_ii_l5b-6a verb.competition contend ANT active outside" 
[2] "ktu1-3_ii_l6b verb.competition contend ANT active outside"   
[3] "ktu1-3_ii_l7 verb.emotion humiliation ANT active outside"    
[4] "ktu1-3_ii_l8 verb.emotion humiliation ANT active outside"    


Best,

Vanessa

---

Vanessa Juloux | Ph.D. candidate

» Ecole Pratique des Hautes Etudes  (EPHE, France), Paris Sciences et Lettres (PSL, France) Research University 
» Cultural anthropology of Ancient Near East, 
» Data coordinator & digital humanities monitoring (EPHE, PSL)
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research, USA)
Mobile + WhatsApp: +33 (0) 6 98 97 02 02
Academiavanessajuloux.xyz   
@vjuloux, skype: mosioatunya
Le 6 avr. 2017 à 00:43, Vanessa Juloux <[hidden email]> a écrit :

Dear all,

I am currently parsing TEI data within R, amongst which @ana attributes in a <ref> that have several values.
My apologies for this post in the TEI list, but since parsing TEI data is very specific, I hope you will be able to help me since I am looking for an answer for few days now.

Do you know how is working the hierarchy of multiple attribute values?

Example in TEI: <ref ana="whatAction #ktu1-3_ii_l6b_tḫtṣb #confrontation #action">Action, subcategory confrontation
                                       <stage ana="whatResult #result #defeate_ofOpposition"/></ref>

The parsing in R is done with getNodeSet and xmlGetAttr functions:

interpRef <- getNodeSet(doc,"//ns:ref[contains(@ana, 'whatAction')]", ns)
#interpRef=paste0("'#",interpRef,"'")
interpRef_ana <- for (i in 1:length(interpRef)) print(paste(xmlGetAttr(interpRef[[i]],"ana")))

Result:
[1] "whatAction #ktu1-3_ii_l6b_tḫtṣb #confrontation #action"
Do you know how I can select relevant attribute value from @ana? I would like to have only:
[1] "#ktu1-3_ii_l6b_tḫtṣb #confrontation"


A suggestion?

In advance, thank you very much.

Best,
Vanessa

Reply | Threaded
Open this post in threaded view
|

Ongoing text encoding capacity

Paul Schaffner
Is anyone aware of a survey (or willing to provide information
sufficient for
me to make a survey) of those universities, departments, libraries, and
the like
that provide some sort of ongoing capacity to produce marked-up text?
Whether through long-standing projects, or a long-standing service that
survives from one project to the next? I am thinking particularly of
TEI-based
encoding, or at least of texts for which TEI is a reasonable solution.

pfs
--
Paul Schaffner  Digital Content & Collections
University of Michigan Libraries
[hidden email] | http://www.umich.edu/~pfs/
Reply | Threaded
Open this post in threaded view
|

Re: Ongoing text encoding capacity

Kevin Hawkins
Paul,

Michelle Dalmau and I conducted a survey a few years ago of those
working in libraries to ask about their involvement with and interest in
text encoding:

http://jtei.revues.org/1322

We touched on some of these questions.  If it matters what is done
outside libraries, then this may be too narrow to be useful.

You might also be interested in the research that was part of the grant
supporting the development of TEI Tite:

http://www.tei-c.org/Vault/Tite/

That work, however, is even older.

Kevin

On 4/7/17 5:32 PM, Paul Schaffner wrote:

> Is anyone aware of a survey (or willing to provide information
> sufficient for
> me to make a survey) of those universities, departments, libraries, and
> the like
> that provide some sort of ongoing capacity to produce marked-up text?
> Whether through long-standing projects, or a long-standing service that
> survives from one project to the next? I am thinking particularly of
> TEI-based
> encoding, or at least of texts for which TEI is a reasonable solution.
>
> pfs
>