示例#1
0
def load_cards(path):
    csv = CSV.load(path)
    cards = []

    for text_xml, sentence_index, chunk_index in csv:
        text = Text.from_xml(encode_utf8(text_xml))
        card = Card(text, int(sentence_index), int(chunk_index))
        cards.append(card)

    return cards
示例#2
0
文件: test_db.py 项目: sp00/pattern
 def test_encode_utf8(self):
     # Assert Python bytestring.
     for s in self.strings:
         self.assertTrue(isinstance(db.encode_utf8(s), str))
     print "pattern.db.encode_utf8()"