示例#1
0
 def _distributeNode_ADV(self, item, tempNodes, itemCounter):
     """Just add the adverb to an adverb list, the trick is to figure out which list
     to add it. Factors are the location of the item in the tempNodes list
     and the pos tags of the elements following the item."""
     # TODO. This does often not do the right thing. For example, in the
     # phrase 'will end up being eliminated', we get two GramVChunks, but
     # 'up' will live in the adverbsPre list of the second one (instead of in
     # the adverbsPost list of the first). This is of limited negative effect
     # since the only thing that the adverbs are used for is to scan the
     # adverbPre list for 'only', which has effect on the polarity.
     if item != tempNodes[-1]:
         debug("      NOT LAST")
         if len(tempNodes) > itemCounter + 1:
             debug('        tempNodes IS LONG')
             if (tempNodes[itemCounter + 1].pos == 'TO'
                     or contains_adverbs_only(tempNodes[itemCounter:])):
                 # this would apply to text like "end up in Tokyo" but the
                 # chunker does not recognize "end up" as a <vg>
                 debug('          NEXT IS TO OR REST IS ADVERBS')
                 self._addInPreviousSublist(self.adverbsPostLists, item)
             else:
                 debug('          NEXT IS NOT TO AND REST IS NOT ADVERBS')
                 self._addInCurrentSublist(self.adverbsPreLists, item)
         else:
             debug('        tempNodes IS NOT LONG')
             self._addInCurrentSublist(self.adverbsPostLists, item)
     else:
         debug("      LAST")
         self._addInPreviousSublist(self.adverbsPostLists, item)
示例#2
0
文件: features.py 项目: tarsqi/ttk
 def _distributeNode_ADV(self, item, tempNodes, itemCounter):
     """Just add the adverb to an adverb list, the trick is to figure out which list
     to add it. Factors are the location of the item in the tempNodes list
     and the pos tags of the elements following the item."""
     # TODO. This does often not do the right thing. For example, in the
     # phrase 'will end up being eliminated', we get two VChunkFeatures
     # instances, but 'up' will live in the adverbsPre list of the second one
     # (instead of in the adverbsPost list of the first). This is of limited
     # negative effect since the only thing that the adverbs are used for is
     # to scan the adverbPre list for 'only', which has effect on the
     # polarity.
     if item != tempNodes[-1]:
         debug("      NOT LAST")
         if len(tempNodes) > itemCounter+1:
             debug('        tempNodes IS LONG')
             if (tempNodes[itemCounter+1].pos == 'TO' or
                 contains_adverbs_only(tempNodes[itemCounter:])):
                 # this would apply to text like "end up in Tokyo" but the
                 # chunker does not recognize "end up" as a <vg>
                 debug('          NEXT IS TO OR REST IS ADVERBS')
                 self._addInPreviousSublist(self.adverbsPostLists, item)
             else:
                 debug('          NEXT IS NOT TO AND REST IS NOT ADVERBS')
                 self._addInCurrentSublist(self.adverbsPreLists, item)
         else:
             debug('        tempNodes IS NOT LONG')
             self._addInCurrentSublist(self.adverbsPostLists, item)
     else:
         debug("      LAST")
         self._addInPreviousSublist(self.adverbsPostLists, item)
示例#3
0
 def _treatMainVerb(self, item, tempNodes, itemCounter):
     """Add a main verb to the trueChunks list. That is all that is done when the
     item is followed by adverbs only. In other cases, we have a chunk which
     has two subchunks and _updateChunkLists is called to introduce the
     second chunk. This is to deal with cases like 'might consider filing',
     where we want to end up with two events."""
     self._addInCurrentSublist(self.trueChunkLists, item)
     if not contains_adverbs_only(tempNodes[itemCounter + 1:]):
         self._updateChunkLists()
示例#4
0
文件: features.py 项目: tarsqi/ttk
 def _treatMainVerb(self, item, tempNodes, itemCounter):
     """Add a main verb to the trueChunks list. That is all that is done when the
     item is followed by adverbs only. In other cases, we have a chunk which
     has two subchunks and _updateChunkLists is called to introduce the
     second chunk. This is to deal with cases like 'might consider filing',
     where we want to end up with two events."""
     self._addInCurrentSublist(self.trueChunkLists, item)
     if not contains_adverbs_only(tempNodes[itemCounter+1:]):
         self._updateChunkLists()