@@ -88,7 +88,7 @@ def unique(iterable):
8888
8989
9090def zip (* args , ** kwargs ):
91- """ Returns a list of tuples, where the i-th tuple contains the i-th element
91+ """ Returns a list of tuples, where the i-th tuple contains the i-th element
9292 from each of the argument sequences or iterables (or default if too short).
9393 """
9494 args = [list (iterable ) for iterable in args ]
@@ -810,13 +810,13 @@ def append(self, word, lemma=None, type=None, chunk=None, role=None, relation=No
810810 def parse_token (self , token , tags = [WORD , POS , CHUNK , PNP , REL , ANCHOR , LEMMA ]):
811811 """ Returns the arguments for Sentence.append() from a tagged token representation.
812812 The order in which token tags appear can be specified.
813- The default order is (separated by slashes):
814- - word,
815- - part-of-speech,
816- - (IOB-)chunk,
817- - (IOB-)preposition,
818- - chunk(-relation)(-role),
819- - anchor,
813+ The default order is (separated by slashes):
814+ - word,
815+ - part-of-speech,
816+ - (IOB-)chunk,
817+ - (IOB-)preposition,
818+ - chunk(-relation)(-role),
819+ - anchor,
820820 - lemma.
821821 Examples:
822822 The/DT/B-NP/O/NP-SBJ-1/O/the
@@ -1079,7 +1079,7 @@ def get(self, index, tag=LEMMA):
10791079
10801080 def loop (self , * tags ):
10811081 """ Iterates over the tags in the entire Sentence,
1082- For example, Sentence.loop(POS, LEMMA) yields tuples of the part-of-speech tags and lemmata.
1082+ For example, Sentence.loop(POS, LEMMA) yields tuples of the part-of-speech tags and lemmata.
10831083 Possible tags: WORD, LEMMA, POS, CHUNK, PNP, RELATION, ROLE, ANCHOR or a custom word tag.
10841084 Any order or combination of tags can be supplied.
10851085 """
@@ -1339,7 +1339,12 @@ def xml(self):
13391339 xml .append ("<%s>" % XML_TEXT )
13401340 xml .extend ([sentence .xml for sentence in self ])
13411341 xml .append ("</%s>" % XML_TEXT )
1342- return "\n " .join (xml )
1342+ xml_ = "\n " .join (xml )
1343+ try :
1344+ xml_ .encode ("utf-8" )
1345+ except AttributeError : # TODO remove this hack
1346+ pass
1347+ return xml_
13431348
13441349 @classmethod
13451350 def from_xml (cls , xml ):
0 commit comments