(input, output)
| 8 | from jieba import analyse |
| 9 | |
| 10 | def segment(input, output): |
| 11 | input_file = open(input, "r") |
| 12 | output_file = open(output, "w") |
| 13 | while True: |
| 14 | line = input_file.readline() |
| 15 | if line: |
| 16 | line = line.strip() |
| 17 | seg_list = jieba.cut(line) |
| 18 | segments = "" |
| 19 | for str in seg_list: |
| 20 | segments = segments + " " + str |
| 21 | segments = segments + "\n" |
| 22 | output_file.write(segments) |
| 23 | else: |
| 24 | break |
| 25 | input_file.close() |
| 26 | output_file.close() |
| 27 | |
| 28 | if __name__ == '__main__': |
| 29 | if 3 != len(sys.argv): |