Skip to content

Instantly share code, notes, and snippets.

@brendano
Created February 28, 2012 06:12
Show Gist options
  • Select an option

  • Save brendano/1930048 to your computer and use it in GitHub Desktop.

Select an option

Save brendano/1930048 to your computer and use it in GitHub Desktop.
view framenet 1.5 annotations xml files
#!/bin/zsh
pat="$1"
before=10
after=10
grep -l "$pat" fndata-1.5/fulltext/*.xml | xargs python $(dirname $0)/view.py | grep --color=always -B$before -A$after "$pat"
/d/lexical/framenet % python view.py fndata-1.5/fulltext/SemAnno__Text1.xml | gist
=== The struggle against the drug lords in Colombia will be a near thing .
--- None
PENN | dt : The
PENN | nn : struggle
PENN | in : against
PENN | dt : the
PENN | nn : drug
PENN | nns : lords
PENN | in : in
PENN | NP : Colombia
PENN | md : will
PENN | vb : be
PENN | dt : a
PENN | jj : near
PENN | nn : thing
PENN | sent : .
NER | GPE : Colombia
WSL | NT : The
WSL | NT : against
WSL | NT : the
WSL | NT : in
WSL | NT : Colombia
WSL | NT : will
WSL | NT : be
WSL | NT : a
WSL | NT : .
=== The struggle against the drug lords in Colombia will be a near thing .
--- Hostile_encounter
** | Target : struggle
FE | Side_2 : against the drug lords
FE | Place : in Colombia
FE | Side_1 : None
FE | Issue : None
GF | Dep : against the drug lords
GF | Dep : in Colombia
PT | PP : against the drug lords
PT | PP : in Colombia
=== The struggle against the drug lords in Colombia will be a near thing .
--- Leadership
** | Target : drug lords
FE | Leader : drug lords
FE | Governed : None
=== The struggle against the drug lords in Colombia will be a near thing .
--- Difficulty
** | Target : near thing
FE | Experiencer : None
FE | Activity : The struggle against the drug lords in Colombia
GF | Ext : The struggle against the drug lords in Colombia
PT | NP : The struggle against the drug lords in Colombia
Adj | Cop : be
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- None
PENN | dt : This
PENN | nn : week
PENN | , : ,
PENN | dt : the
PENN | nn : government
PENN | VVN : arrested
PENN | NP : Jose
PENN | NP : Abello
PENN | NP : Silva
PENN | , : ,
PENN | VVD : said
PENN | to : to
PENN | vb : be
PENN | dt : the
PENN | jj : fourth
PENN | : : -
PENN | jj : ranking
PENN | nn : cartel
PENN | nn : leader
PENN | sent : .
NER | person : Jose Abello Silva
NER | organization : cartel
WSL | NT : This
WSL | NT : ,
WSL | NT : the
WSL | NT : Jose
WSL | NT : Abello
WSL | NT : Silva
WSL | NT : ,
WSL | NT : to
WSL | NT : be
WSL | NT : the
WSL | NT : -
WSL | NT : .
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Calendric_unit
** | Target : week
FE | Relative_time : This
GF | Dep : This
PT | A : This
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Arrest
** | Target : arrested
FE | Authorities : the government
FE | Suspect : Jose Abello Silva , said to be the fourth - ranking cartel leader
FE | Time : This week
FE | Charges : None
GF | Ext : the government
GF | Obj : Jose Abello Silva , said to be the fourth - ranking cartel leader
GF | Dep : This week
PT | NP : the government
PT | NP : Jose Abello Silva , said to be the fourth - ranking cartel leader
PT | NP : This week
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Statement
** | Target : said
FE | Message : Jose Abello Silva
FE | Message : to be the fourth - ranking cartel leader
FE | Speaker : None
GF | Ext : Jose Abello Silva
GF | Dep : to be the fourth - ranking cartel leader
PT | NP : Jose Abello Silva
PT | VPto : to be the fourth - ranking cartel leader
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Ordinal_numbers
** | Target : fourth
FE | Basis_of_order : None
FE | Item : cartel leader
GF | Ext : cartel leader
PT | NP : cartel leader
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Leadership
** | Target : leader
FE | Governed : cartel
FE | Leader : Jose Abello Silva
FE | Descriptor : fourth - ranking
GF | Dep : cartel
GF | Ext : Jose Abello Silva
GF | Dep : fourth - ranking
PT | N : cartel
PT | NP : Jose Abello Silva
PT | AJP : fourth - ranking
Noun | Cop : be
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Organization
** | Target : cartel
FE | Organization : cartel
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Organization
** | Target : government
FE | Organization : government
FE | Members : None
=== This week , the government arrested Jose Abello Silva , said to be the fourth - ranking cartel leader .
--- Occupy_rank
** | Target : ranking
FE | Rank : fourth
FE | Item : cartel leader
FE | Dimension : None
GF | Dep : fourth
GF | Head : cartel leader
PT | AJP : fourth
PT | N : cartel leader
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- None
PENN | PP : He
PENN | md : will
PENN | rb : probably
PENN | vb : be
PENN | VVN : extradited
PENN | to : to
PENN | dt : the
PENN | NP : U.S.
PENN | in : for
PENN | nn : trial
PENN | in : under
PENN | dt : an
PENN | nn : extradition
PENN | nn : treaty
PENN | NP : President
PENN | NP : Virgilia
PENN | NP : Barco
PENN | VHZ : has
PENN | VVN : revived
PENN | sent : .
NER | GPE : U.S.
NER | person : Virgilia Barco
WSL | NT : He
WSL | NT : will
WSL | NT : be
WSL | NT : to
WSL | NT : the
WSL | NT : U.S.
WSL | NT : for
WSL | NT : under
WSL | NT : an
WSL | NT : Virgilia
WSL | NT : Barco
WSL | NT : has
WSL | NT : .
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Likelihood
** | Target : probably
FE | Hypothetical_event : He will
FE | Hypothetical_event : be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived
GF | Head : He will
GF | Head : be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived
PT | Sfin : He will
PT | Sfin : be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Trial
** | Target : trial
FE | Charges : None
FE | Defendant : He
FE | Judge : None
GF | Ext : He
PT | NP : He
Noun | Supp : for
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Leadership
** | Target : President
FE | Leader : Virgilia Barco
FE | Governed : None
GF | Appositive : Virgilia Barco
PT | NP : Virgilia Barco
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Extradition
** | Target : extradited
FE | Suspect : He
FE | Crime_jurisdiction : to the U.S.
FE | Purpose : for trial
FE | Legal_Basis : under an extradition treaty President Virgilia Barco has revived
FE | Authorities : None
FE | Current_jurisdiction : None
GF | Ext : He
GF | Dep : to the U.S.
GF | Dep : for trial
GF | Dep : under an extradition treaty President Virgilia Barco has revived
PT | NP : He
PT | PP : to the U.S.
PT | PP : for trial
PT | PP : under an extradition treaty President Virgilia Barco has revived
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Extradition
** | Target : extradition
FE | Authorities : None
FE | Crime_jurisdiction : None
FE | Current_jurisdiction : None
FE | Suspect : None
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Cause_to_resume
** | Target : revived
FE | Agent : President Virgilia Barco
FE | Process : an extradition treaty
FE | Hiatus : None
GF | Ext : President Virgilia Barco
GF | Obj : an extradition treaty
PT | NP : President Virgilia Barco
PT | NP : an extradition treaty
=== He will probably be extradited to the U.S. for trial under an extradition treaty President Virgilia Barco has revived .
--- Be_in_agreement_on_action
** | Target : treaty
FE | Obligation : extradition
FE | Party_1 : None
FE | Party_2 : None
GF | Dep : extradition
PT | N : extradition
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- None
PENN | rb : Later
PENN | , : ,
PENN | dt : another
PENN | jj : high
PENN | : : -
PENN | jj : ranking
PENN | nn : trafficker
PENN | , : ,
PENN | NP : Leonidas
PENN | NP : Vargas
PENN | , : ,
PENN | VBD : was
PENN | VVN : arrested
PENN | cc : and
PENN | cd : 1,000
PENN | nns : pounds
PENN | in : of
PENN | nn : dynamite
PENN | VVD : seized
PENN | sent : .
NER | person : Leonidas Vargas
WSL | NT : Later
WSL | NT : ,
WSL | NT : another
WSL | NT : -
WSL | NT : ,
WSL | NT : Leonidas
WSL | NT : Vargas
WSL | NT : ,
WSL | NT : was
WSL | NT : and
WSL | NT : of
WSL | NT : .
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Position_on_a_scale
** | Target : high
FE | Item : trafficker
FE | Variable : None
GF | Ext : trafficker
PT | NP : trafficker
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Arrest
** | Target : arrested
FE | Suspect : another high - ranking trafficker , Leonidas Vargas
FE | Time : Later
FE | Authorities : None
FE | Charges : None
GF | Ext : another high - ranking trafficker , Leonidas Vargas
GF | Dep : Later
PT | NP : another high - ranking trafficker , Leonidas Vargas
PT | AVP : Later
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Measure_mass
** | Target : pounds
FE | Count : 1,000
FE | Unit : pounds
FE | Stuff : of dynamite
GF | Quant : 1,000
GF | Dep : of dynamite
PT | Num : 1,000
PT | PP : of dynamite
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Taking
** | Target : seized
FE | Theme : 1,000 pounds of dynamite
FE | Agent : None
FE | Time : Later
FE | Source : None
GF | Ext : 1,000 pounds of dynamite
GF | Dep : Later
PT | NP : 1,000 pounds of dynamite
PT | AVP : Later
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Commerce_scenario
** | Target : trafficker
FE | Goods : None
FE | Seller : Leonidas Vargas
FE | Buyer : None
GF | Appositive : Leonidas Vargas
PT | NP : Leonidas Vargas
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Cardinal_numbers
** | Target : 1,000
FE | Number : 1,000
FE | Entity : pounds of dynamite
GF | Head : pounds of dynamite
PT | N : pounds of dynamite
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Weapon
** | Target : dynamite
FE | Weapon : dynamite
=== Later , another high - ranking trafficker , Leonidas Vargas , was arrested and 1,000 pounds of dynamite seized .
--- Occupy_rank
** | Target : ranking
FE | Rank : high
FE | Dimension : None
FE | Item : trafficker
GF | Head : trafficker
GF | Dep : high
PT | N : trafficker
PT | AJP : high
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- None
PENN | NP : President
PENN | NP : Bush
PENN | VHZ : has
PENN | VVN : agreed
PENN | to : to
PENN | VV : meet
PENN | in : within
PENN | cd : 90
PENN | nns : days
PENN | in : with
PENN | NP : Mr.
PENN | NP : Barco
PENN | , : ,
PENN | NP : President
PENN | NP : Alan
PENN | NP : Garcia
PENN | in : of
PENN | NP : Peru
PENN | cc : and
PENN | NP : President
PENN | NP : Jaime
PENN | NP : Paz
PENN | NP : Zamora
PENN | in : of
PENN | NP : Bolivia
PENN | to : to
PENN | VV : discuss
PENN | dt : the
PENN | nn : drug
PENN | nn : problem
PENN | sent : .
NER | person : Bush
NER | person : Alan Garcia
NER | GPE : Peru
NER | person : Jaime Paz Zamora
NER | GPE : Bolivia
NER | person : Mr. Barco
WSL | NT : Bush
WSL | NT : has
WSL | NT : to
WSL | NT : within
WSL | NT : with
WSL | NT : Mr.
WSL | NT : Barco
WSL | NT : ,
WSL | NT : Alan
WSL | NT : Garcia
WSL | NT : of
WSL | NT : Peru
WSL | NT : and
WSL | NT : Jaime
WSL | NT : Paz
WSL | NT : Zamora
WSL | NT : of
WSL | NT : Bolivia
WSL | NT : to
WSL | NT : the
WSL | NT : .
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Leadership
** | Target : President
FE | Leader : Bush
FE | Governed : None
GF | Appositive : Bush
PT | NP : Bush
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Make_agreement_on_action
** | Target : agreed
FE | Party_1 : President Bush
FE | Obligation : to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem
FE | Party_2 : None
GF | Ext : President Bush
GF | Dep : to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem
PT | NP : President Bush
PT | VPto : to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Leadership
** | Target : President
FE | Leader : Alan Garcia
FE | Governed : of Peru
GF | Appositive : Alan Garcia
GF | Dep : of Peru
PT | NP : Alan Garcia
PT | PP : of Peru
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Leadership
** | Target : President
FE | Leader : Jaime Paz Zamora
FE | Governed : of Bolivia
GF | Appositive : Jaime Paz Zamora
GF | Dep : of Bolivia
PT | NP : Jaime Paz Zamora
PT | PP : of Bolivia
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Discussion
** | Target : discuss
FE | Topic : the drug problem
FE | Interlocutor_1 : President Bush
FE | Interlocutor_2 : None
GF | Obj : the drug problem
GF | Ext : President Bush
PT | NP : the drug problem
PT | NP : President Bush
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Intoxicants
** | Target : drug
FE | Intoxicant : drug
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Come_together
** | Target : meet
FE | Party_1 : President Bush
FE | Time : within 90 days
FE | Party_2 : with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia
FE | Purpose : to discuss the drug problem
GF | Ext : President Bush
GF | Dep : within 90 days
GF | Dep : with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia
GF | Dep : to discuss the drug problem
PT | NP : President Bush
PT | PP : within 90 days
PT | PP : with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia
PT | VPto : to discuss the drug problem
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Predicament
** | Target : problem
FE | Cause : drug
FE | Experiencer : None
FE | Situation : problem
GF | Dep : drug
PT | N : drug
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Cardinal_numbers
** | Target : 90
FE | Number : 90
FE | Entity : days
GF | Head : days
PT | N : days
=== President Bush has agreed to meet within 90 days with Mr. Barco , President Alan Garcia of Peru and President Jaime Paz Zamora of Bolivia to discuss the drug problem .
--- Calendric_unit
** | Target : days
FE | Count : 90
GF | Quant : 90
PT | Num : 90
=== It might not be a bad idea to do that sooner , rather than later .
--- None
PENN | PP : It
PENN | md : might
PENN | rb : not
PENN | vb : be
PENN | dt : a
PENN | jj : bad
PENN | nn : idea
PENN | to : to
PENN | VV : do
PENN | in : that
PENN | rbr : sooner
PENN | , : ,
PENN | rb : rather
PENN | in : than
PENN | rb : later
PENN | sent : .
WSL | NT : be
WSL | NT : a
WSL | NT : to
WSL | NT : that
WSL | NT : ,
WSL | NT : .
WSL | NT : not
=== It might not be a bad idea to do that sooner , rather than later .
--- Likelihood
** | Target : might
FE | Hypothetical_event : It
FE | Hypothetical_event : to do that sooner , rather than later
FE | Hypothetical_event : not be a bad idea
GF | Ext : It
GF | Dep : to do that sooner , rather than later
GF | Dep : not be a bad idea
PT | NP : It
PT | VPto : to do that sooner , rather than later
PT | VPbrst : not be a bad idea
Other | Null : It
=== It might not be a bad idea to do that sooner , rather than later .
--- Intentionally_act
** | Target : do
FE | Agent : None
FE | Act : that
FE | Time : sooner , rather than later
GF | Obj : that
GF | Dep : sooner , rather than later
PT | NP : that
PT | AVP : sooner , rather than later
=== It might not be a bad idea to do that sooner , rather than later .
--- Desirable_event
** | Target : bad
** | Target : idea
FE | State_of_affairs : to do that sooner , rather than later
GF | Dep : to do that sooner , rather than later
PT | VPto : to do that sooner , rather than later
Other | Null : It
Noun | Supp : be
=== It might not be a bad idea to do that sooner , rather than later .
--- Time_vector
** | Target : sooner
** | Target : rather
** | Target : than
** | Target : later
FE | Event : to do that
FE | Landmark_event : None
FE | Direction : sooner , rather than later
GF | Head : to do that
PT | VPto : to do that
=== After the Panama fiasco , they will need some reassurance .
--- None
PENN | in : After
PENN | dt : the
PENN | NP : Panama
PENN | nn : fiasco
PENN | , : ,
PENN | PP : they
PENN | md : will
PENN | VV : need
PENN | dt : some
PENN | nn : reassurance
PENN | sent : .
NER | GPE : Panama
WSL | NT : the
WSL | NT : Panama
WSL | NT : ,
WSL | NT : they
WSL | NT : will
WSL | NT : some
WSL | NT : .
=== After the Panama fiasco , they will need some reassurance .
--- Bungling
** | Target : fiasco
FE | Place : Panama
FE | Action : None
FE | Agent : None
GF | Dep : Panama
PT | N : Panama
=== After the Panama fiasco , they will need some reassurance .
--- Time_vector
** | Target : After
FE | Direction : After
FE | Landmark_event : the Panama fiasco
FE | Event : they will need some reassurance
GF | Obj : the Panama fiasco
GF | Head : they will need some reassurance
PT | NP : the Panama fiasco
PT | Sfin : they will need some reassurance
=== After the Panama fiasco , they will need some reassurance .
--- Reassuring
** | Target : reassurance
FE | Content : None
FE | Speaker : None
FE | Experiencer : they
GF | Ext : they
PT | NP : they
=== After the Panama fiasco , they will need some reassurance .
--- Required_event
** | Target : need
FE | Required_situation : some reassurance
FE | Required_situation : they
FE | Circumstances : After the Panama fiasco
GF | Obj : some reassurance
GF | Ext : they
GF | Dep : After the Panama fiasco
PT | NP : some reassurance
PT | NP : they
PT | PP : After the Panama fiasco
from xml.etree import ElementTree as ET
import os,sys
import termcolor
def align(toks, orig):
# from tweetmotif
s_i = 0
alignments = [None]*len(toks)
for tok_i in range(len(toks)):
while True:
L = len(toks[tok_i])
if orig[s_i:(s_i+L)] == toks[tok_i]:
alignments[tok_i] = s_i
s_i += L
break
s_i += 1
if s_i >= len(orig): assert False,((orig,toks,alignments))
#if orig[s_i] != ' ': raise AlignmentFailed("nonspace advance: %s" % ((s_i,orig),))
if any(a is None for a in alignments): assert False, ((orig,toks,alignments))
return alignments
def load(filename):
# get rid of the stupid schema stuff
cmd = "cat %s | perl -pe 's/xmlns[^ >]*//g; s/xsi:schema[^ ]*//'" % filename
t = ET.parse(os.popen(cmd))
return t
class Sentence:
def __init__(_, xml_node):
_.x = xml_node
_.text = _.x.find('text').text
_.toks = _.text.split()
tok_align = align(_.toks, _.text)
_.chari2toki = [None]*len(_.text)
last_toki = 0
for c in range(len(_.text)):
try:
# quadratic time bad
toki = tok_align.index(c)
last_toki = toki
except ValueError:
toki = last_toki
_.chari2toki[c] = toki
def label2text(self, label_x):
start,end = label_x.get('start'), label_x.get('end')
if start is None and end is None:
return None
start,end = int(start),int(end)+1
return self.text[start:end]
def label2tokinds(self, label_x):
start,end = label_x.get('start'), label_x.get('end')
if start is None and end is None:
return None
start,end = int(start),int(end)
tstart,tend = self.chari2toki[start], self.chari2toki[end]
#return tstart,tend+1
return range(tstart, tend+1)
def view_file(filename):
t = load(filename)
for sent_x in t.findall('.//sentence'):
sent = Sentence(sent_x)
#print "\n===",sent.text
print "\n"
for annos in sent_x.findall('annotationSet'):
toks = sent.toks[:]
targets = [x for x in annos.findall('.//label') if x.get('name')=='Target']
for label in targets:
tokinds = sent.label2tokinds(label)
for i in tokinds:
toks[i] = termcolor.colored(toks[i],'blue',attrs=['bold'])
print "===", ' '.join(toks) ##sent.text
print "---", annos.get('frameName')
for layer in annos.findall('layer'):
#print "...", layer.get('name')
n = layer.get('name')
for label in layer.findall('.//label'):
tokinds = sent.label2tokinds(label)
ltext = sent.label2text(label)
if n=='Target':
x = '**'
#ltext = termcolor.colored(ltext,'blue',attrs=['bold'])
else:
x = n
print ' ',x,'|',label.get('name'),':', ltext
if __name__=='__main__':
for f in sys.argv[1:]:
print "\n\n***", f
view_file(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment