本文整理汇总了Python中utilities.logger.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: process_fragments
def process_fragments(self):
"""Set fragment names, create the vectors for each fragment, run the
classifier and add links from the classifier to the fragments."""
os.chdir(self.DIR_LINK_MERGER + os.sep + 'sputlink')
perl = '/usr/local/ActivePerl-5.8/bin/perl'
perl = 'perl'
perl = self.tarsqi_instance.getopt_perl()
for fragment in self.fragments:
# set fragment names
base = fragment[0]
in_fragment = os.path.join(self.DIR_DATA, base+'.'+self.CREATION_EXTENSION)
tmp_fragment = os.path.join(self.DIR_DATA, base+'.'+self.TMP_EXTENSION)
out_fragment = os.path.join(self.DIR_DATA, base+'.'+self.RETRIEVAL_EXTENSION)
# process them
command = "%s merge.pl %s %s" % (perl, in_fragment, tmp_fragment)
(i, o, e) = os.popen3(command)
for line in e:
if line.lower().startswith('warn'):
logger.warn('MERGING: ' + line)
else:
logger.error('MERGING: ' + line)
for line in o:
logger.debug('MERGING: ' + line)
self._add_tlinks_to_fragment(in_fragment, tmp_fragment, out_fragment)
os.chdir(TTK_ROOT)
开发者ID:jasonzou,项目名称:TARSQI,代码行数:28,代码来源:wrapper.py
示例2: _process_opening_tag
def _process_opening_tag(self, element):
"""Process an opening tag, calling the appropriate handler depending
on the tag."""
logger.debug(">>" + element.content)
if element.tag == SENTENCE:
self.currentSentence = Sentence()
self.doc.addSentence(self.currentSentence)
elif element.tag == NOUNCHUNK:
self._process_opening_chunk(NounChunk, element)
elif element.tag == VERBCHUNK:
self._process_opening_chunk(VerbChunk, element)
elif element.tag == TOKEN:
self._process_opening_lex(element)
elif element.tag == EVENT:
self._process_opening_event(element)
elif element.tag == INSTANCE:
self._process_opening_make_instance(element)
elif element.tag == TIMEX:
self._process_opening_timex(element)
elif element.tag == ALINK:
self._process_alink(element)
elif element.tag == SLINK:
self._process_slink(element)
elif element.tag == TLINK:
self._process_tlink(element)
开发者ID:jasonzou,项目名称:TARSQI,代码行数:25,代码来源:converter.py
示例3: _find_slink
def _find_slink(self, event_context, fsa_lists, reltype_list):
"""Try to find an slink in the given event_context using lists of
FSAs. If the context matches an FSA, then create an slink and
insert it in the document."""
for i in range(len(fsa_lists)):
fsa_list = fsa_lists[i]
try:
reltype = reltype_list[i]
except IndexError:
# take last element of reltype list if it happens to
# be shorter than the fsa_lists
reltype = reltype_list[-1]
result = self._look_for_link(event_context, fsa_list)
#logger.out(result)
if result:
(length_of_match, fsa_num) = result
fsa = fsa_list[fsa_num]
#print fsa
#logger.out("match found, FSA=%s size=%d reltype=%s"
# % (fsa.fsaname, length_of_match, reltype))
logger.debug(21*"."+"ACCEPTED SLINK!!! LENGTH: "+str(length_of_match)+
" "+ str(reltype)+" || FSA: "+str(i)+"."+str(fsa_num)+
" PatternName: "+fsa.fsaname)
slinkAttrs = {
'eventInstanceID': self.eiid,
'subordinatedEventInstance': event_context[length_of_match-1].eiid,
'relType': reltype,
'syntax': fsa.fsaname }
self.document().addLink(slinkAttrs, SLINK)
self.createdLexicalSlink = 1
break
else:
logger.debug(".....................REJECTED SLINK by FSA: "+str(i)+".?")
开发者ID:jasonzou,项目名称:TARSQI,代码行数:34,代码来源:chunks.py
示例4: createForwardSlink
def createForwardSlink(self, forwardSlinks):
"""Only used if doc is chunked with Alembic;
that is, Adj tokens do not belong to any chunk"""
slinkedEventContext = self.parent[self.position+1:] # chunks following the currEvent
self.createSlink(slinkedEventContext, forwardSlinks[0], forwardSlinks[1]) # forwardSlinks[0]:pattern name, forwardSlinks[1]: relType
if self.createdLexicalSlink:
logger.debug("FORWARD SLINK CREATED")
开发者ID:jasonzou,项目名称:TARSQI,代码行数:7,代码来源:tokens.py
示例5: createSlink
def createSlink(self, slinkedEventContext, syntaxPatternLists, relTypeList):
"""Only used if doc is chunked with Alembic;
that is, Adj tokens do not belong to any chunk
"""
for i in range(len(syntaxPatternLists)):
self._printSequence(slinkedEventContext, 1) # DEBUGGING method
substring = self._lookForLink(slinkedEventContext, syntaxPatternLists[i])
if substring:
#log("substring\n"+str(substring)+"\n")
substringLength = substring[0]
subpatternNum = substring[1]
relType = relTypeList[i]
#patterns = syntaxPatternLists[i] # should be ith nested list in syntaxPatternLists
#patternName = patterns[subpatternNum] # should be subpatternNumth item in the list
patternName = syntaxPatternLists[i][subpatternNum]
logger.debug(21*"."+"ACCEPTED SLINK!!! LENGTH: "+str(substringLength)+" "+
str(relType)+" || FSA: "+str(i)+"."+str(subpatternNum)+
" PatternName: "+patternName.fsaname)
slinkAttrs = {
'eventInstanceID': self.eiid,
'subordinatedEventInstance': slinkedEventContext[substringLength-1].eiid,
'relType': relType,
'syntax': patternName.fsaname }
self.doc().addLink(slinkAttrs, SLINK)
self.createdLexicalSlink = 1
break
else:
logger.debug(".....................REJECTED SLINK by FSA: "+str(i)+".?")
开发者ID:jasonzou,项目名称:TARSQI,代码行数:28,代码来源:tokens.py
示例6: lookForAtlinks
def lookForAtlinks(self):
"""Examine whether the Alink can generate a Tlink."""
if self.is_a2t_candidate():
logger.debug("A2T Alink candidate " + self.attrs['lid'] + " " + self.attrs['relType'])
apply_patterns(self)
else:
logger.debug("A2T Alink not a candidate " + self.attrs['lid'] + " " + self.attrs['relType'])
开发者ID:jasonzou,项目名称:TARSQI,代码行数:7,代码来源:Alinks.py
示例7: _distributeNodes
def _distributeNodes(self):
"""Distribute the item's information over the lists in the
VChunkFeaturesLists."""
# TODO: figure out whether to keep remove_interjections
tempNodes = remove_interjections(self)
debug("\n" + '-'.join([n.getText() for n in tempNodes]))
logger.debug('-'.join([n.getText() for n in tempNodes]))
itemCounter = 0
for item in tempNodes:
#debug( " %s %-3s %-8s"
# % (itemCounter, item.pos, item.getText()), newline=False)
message_prefix = " %s %s/%s" % (itemCounter, item.getText(), item.pos)
if item.pos == 'TO':
debug( '%s ==> TO' % message_prefix)
self._distributeNode_TO(item, itemCounter)
elif item.getText() in forms.negative:
debug( '%s ==> NEG' % message_prefix)
self._distributeNode_NEG(item)
elif item.pos == 'MD':
debug( '%s ==> MD' % message_prefix)
self._distributeNode_MD(item)
elif item.pos[0] == 'V':
debug( '%s ==> V' % message_prefix)
self._distributeNode_V(item, tempNodes, itemCounter)
elif item.pos in forms.partAdv:
debug( '%s ==> ADV' % message_prefix)
self._distributeNode_ADV(item, tempNodes, itemCounter)
else:
debug( '%s ==> None' % message_prefix)
itemCounter += 1
if DEBUG:
self.print_ChunkLists()
开发者ID:tarsqi,项目名称:ttk,代码行数:32,代码来源:features.py
示例8: _find_slink
def _find_slink(self, event_context, fsa_lists, reltype_list):
"""Try to find an slink in the given event_context using lists of
FSAs. If the context matches an FSA, then create an slink and insert it
in the tree."""
for i in range(len(fsa_lists)):
fsa_list = fsa_lists[i]
result = self._look_for_link(event_context, fsa_list)
if result:
(length_of_match, fsa_num) = result
fsa = fsa_list[fsa_num]
# logger.debug("match found, FSA=%s size=%d reltype=%s"
# % (fsa.fsaname, length_of_match, reltype))
reltype = get_reltype(reltype_list, i)
eiid = event_context[length_of_match - 1].eiid
slinkAttrs = {
EVENT_INSTANCE_ID: self.eiid,
SUBORDINATED_EVENT_INSTANCE: eiid,
RELTYPE: reltype,
SYNTAX: fsa.fsaname }
self.tree.addLink(slinkAttrs, SLINK)
logger.debug("SLINK CREATED")
return True
else:
logger.debug("REJECTED SLINK by FSA: " + str(i))
return False
开发者ID:mnscholz,项目名称:ttk,代码行数:28,代码来源:constituent.py
示例9: _find_alink
def _find_alink(self, event_context, fsa_lists, reltype_list):
"""Try to create an alink using the context and patterns from the
dictionary. Alinks are created as a side effect. Returns True if an
alink was created, False otherwise."""
for i in range(len(fsa_lists)):
fsa_list = fsa_lists[i]
result = self._look_for_link(event_context, fsa_lists[i])
if result:
(length_of_match, fsa_num) = result
fsa = fsa_list[fsa_num]
# logger.debug("match found, FSA=%s size=%d reltype=%s"
# % (fsa.fsaname, length_of_match, reltype))
reltype = get_reltype(reltype_list, i)
eiid = event_context[length_of_match - 1].eiid
# print self, self.eiid
alinkAttrs = {
EVENT_INSTANCE_ID: self.eiid,
RELATED_TO_EVENT_INSTANCE: eiid,
RELTYPE: reltype,
SYNTAX: fsa.fsaname }
self.tree.addLink(alinkAttrs, ALINK)
# for l in self.tree.alink_list: print ' ', l
logger.debug("ALINK CREATED")
return True
else:
logger.debug("REJECTED ALINK by FSA: " + str(i))
return False
开发者ID:mnscholz,项目名称:ttk,代码行数:30,代码来源:constituent.py
示例10: _processDoubleEventInMultiAChunk
def _processDoubleEventInMultiAChunk(self, GramVCh, substring):
"""Tagging EVENT in VChunk """
logger.debug("[V_2Ev] " + GramVCh.as_extended_string())
self._processEventInChunk(GramVCh)
"""Tagging EVENT in AdjToken"""
adjToken = substring[-1]
adjToken.createAdjEvent()
self._updateFlagCheckedForEvents(substring)
开发者ID:jasonzou,项目名称:TARSQI,代码行数:8,代码来源:chunks.py
示例11: _processDoubleEventInMultiAChunk
def _processDoubleEventInMultiAChunk(self, features, substring):
"""Tagging EVENT in both VerbChunk and AdjectiveToken. In this case the
adjective will not be given the verb features."""
logger.debug("[V_2Ev] " + features.as_verbose_string())
self._conditionallyAddEvent(features)
adjToken = substring[-1]
adjToken.createAdjEvent()
map(update_event_checked_marker, substring)
开发者ID:tarsqi,项目名称:ttk,代码行数:8,代码来源:chunks.py
示例12: find_forward_alink
def find_forward_alink(self, fsa_reltype_groups):
"""Search for an alink to the right of the event. Return True
is event was found, False otherwise."""
logger.debug("len(fsa_reltype_groups) = %s" % len(fsa_reltype_groups))
fsa_lists = fsa_reltype_groups[0]
reltypes_list = fsa_reltype_groups[1]
alinkedEventContext = self.parent[self.position + 1:]
return self._find_alink(alinkedEventContext, fsa_lists, reltypes_list)
开发者ID:mnscholz,项目名称:ttk,代码行数:8,代码来源:constituent.py
示例13: _createEventOnHave
def _createEventOnHave(self, features):
logger.debug("Checking for toHave pattern...")
substring = self._lookForMultiChunk(patterns.HAVE_FSAs)
if substring:
self.dribble("HAVE-1", self.getText())
self._processEventInMultiVChunk(substring)
else:
self.dribble("HAVE-2", self.getText())
self._conditionallyAddEvent(features)
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例14: _createEventOnPastUsedTo
def _createEventOnPastUsedTo(self, features):
logger.debug("Checking for pastUsedTo pattern...")
substring = self._lookForMultiChunk(patterns.USEDto_FSAs)
if substring:
self.dribble("USED-1", self.getText())
self._processEventInMultiVChunk(substring)
else:
self.dribble("USED-2", self.getText())
self._conditionallyAddEvent(features)
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例15: _run_classifier
def _run_classifier(self, lemma):
"""Run the classifier on lemma, using features from the GramNChunk."""
features = []
if EVITA_NOM_CONTEXT:
features = ['DEF' if self.isDefinite() else 'INDEF',
self.features.head.pos]
is_event = nomEventRec.isEvent(lemma, features)
logger.debug(" nomEventRec.isEvent(%s) ==> %s" % (lemma, is_event))
return is_event
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例16: _createEventOnDoAuxiliar
def _createEventOnDoAuxiliar(self, features):
logger.debug("Checking for doAuxiliar pattern...")
substring = self._lookForMultiChunk(patterns.DO_FSAs)
if substring:
self.dribble("DO-AUX", self.getText())
self._processEventInMultiVChunk(substring)
else:
self.dribble("DO", self.getText())
self._conditionallyAddEvent(features)
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例17: _createEventOnFutureGoingTo
def _createEventOnFutureGoingTo(self, features):
logger.debug("Checking for futureGoingTo pattern...")
substring = self._lookForMultiChunk(patterns.GOINGto_FSAs)
if substring:
self.dribble("GOING-TO", self.getText())
self._processEventInMultiVChunk(substring)
else:
self.dribble("GOING", self.getText())
self._conditionallyAddEvent(features)
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例18: _debug_vcf
def _debug_vcf(vcf_list):
logger.debug("len(features_list) = %d" % len(vcf_list))
if len(vcf_list) > 0 and DEBUG:
for vcf in vcf_list:
if DEBUG:
print ' ',
vcf.pp()
for vcf in vcf_list:
logger.debug(vcf.as_verbose_string())
开发者ID:tarsqi,项目名称:ttk,代码行数:9,代码来源:chunks.py
示例19: createTLinksFromSLinks
def createTLinksFromSLinks(self):
"""Calls lookForStlinks for a given Slink object."""
logger.debug("Number of SLINKs in file: "+str(len(self.slinks)))
for slinkTag in self.slinks:
try:
slink = Slink(self.xmldoc, self.doctree, slinkTag)
slink.match_rules(self.rules)
except:
logger.error("Error processing SLINK")
开发者ID:jasonzou,项目名称:TARSQI,代码行数:9,代码来源:main.py
示例20: createAdjEvent
def createAdjEvent(self, gramvchunk=None):
"""Processes the adjective after a copular verb and make it an event if the
adjective has an event class."""
logger.debug("AdjectiveToken.createAdjEvent(gramvchunk)")
if not self.parent.__class__.__name__ == 'Sentence':
logger.warn("Unexpected syntax tree")
return
self.gramchunk = GramAChunk(self, gramvchunk)
logger.debug(self.gramchunk.as_verbose_string())
self._conditionallyAddEvent()
开发者ID:mnscholz,项目名称:ttk,代码行数:10,代码来源:tokens.py
注:本文中的utilities.logger.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论